Variable is not used in functions, and its assignment is redundant too.
So it should be deleted. Also the inner-most set of parentheses is no
longer needed.
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 <[email protected]>
Signed-off-by: luo penghao <[email protected]>
---
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 feb827e..40970b8 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -864,7 +864,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);
@@ -874,7 +874,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))
mmc3_profile = 0xffff;
else
mmc3_profile = (buffer[6] << 8) | buffer[7];
--
2.15.2
On Wed, Oct 20, 2021 at 02:42:29AM +0000, luo penghao wrote:
> Variable is not used in functions, and its assignment is redundant too.
> So it should be deleted. Also the inner-most set of parentheses is no
> longer needed.
>
> 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 <[email protected]>
> Signed-off-by: luo penghao <[email protected]>
> ---
> 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 feb827e..40970b8 100644
> --- a/drivers/cdrom/cdrom.c
> +++ b/drivers/cdrom/cdrom.c
> @@ -864,7 +864,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);
>
> @@ -874,7 +874,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))
> mmc3_profile = 0xffff;
> else
> mmc3_profile = (buffer[6] << 8) | buffer[7];
> --
> 2.15.2
>
>
Looks good. I will send through to Jens Axboe in the morning (UK time),
as we are at rc6 now so merge window will be open shortly I'd imagine.
Many thanks for your contribution.
Regards,
Phil