All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
To: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com>,
	Sreekanth Reddy <Sreekanth.Reddy@lsi.com>
Cc: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>,
	support@lsi.com,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	DL-MPTFusionLinux@lsi.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: mpt3sas: mpt3sas_transport.c:  Cleaning up uninitialized variables
Date: Sun,  1 Jun 2014 15:08:37 +0200	[thread overview]
Message-ID: <1401628118-17506-1-git-send-email-rickard_strandqvist@spectrumdigital.se> (raw)

There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/scsi/mpt3sas/mpt3sas_transport.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c
index 65170cb..f648dc4 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_transport.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c
@@ -305,8 +305,8 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc,
 	void *data_out = NULL;
 	dma_addr_t data_out_dma;
 	dma_addr_t data_in_dma;
-	size_t data_in_sz;
-	size_t data_out_sz;
+	size_t data_in_sz = sizeof(struct rep_manu_reply);
+	size_t data_out_sz = sizeof(struct rep_manu_request);
 	u16 wait_state_count;
 
 	if (ioc->shost_recovery || ioc->pci_error_recovery) {
@@ -357,8 +357,6 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc,
 	mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
 	ioc->transport_cmds.smid = smid;
 
-	data_out_sz = sizeof(struct rep_manu_request);
-	data_in_sz = sizeof(struct rep_manu_reply);
 	data_out = pci_alloc_consistent(ioc->pdev, data_out_sz + data_in_sz,
 	    &data_out_dma);
 
-- 
1.7.10.4


             reply	other threads:[~2014-06-01 13:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-01 13:08 Rickard Strandqvist [this message]
2014-06-25  9:41 ` [PATCH] scsi: mpt3sas: mpt3sas_transport.c: Cleaning up uninitialized variables Sreekanth Reddy
2014-06-25 11:33   ` Christoph Hellwig

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=1401628118-17506-1-git-send-email-rickard_strandqvist@spectrumdigital.se \
    --to=rickard_strandqvist@spectrumdigital.se \
    --cc=DL-MPTFusionLinux@lsi.com \
    --cc=JBottomley@parallels.com \
    --cc=Nagalakshmi.Nandigama@lsi.com \
    --cc=Sreekanth.Reddy@lsi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=support@lsi.com \
    /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.