svn commit: r324827 - stable/11/sys/contrib/libnv
Mariusz Zaborski
oshogbo at FreeBSD.org
Sat Oct 21 19:26:48 UTC 2017
Author: oshogbo
Date: Sat Oct 21 19:26:47 2017
New Revision: 324827
URL: https://svnweb.freebsd.org/changeset/base/324827
Log:
MFC r323859:
Simplify the code by _not_ expecting success under 'fail'.
Submitted by: pjd@ and oshogbo@
MFC after: 1 month
Sponsored by: Wheel Systems
Modified:
stable/11/sys/contrib/libnv/nvpair.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/contrib/libnv/nvpair.c
==============================================================================
--- stable/11/sys/contrib/libnv/nvpair.c Sat Oct 21 19:14:45 2017 (r324826)
+++ stable/11/sys/contrib/libnv/nvpair.c Sat Oct 21 19:26:47 2017 (r324827)
@@ -1740,7 +1740,6 @@ nvpair_move_descriptor_array(const char *name, int *va
nvpair_t *nvp;
size_t i;
- nvp = NULL;
if (value == NULL || nitems == 0) {
ERRNO_SET(EINVAL);
return (NULL);
@@ -1755,19 +1754,20 @@ nvpair_move_descriptor_array(const char *name, int *va
nvp = nvpair_allocv(name, NV_TYPE_DESCRIPTOR_ARRAY,
(uint64_t)(uintptr_t)value, sizeof(value[0]) * nitems, nitems);
+ if (nvp == NULL)
+ goto fail;
+ return (nvp);
fail:
- if (nvp == NULL) {
- ERRNO_SAVE();
- for (i = 0; i < nitems; i++) {
- if (fd_is_valid(value[i]))
- close(value[i]);
- }
- nv_free(value);
- ERRNO_RESTORE();
+ ERRNO_SAVE();
+ for (i = 0; i < nitems; i++) {
+ if (fd_is_valid(value[i]))
+ close(value[i]);
}
+ nv_free(value);
+ ERRNO_RESTORE();
- return (nvp);
+ return (NULL);
}
#endif
More information about the svn-src-all
mailing list