public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jack Wang <xjtuwjp@gmail.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: lindar_liu@usish.com,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: pm8001: pm80xx_hwi.c:  Cleaning up uninitialized variables
Date: Thu, 26 Jun 2014 10:02:41 +0200	[thread overview]
Message-ID: <53ABD3A1.10400@gmail.com> (raw)
In-Reply-To: <1401628410-17824-1-git-send-email-rickard_strandqvist@spectrumdigital.se>

Looks good, thanks Rickard.
Acked-by: Jack Wang <xjtuwjp@gmail.com>
On 06/01/2014 03:13 PM, Rickard Strandqvist wrote:
> 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/pm8001/pm80xx_hwi.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
> index d70587f..add019b 100644
> --- a/drivers/scsi/pm8001/pm80xx_hwi.c
> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
> @@ -948,7 +948,7 @@ static int
>  pm80xx_get_encrypt_info(struct pm8001_hba_info *pm8001_ha)
>  {
>  	u32 scratch3_value;
> -	int ret;
> +	int ret = -1;
>  
>  	/* Read encryption status from SCRATCH PAD 3 */
>  	scratch3_value = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_3);
> @@ -982,7 +982,7 @@ pm80xx_get_encrypt_info(struct pm8001_hba_info *pm8001_ha)
>  		pm8001_ha->encrypt_info.status = 0xFFFFFFFF;
>  		pm8001_ha->encrypt_info.cipher_mode = 0;
>  		pm8001_ha->encrypt_info.sec_mode = 0;
> -		return 0;
> +		ret = 0;
>  	} else if ((scratch3_value & SCRATCH_PAD3_ENC_MASK) ==
>  				SCRATCH_PAD3_ENC_DIS_ERR) {
>  		pm8001_ha->encrypt_info.status =
> @@ -1004,7 +1004,6 @@ pm80xx_get_encrypt_info(struct pm8001_hba_info *pm8001_ha)
>  			scratch3_value, pm8001_ha->encrypt_info.cipher_mode,
>  			pm8001_ha->encrypt_info.sec_mode,
>  			pm8001_ha->encrypt_info.status));
> -		ret = -1;
>  	} else if ((scratch3_value & SCRATCH_PAD3_ENC_MASK) ==
>  				 SCRATCH_PAD3_ENC_ENA_ERR) {
>  
> @@ -1028,7 +1027,6 @@ pm80xx_get_encrypt_info(struct pm8001_hba_info *pm8001_ha)
>  			scratch3_value, pm8001_ha->encrypt_info.cipher_mode,
>  			pm8001_ha->encrypt_info.sec_mode,
>  			pm8001_ha->encrypt_info.status));
> -		ret = -1;
>  	}
>  	return ret;
>  }
> 

      reply	other threads:[~2014-06-26  8:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-01 13:13 [PATCH] scsi: pm8001: pm80xx_hwi.c: Cleaning up uninitialized variables Rickard Strandqvist
2014-06-26  8:02 ` Jack Wang [this message]

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=53ABD3A1.10400@gmail.com \
    --to=xjtuwjp@gmail.com \
    --cc=JBottomley@parallels.com \
    --cc=lindar_liu@usish.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=rickard_strandqvist@spectrumdigital.se \
    /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