* [PATCH] scsi: sym53c8xx_2: remove redundant assignment to retv
@ 2019-08-09 17:59 Colin King
2019-08-09 18:17 ` Matthew Wilcox
2019-08-13 1:58 ` Martin K. Petersen
0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2019-08-09 17:59 UTC (permalink / raw)
To: Matthew Wilcox, James E . J . Bottomley, Martin K . Petersen, linux-scsi
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Variable retv is initialized to a value that is never read and it
is re-assigned later. The initialization is redundant and can be
removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/scsi/sym53c8xx_2/sym_nvram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/sym53c8xx_2/sym_nvram.c b/drivers/scsi/sym53c8xx_2/sym_nvram.c
index dd3f07b31612..9dc17f1288f9 100644
--- a/drivers/scsi/sym53c8xx_2/sym_nvram.c
+++ b/drivers/scsi/sym53c8xx_2/sym_nvram.c
@@ -648,7 +648,7 @@ static int sym_read_T93C46_nvram(struct sym_device *np, Tekram_nvram *nvram)
{
u_char gpcntl, gpreg;
u_char old_gpcntl, old_gpreg;
- int retv = 1;
+ int retv;
/* save current state of GPCNTL and GPREG */
old_gpreg = INB(np, nc_gpreg);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: sym53c8xx_2: remove redundant assignment to retv
2019-08-09 17:59 [PATCH] scsi: sym53c8xx_2: remove redundant assignment to retv Colin King
@ 2019-08-09 18:17 ` Matthew Wilcox
2019-08-13 13:14 ` Dan Carpenter
2019-08-13 1:58 ` Martin K. Petersen
1 sibling, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2019-08-09 18:17 UTC (permalink / raw)
To: Colin King
Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
kernel-janitors, linux-kernel
On Fri, Aug 09, 2019 at 06:59:32PM +0100, Colin King wrote:
> Variable retv is initialized to a value that is never read and it
> is re-assigned later. The initialization is redundant and can be
> removed.
Acked-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Seems like a bit of a pointless class of warnings, given that gcc now
initialises all locals. But I'm happy for James or Martin to pick it up.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: sym53c8xx_2: remove redundant assignment to retv
2019-08-09 17:59 [PATCH] scsi: sym53c8xx_2: remove redundant assignment to retv Colin King
2019-08-09 18:17 ` Matthew Wilcox
@ 2019-08-13 1:58 ` Martin K. Petersen
1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2019-08-13 1:58 UTC (permalink / raw)
To: Colin King
Cc: Matthew Wilcox, James E . J . Bottomley, Martin K . Petersen,
linux-scsi, kernel-janitors, linux-kernel
Colin,
> Variable retv is initialized to a value that is never read and it is
> re-assigned later. The initialization is redundant and can be removed.
Applied to 5.4/scsi-queue, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: sym53c8xx_2: remove redundant assignment to retv
2019-08-09 18:17 ` Matthew Wilcox
@ 2019-08-13 13:14 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-08-13 13:14 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Colin King, James E . J . Bottomley, Martin K . Petersen,
linux-scsi, kernel-janitors, linux-kernel
On Fri, Aug 09, 2019 at 11:17:33AM -0700, Matthew Wilcox wrote:
> On Fri, Aug 09, 2019 at 06:59:32PM +0100, Colin King wrote:
> > Variable retv is initialized to a value that is never read and it
> > is re-assigned later. The initialization is redundant and can be
> > removed.
>
> Acked-by: Matthew Wilcox (Oracle) <willy@infradead.org>
>
> Seems like a bit of a pointless class of warnings, given that gcc now
> initialises all locals. But I'm happy for James or Martin to pick it up.
GCC doesn't initialize all locals. Just some depending on the
optimization level. It's related to a bug that's several years old.
This warning does find some bugs. The common one is where people forget
to check the return.
ret = something();
// blank line here indicates that ret is never checked again.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-13 13:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09 17:59 [PATCH] scsi: sym53c8xx_2: remove redundant assignment to retv Colin King
2019-08-09 18:17 ` Matthew Wilcox
2019-08-13 13:14 ` Dan Carpenter
2019-08-13 1:58 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).