[PATCH] bs_rbd: fix error assignment in if condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The statement

if ((x == f()) < 0) {}

is strange. I think it should be

if ((x = f()) < 0) {}

For the reasone of coding style, I modify it as

x = f();
if (x < 0) {}

Signed-off-by: Ruoyu <liangry@xxxxxxxxx>
---
 usr/bs_rbd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr/bs_rbd.c b/usr/bs_rbd.c
index 3a052ed..ef14797 100644
--- a/usr/bs_rbd.c
+++ b/usr/bs_rbd.c
@@ -431,8 +431,8 @@ static int bs_rbd_open(struct scsi_lu *lu, char *path, int *fd, uint64_t *size)
 	eprintf("bs_rbd_open: pool: %s image: %s snap: %s\n",
 		poolname, imagename, snapname);
 
-	if ((ret == rados_ioctx_create(rbd->cluster, poolname, &rbd->ioctx))
-	    < 0) {
+	ret = rados_ioctx_create(rbd->cluster, poolname, &rbd->ioctx);
+	if (ret < 0) {
 		eprintf("bs_rbd_open: rados_ioctx_create: %d\n", ret);
 		return -EIO;
 	}
-- 
1.8.3.2


--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux