Re: [PATCH] target/pscsi: fix return value check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Wei,

On Fri, 2013-10-25 at 21:53 +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
> 
> In case of error, the function scsi_host_lookup() returns NULL
> pointer not ERR_PTR(). The IS_ERR() test in the return value check
> should be replaced with NULL test.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
> ---

Applied to target-pending/master with a CC' to stable, and including in
the next -rc7 PULL request.

Thank you!

--nab

>  drivers/target/target_core_pscsi.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
> index 551c96c..0f199f6 100644
> --- a/drivers/target/target_core_pscsi.c
> +++ b/drivers/target/target_core_pscsi.c
> @@ -134,10 +134,10 @@ static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag)
>  	 * pSCSI Host ID and enable for phba mode
>  	 */
>  	sh = scsi_host_lookup(phv->phv_host_id);
> -	if (IS_ERR(sh)) {
> +	if (!sh) {
>  		pr_err("pSCSI: Unable to locate SCSI Host for"
>  			" phv_host_id: %d\n", phv->phv_host_id);
> -		return PTR_ERR(sh);
> +		return -EINVAL;
>  	}
>  
>  	phv->phv_lld_host = sh;
> @@ -515,10 +515,10 @@ static int pscsi_configure_device(struct se_device *dev)
>  			sh = phv->phv_lld_host;
>  		} else {
>  			sh = scsi_host_lookup(pdv->pdv_host_id);
> -			if (IS_ERR(sh)) {
> +			if (!sh) {
>  				pr_err("pSCSI: Unable to locate"
>  					" pdv_host_id: %d\n", pdv->pdv_host_id);
> -				return PTR_ERR(sh);
> +				return -EINVAL;
>  			}
>  		}
>  	} else {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe target-devel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux