All of lore.kernel.org
 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

* RE: [PATCH v3] block/iscsi:use the flags in iscsi_open() prevent Clang warning
  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
  2 siblings, 1 reply; 5+ messages in thread
From: Chenqun (kuhn) @ 2020-03-20  2:25 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Kevin Wolf, Zhanghailiang, Peter Lieven, Laurent Vivier,
	Max Reitz, Ronnie Sahlberg, Euler Robot, Paolo Bonzini

Gentle ping.

Any other suggestions about this?

Thanks.

>-----Original Message-----
>From: Chenqun (kuhn)
>Sent: Wednesday, March 11, 2020 11:29 AM
>To: qemu-devel@nongnu.org; qemu-trivial@nongnu.org
>Cc: Zhanghailiang <zhang.zhanghailiang@huawei.com>; Chenqun (kuhn)
><kuhn.chenqun@huawei.com>; Euler Robot <euler.robot@huawei.com>;
>Kevin Wolf <kwolf@redhat.com>; Ronnie Sahlberg
><ronniesahlberg@gmail.com>; Paolo Bonzini <pbonzini@redhat.com>; Peter
>Lieven <pl@kamp.de>; Max Reitz <mreitz@redhat.com>; Laurent Vivier
><laurent@vivier.eu>
>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.
>
>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	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] block/iscsi:use the flags in iscsi_open() prevent Clang warning
  2020-03-20  2:25 ` Chenqun (kuhn)
@ 2020-03-20  9:20   ` Laurent Vivier
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2020-03-20  9:20 UTC (permalink / raw)
  To: Chenqun (kuhn), qemu-devel, qemu-trivial
  Cc: Kevin Wolf, Zhanghailiang, Peter Lieven, Max Reitz,
	Ronnie Sahlberg, Euler Robot, Paolo Bonzini

Le 20/03/2020 à 03:25, Chenqun (kuhn) a écrit :
> 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

> Thanks.
> 
>> -----Original Message-----
>> From: Chenqun (kuhn)
>> Sent: Wednesday, March 11, 2020 11:29 AM
>> To: qemu-devel@nongnu.org; qemu-trivial@nongnu.org
>> Cc: Zhanghailiang <zhang.zhanghailiang@huawei.com>; Chenqun (kuhn)
>> <kuhn.chenqun@huawei.com>; Euler Robot <euler.robot@huawei.com>;
>> Kevin Wolf <kwolf@redhat.com>; Ronnie Sahlberg
>> <ronniesahlberg@gmail.com>; Paolo Bonzini <pbonzini@redhat.com>; Peter
>> Lieven <pl@kamp.de>; Max Reitz <mreitz@redhat.com>; Laurent Vivier
>> <laurent@vivier.eu>
>> 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.
>>
>> 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	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] block/iscsi:use the flags in iscsi_open() prevent Clang warning
  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 14:04 ` Stefan Hajnoczi
  2020-03-23 16:58 ` Kevin Wolf
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2020-03-20 14:04 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Kevin Wolf, zhang.zhanghailiang, qemu-trivial, Peter Lieven,
	qemu-devel, Laurent Vivier, Ronnie Sahlberg, Euler Robot,
	Chen Qun, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 1690 bytes --]

On Wed, Mar 11, 2020 at 11:29:27AM +0800, Chen Qun wrote:
> 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>

This can go via Paolo's SCSI tree.

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3] block/iscsi:use the flags in iscsi_open() prevent Clang warning
  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 14:04 ` Stefan Hajnoczi
@ 2020-03-23 16:58 ` Kevin Wolf
  2 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2020-03-23 16:58 UTC (permalink / raw)
  To: Chen Qun
  Cc: zhang.zhanghailiang, qemu-trivial, Peter Lieven, qemu-devel,
	Max Reitz, Ronnie Sahlberg, Euler Robot, Paolo Bonzini,
	Laurent Vivier

Am 11.03.2020 um 04:29 hat Chen Qun geschrieben:
> 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>

Thanks, applied to the block branch.

Kevin



^ permalink raw reply	[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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.