qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] block/iscsi:use the flags in iscsi_open() prevent Clang warning
@ 2020-03-11  3:29 Chen Qun
  2020-03-20  2:25 ` Chenqun (kuhn)
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chen Qun @ 2020-03-11  3:29 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Kevin Wolf, zhang.zhanghailiang, Euler Robot, Peter Lieven,
	Laurent Vivier, Max Reitz, Ronnie Sahlberg, Paolo Bonzini,
	Chen Qun

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.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Lieven <pl@kamp.de>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: Laurent Vivier <laurent@vivier.eu>

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(-)

diff --git a/block/iscsi.c b/block/iscsi.c
index 682abd8e09..50bae51700 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -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




^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-23 16:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-11  3:29 [PATCH v3] block/iscsi:use the flags in iscsi_open() prevent Clang warning Chen Qun
2020-03-20  2:25 ` Chenqun (kuhn)
2020-03-20  9:20   ` Laurent Vivier
2020-03-20 14:04 ` Stefan Hajnoczi
2020-03-23 16:58 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).