block/iscsi:use the flags in iscsi_open() prevent Clang warning
PATCH v3 1/1 block/iscsi:use the flags in iscsi_open() prevent Clang warning
Clang static code analyzer show warning:
block/iscsi.c:1920:9: warning: Value stored to 'flags' is never read
flags &= ~BDRV_O_RDWR;
^ ~~~~~~~~~~~~In iscsi_allocmap_init() only checks BDRV_O_NOCACHE, which is the same in both of flags and bs->open_flags.
We can use the flags instead bs->open_flags to prevent Clang warning.
---
Cc: Ronnie Sahlberg <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Peter Lieven <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: Laurent Vivier <[email protected]>
v1->v2:
Keep the 'flags' then use it(Base on Kevin's comments).
v2->v3:
Modify subject and commit messages(Base on Kevin's and Laurent's comments).
--- block/iscsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/iscsi.c +1 -1
@@ -2002,7 +2002,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, iscsilun->cluster_size = iscsilun->bl.opt_unmap_gran * iscsilun->block_size;if (iscsilun->lbprz) { - ret =iscsi_allocmap_init (iscsilun, bs->open_flags); + ret =iscsi_allocmap_init (iscsilun, flags); } }
Signature · 1 line
2.23.0
Gentle ping.
Any other suggestions about this?
Thanks.
Quoted 59 lines
-----Original Message-----
From: Chenqun (kuhn)
Sent: Wednesday, March 11, 2020 11:29 AM
To: [email protected]; [email protected]
Cc: Zhanghailiang <[email protected]>; Chenqun (kuhn) <[email protected]>; Euler Robot <[email protected]>; Kevin Wolf <[email protected]>; Ronnie Sahlberg <[email protected]>; Paolo Bonzini <[email protected]>; Peter Lieven <[email protected]>; Max Reitz <[email protected]>; Laurent Vivier <[email protected]>
Subject: [PATCH v3] block/iscsi:use the flags iniscsi_open()prevent Clang warningClang static code analyzer show warning:
block/iscsi.c:1920:9: warning: Value stored to 'flags' is never readflags &= ~BDRV_O_RDWR; ^ ~~~~~~~~~~~~In
iscsi_allocmap_init()only checksBDRV_O_NOCACHE, which is the same in both of flags andbs->open_flags.
We can use the flags insteadbs->open_flagsto prevent Clang warning.Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>Reviewed-by Kevin Wolf <[email protected]>---
Cc: Ronnie Sahlberg <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Peter Lieven <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: Laurent Vivier <[email protected]>
v1->v2:
Keep the 'flags' then use it(Base on Kevin's comments).
v2->v3:
Modify subject and commit messages(Base on Kevin's and Laurent's comments).
---block/iscsi.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)block/iscsi.c +1
-2@@ -2002,7 +2002,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, iscsilun->cluster_size = iscsilun->bl.opt_unmap_gran * iscsilun->block_size;if (iscsilun->lbprz) { - ret =iscsi_allocmap_init (iscsilun, bs->open_flags); + ret =iscsi_allocmap_init (iscsilun, flags); } } --2.23.0
Le 20/03/2020 à 03:25, Chenqun (kuhn) a écrit :
Quoted 3 lines
Gentle ping.
Any other suggestions about this?
I will not take that via the trivial queue as it is not trivial for me.
Could it go via block queue?
Thanks,
Laurent
Quoted 62 lines
Thanks.
Quoted 59 lines
-----Original Message-----
From: Chenqun (kuhn)
Sent: Wednesday, March 11, 2020 11:29 AM
To: [email protected]; [email protected]
Cc: Zhanghailiang <[email protected]>; Chenqun (kuhn) <[email protected]>; Euler Robot <[email protected]>; Kevin Wolf <[email protected]>; Ronnie Sahlberg <[email protected]>; Paolo Bonzini <[email protected]>; Peter Lieven <[email protected]>; Max Reitz <[email protected]>; Laurent Vivier <[email protected]>
Subject: [PATCH v3] block/iscsi:use the flags iniscsi_open()prevent Clang warningClang static code analyzer show warning:
block/iscsi.c:1920:9: warning: Value stored to 'flags' is never readflags &= ~BDRV_O_RDWR; ^ ~~~~~~~~~~~~In
iscsi_allocmap_init()only checksBDRV_O_NOCACHE, which is the same in both of flags andbs->open_flags.
We can use the flags insteadbs->open_flagsto prevent Clang warning.Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>Reviewed-by Kevin Wolf <[email protected]>---
Cc: Ronnie Sahlberg <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Peter Lieven <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: Laurent Vivier <[email protected]>
v1->v2:
Keep the 'flags' then use it(Base on Kevin's comments).
v2->v3:
Modify subject and commit messages(Base on Kevin's and Laurent's comments).
---block/iscsi.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)block/iscsi.c +1
-2@@ -2002,7 +2002,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, iscsilun->cluster_size = iscsilun->bl.opt_unmap_gran * iscsilun->block_size;if (iscsilun->lbprz) { - ret =iscsi_allocmap_init (iscsilun, bs->open_flags); + ret =iscsi_allocmap_init (iscsilun, flags); } } --2.23.0
Quoted 5 lines · Chen Qun
Clang static code analyzer show warning:
block/iscsi.c:1920:9: warning: Value stored to 'flags' is never readflags &= ~BDRV_O_RDWR; ^ ~~~~~~~~~~~~
Quoted 7 lines
In
iscsi_allocmap_init()only checksBDRV_O_NOCACHE, which is the same in both of flags andbs->open_flags.
We can use the flags insteadbs->open_flagsto prevent Clang warning.Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>Reviewed-by Kevin Wolf <[email protected]>
This can go via Paolo's SCSI tree.
Quoted 35 lines
---
Cc: Ronnie Sahlberg <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Peter Lieven <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: Laurent Vivier <[email protected]>
v1->v2:
Keep the 'flags' then use it(Base on Kevin's comments).
v2->v3:
Modify subject and commit messages(Base on Kevin's and Laurent's comments).--- block/iscsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)block/iscsi.c +1
-1@@ -2002,7 +2002,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, iscsilun->cluster_size = iscsilun->bl.opt_unmap_gran * iscsilun->block_size;if (iscsilun->lbprz) { - ret =iscsi_allocmap_init (iscsilun, bs->open_flags); + ret =iscsi_allocmap_init (iscsilun, flags); } }Signature · 1 line
2.23.0
Kevin Wolf
AppliedAm 11.03.2020 um 04:29 hat Chen Qun geschrieben:
Quoted 5 lines
Clang static code analyzer show warning:
block/iscsi.c:1920:9: warning: Value stored to 'flags' is never readflags &= ~BDRV_O_RDWR; ^ ~~~~~~~~~~~~
Quoted 7 lines
In
iscsi_allocmap_init()only checksBDRV_O_NOCACHE, which is the same in both of flags andbs->open_flags.
We can use the flags insteadbs->open_flagsto prevent Clang warning.Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>Reviewed-by Kevin Wolf <[email protected]>
Thanks, applied to the block branch.
Kevin