linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: ibmvscsi: Don't use rc uninitialized in ibmvscsi_do_work
@ 2019-05-31 18:53 Nathan Chancellor
  2019-06-02 10:15 ` Michael Ellerman
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Nathan Chancellor @ 2019-05-31 18:53 UTC (permalink / raw)
  To: Tyrel Datwyler, James E.J. Bottomley, Martin K. Petersen
  Cc: clang-built-linux, Nathan Chancellor, linuxppc-dev, linux-kernel,
	linux-scsi

clang warns:

drivers/scsi/ibmvscsi/ibmvscsi.c:2126:7: warning: variable 'rc' is used
uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
        case IBMVSCSI_HOST_ACTION_NONE:
             ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/ibmvscsi/ibmvscsi.c:2151:6: note: uninitialized use occurs
here
        if (rc) {
            ^~

Initialize rc to zero so that the atomic_set and dev_err statement don't
trigger for the cases that just break.

Fixes: 035a3c4046b5 ("scsi: ibmvscsi: redo driver work thread to use enum action states")
Link: https://github.com/ClangBuiltLinux/linux/issues/502
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 727c31dc11a0..6714d8043e62 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -2118,7 +2118,7 @@ static unsigned long ibmvscsi_get_desired_dma(struct vio_dev *vdev)
 static void ibmvscsi_do_work(struct ibmvscsi_host_data *hostdata)
 {
 	unsigned long flags;
-	int rc;
+	int rc = 0;
 	char *action = "reset";
 
 	spin_lock_irqsave(hostdata->host->host_lock, flags);
-- 
2.22.0.rc2


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

end of thread, other threads:[~2019-06-05 11:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-31 18:53 [PATCH] scsi: ibmvscsi: Don't use rc uninitialized in ibmvscsi_do_work Nathan Chancellor
2019-06-02 10:15 ` Michael Ellerman
2019-06-03  3:23   ` Nathan Chancellor
2019-06-03 23:30   ` Tyrel Datwyler
2019-06-03  8:45 ` Christophe Leroy
2019-06-03 22:19 ` [PATCH v2] " Nathan Chancellor
2019-06-03 23:25   ` Tyrel Datwyler
2019-06-03 23:34     ` Tyrel Datwyler
2019-06-03 23:35       ` Tyrel Datwyler
2019-06-03 23:44   ` [PATCH v3] " Nathan Chancellor
2019-06-03 23:58     ` Tyrel Datwyler
2019-06-05  2:39     ` Martin K. Petersen
2019-06-05 11:08       ` Michael Ellerman

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