From: Phillip Potter <phil@philpotter.co.uk>
To: luo penghao <cgel.zte@gmail.com>
Cc: linux-kernel@vger.kernel.org,
penghao luo <luo.penghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>,
linux-block@vger.kernel.org
Subject: Re: [PATCH linux-next] cdrom: Remove redundant variable and its assignment.
Date: Tue, 19 Oct 2021 00:29:46 +0100 [thread overview]
Message-ID: <YW4C4A5S+mjHzKN2@KernelVM> (raw)
In-Reply-To: <20211018090834.856992-1-luo.penghao@zte.com.cn>
On Mon, Oct 18, 2021 at 09:08:34AM +0000, luo penghao wrote:
> From: penghao luo <luo.penghao@zte.com.cn>
>
> Variable is not used in functions, and its assignment is redundant too.
> So it should be deleted.
>
> The clang_analyzer complains as follows:
>
> drivers/cdrom/cdrom.c:877: warning:
>
> Although the value stored to 'ret' is used in the enclosing expression,
> the value is never actually read from 'ret’.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: penghao luo <luo.penghao@zte.com.cn>
> ---
Dear Penghao,
Thank you for the patch, looks good, but please could I ask for a small
tweak:
> drivers/cdrom/cdrom.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
> index 89a6845..393acf4 100644
> --- a/drivers/cdrom/cdrom.c
> +++ b/drivers/cdrom/cdrom.c
> @@ -871,7 +871,7 @@ static void cdrom_mmc3_profile(struct cdrom_device_info *cdi)
> {
> struct packet_command cgc;
> char buffer[32];
> - int ret, mmc3_profile;
> + int mmc3_profile;
>
> init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ);
>
> @@ -881,7 +881,7 @@ static void cdrom_mmc3_profile(struct cdrom_device_info *cdi)
> cgc.cmd[8] = sizeof(buffer); /* Allocation Length */
> cgc.quiet = 1;
>
> - if ((ret = cdi->ops->generic_packet(cdi, &cgc)))
> + if ((cdi->ops->generic_packet(cdi, &cgc)))
We no longer need the inner-most set of parentheses now, as we are
checking the result of the expression:
cdi->ops->generic_packet(cdi, &cgc)
rather than the result of the assignment expression:
(ret = cdi->ops->generic_packet(cdi, &cgc))
Please resubmit with this change and I'd be happy to approve the patch.
Many thanks.
Regards,
Phil
next prev parent reply other threads:[~2021-10-18 23:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 9:08 [PATCH linux-next] cdrom: Remove redundant variable and its assignment luo penghao
2021-10-18 23:29 ` Phillip Potter [this message]
[not found] ` <202110191004079619787@zte.com.cn>
2021-10-19 22:58 ` Phillip Potter
-- strict thread matches above, loose matches on Subject: below --
2021-10-20 2:42 luo penghao
2021-10-20 21:40 ` Phillip Potter
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=YW4C4A5S+mjHzKN2@KernelVM \
--to=phil@philpotter.co.uk \
--cc=cgel.zte@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luo.penghao@zte.com.cn \
--cc=zealci@zte.com.cn \
/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.