All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
	Kevin Wolf <kwolf@redhat.com>, qemu-devel <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-trivial] [PATCH] block: Remove unused assignment (fixes warning from clang)
Date: Sun, 29 Sep 2013 22:15:10 +0200	[thread overview]
Message-ID: <52488A4E.5010902@weilnetz.de> (raw)
In-Reply-To: <52488325.5090702@msgid.tls.msk.ru>

Am 29.09.2013 21:44, schrieb Michael Tokarev:
> 28.09.2013 13:55, Stefan Weil wrote:
[...]
>> diff --git a/blockdev.c b/blockdev.c
>> index 8aa66a9..8c83f6f 100644
>> --- a/blockdev.c
>> +++ b/blockdev.c
>> @@ -1926,7 +1926,6 @@ void qmp_drive_mirror(const char *device, const
>> char *target,
>>       } else {
>>           switch (mode) {
>>           case NEW_IMAGE_MODE_EXISTING:
>> -            ret = 0;
>>               break;
>
> While this one is obviously unused assignment,
> there's on more usage of `ret' variable in this
> function, -- it is to store the return value
> from bdrv_open():
>
>     ret = bdrv_open(target_bs, target, NULL, flags |
> BDRV_O_NO_BACKING, drv,
>                     &local_err);
>     if (ret < 0) {...
>
> What's the rule about converting that into if() ?
>
> Thanks,
>
> /mjt

Is there a rule for cases like that? This pattern is very common in QEMU
code
(several occurrences in blockdev.c). Should we eliminate the 'ret' variable?
I don't think it's worth the effort.

Stefan



WARNING: multiple messages have this Message-ID (diff)
From: Stefan Weil <sw@weilnetz.de>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
	Kevin Wolf <kwolf@redhat.com>, qemu-devel <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] block: Remove unused assignment (fixes warning from clang)
Date: Sun, 29 Sep 2013 22:15:10 +0200	[thread overview]
Message-ID: <52488A4E.5010902@weilnetz.de> (raw)
In-Reply-To: <52488325.5090702@msgid.tls.msk.ru>

Am 29.09.2013 21:44, schrieb Michael Tokarev:
> 28.09.2013 13:55, Stefan Weil wrote:
[...]
>> diff --git a/blockdev.c b/blockdev.c
>> index 8aa66a9..8c83f6f 100644
>> --- a/blockdev.c
>> +++ b/blockdev.c
>> @@ -1926,7 +1926,6 @@ void qmp_drive_mirror(const char *device, const
>> char *target,
>>       } else {
>>           switch (mode) {
>>           case NEW_IMAGE_MODE_EXISTING:
>> -            ret = 0;
>>               break;
>
> While this one is obviously unused assignment,
> there's on more usage of `ret' variable in this
> function, -- it is to store the return value
> from bdrv_open():
>
>     ret = bdrv_open(target_bs, target, NULL, flags |
> BDRV_O_NO_BACKING, drv,
>                     &local_err);
>     if (ret < 0) {...
>
> What's the rule about converting that into if() ?
>
> Thanks,
>
> /mjt

Is there a rule for cases like that? This pattern is very common in QEMU
code
(several occurrences in blockdev.c). Should we eliminate the 'ret' variable?
I don't think it's worth the effort.

Stefan

  reply	other threads:[~2013-09-29 20:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-28  9:55 [Qemu-trivial] [PATCH] block: Remove unused assignment (fixes warning from clang) Stefan Weil
2013-09-28  9:55 ` [Qemu-devel] " Stefan Weil
2013-09-29 19:44 ` [Qemu-trivial] " Michael Tokarev
2013-09-29 19:44   ` [Qemu-devel] " Michael Tokarev
2013-09-29 20:15   ` Stefan Weil [this message]
2013-09-29 20:15     ` Stefan Weil
2013-09-30  7:57     ` Kevin Wolf
2013-09-30  7:57       ` [Qemu-devel] " Kevin Wolf
2013-09-30  9:16     ` Stefan Hajnoczi
2013-09-30  9:16       ` [Qemu-devel] " Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52488A4E.5010902@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=kwolf@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.