Blame SOURCES/nvme-ioctl-fix-wrong-ret-case-of-get-prop-patch

44bbf1
commit 5b7506198a6872764a51e32363e219916e1e592e
44bbf1
Author: Minwoo Im <minwoo.im@samsung.com>
44bbf1
Date:   Wed Apr 24 01:48:58 2019 +0100
44bbf1
44bbf1
    ioctl: Fix wrong return case of get_property
44bbf1
    
44bbf1
    If get_property_helper() succeeds in the first time, and then fails in
44bbf1
    the next time, then the ret value will not be updated to an error value.
44bbf1
    This patch removes 'ret' variable to make 'err' to return being updated
44bbf1
    everytime get_property_helper() invoked.
44bbf1
    
44bbf1
    Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
44bbf1
44bbf1
diff --git a/nvme-ioctl.c b/nvme-ioctl.c
44bbf1
index 16fdc66..75bf9fa 100644
44bbf1
--- a/nvme-ioctl.c
44bbf1
+++ b/nvme-ioctl.c
44bbf1
@@ -612,7 +612,7 @@ int nvme_get_property(int fd, int offset, uint64_t *value)
44bbf1
 int nvme_get_properties(int fd, void **pbar)
44bbf1
 {
44bbf1
 	int offset, advance;
44bbf1
-	int err, ret = -EINVAL;
44bbf1
+	int err;
44bbf1
 	int size = getpagesize();
44bbf1
 
44bbf1
 	*pbar = malloc(size);
44bbf1
@@ -624,15 +624,13 @@ int nvme_get_properties(int fd, void **pbar)
44bbf1
 	memset(*pbar, 0xff, size);
44bbf1
 	for (offset = NVME_REG_CAP; offset <= NVME_REG_CMBSZ; offset += advance) {
44bbf1
 		err = get_property_helper(fd, offset, *pbar + offset, &advance);
44bbf1
-		if (!err)
44bbf1
-			ret = 0;
44bbf1
-		else {
44bbf1
+		if (err) {
44bbf1
 			free(*pbar);
44bbf1
 			break;
44bbf1
 		}
44bbf1
 	}
44bbf1
 
44bbf1
-	return ret;
44bbf1
+	return err;
44bbf1
 }
44bbf1
 
44bbf1
 int nvme_set_property(int fd, int offset, int value)