linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Matthew Wilcox <matthew@wil.cx>, linux-scsi@vger.kernel.org
Subject: [PATCH] scsi/sym53c8xx: Fix a warning in sym_eh_handler
Date: Wed, 24 Oct 2007 11:59:20 +0200	[thread overview]
Message-ID: <20071024115920.6728832c@hyperion.delvare> (raw)

In 2.6.24-rc1 I see the following warning:
drivers/scsi/sym53c8xx_2/sym_glue.c: In function "sym_eh_handler":
drivers/scsi/sym53c8xx_2/sym_glue.c:612: warning: "io_reset" may be used uninitialized in this function

Although gcc is wrong and the code is actually correct, it can easily
be made more obvious to keep the compiler quiet.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

--- linux-2.6.24-rc1.orig/drivers/scsi/sym53c8xx_2/sym_glue.c	2007-10-24 09:59:46.000000000 +0200
+++ linux-2.6.24-rc1/drivers/scsi/sym53c8xx_2/sym_glue.c	2007-10-24 11:53:14.000000000 +0200
@@ -609,8 +609,8 @@ static int sym_eh_handler(int op, char *
 	 */
 #define WAIT_FOR_PCI_RECOVERY	35
 	if (pci_channel_offline(pdev)) {
-		struct completion *io_reset;
-		int finished_reset = 0;
+		struct completion *io_reset = NULL;
+		int finished_reset;
 		init_completion(&eh_done);
 		spin_lock_irq(shost->host_lock);
 		/* Make sure we didn't race */
@@ -618,15 +618,14 @@ static int sym_eh_handler(int op, char *
 			if (!sym_data->io_reset)
 				sym_data->io_reset = &eh_done;
 			io_reset = sym_data->io_reset;
-		} else {
-			finished_reset = 1;
 		}
 		spin_unlock_irq(shost->host_lock);
-		if (!finished_reset)
+		if (io_reset) {
 			finished_reset = wait_for_completion_timeout(io_reset,
 						WAIT_FOR_PCI_RECOVERY*HZ);
-		if (!finished_reset)
-			return SCSI_FAILED;
+			if (!finished_reset)
+				return SCSI_FAILED;
+		}
 	}
 
 	spin_lock_irq(shost->host_lock);


-- 
Jean Delvare

             reply	other threads:[~2007-10-24 10:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-24  9:59 Jean Delvare [this message]
2007-10-24 11:25 ` [PATCH] scsi/sym53c8xx: Fix a warning in sym_eh_handler Matthew Wilcox
2007-10-24 12:46   ` Jean Delvare
2007-10-25  9:37 ` Boaz Harrosh
2007-10-25 11:19   ` Matthew Wilcox

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=20071024115920.6728832c@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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 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).