Skip to contentSkip to conversation

block/iscsi:use the flags in iscsi_open() prevent Clang warning

PATCH Applied Chen Qun 4 participants 5 messages Mar 11, 2020 – Mar 23, 2020 Block layer

lore
Share & tools
lore

Chen Qun

author
#0 lore raw

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
index 682abd8e09..50bae51700 100644
@@ -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
#1 lore raw

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

#2 lore raw

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

#3 lore raw
In reply to Chen Qun
Quoted 5 lines · 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;
        ^        ~~~~~~~~~~~~
Quoted 7 lines

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.

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
index 682abd8e09..50bae51700 100644
@@ -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
Applied
#4 lore raw
In reply to Chen Qun

Am 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 read

        flags &= ~BDRV_O_RDWR;
        ^        ~~~~~~~~~~~~
Quoted 7 lines

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.

Thanks, applied to the block branch.

Kevin