scsi: 3w-xxxx: Add error handling for initialization failure in tw_probe()
[ Upstream commit2e2fe5ac69] Smatch complains that: tw_probe() warn: missing error code 'retval' This patch adds error checking to tw_probe() to handle initialization failure. If tw_reset_sequence() function returns a non-zero value, the function will return -EINVAL to indicate initialization failure. Fixes:1da177e4c3("Linux-2.6.12-rc2") Signed-off-by: Yuchen Yang <u202114568@hust.edu.cn> Link: https://lore.kernel.org/r/20230505141259.7730-1-u202114568@hust.edu.cn Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7badf4d6f4
commit
b9895a4c95
@@ -2308,8 +2308,10 @@ static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
|
|||||||
TW_DISABLE_INTERRUPTS(tw_dev);
|
TW_DISABLE_INTERRUPTS(tw_dev);
|
||||||
|
|
||||||
/* Initialize the card */
|
/* Initialize the card */
|
||||||
if (tw_reset_sequence(tw_dev))
|
if (tw_reset_sequence(tw_dev)) {
|
||||||
|
retval = -EINVAL;
|
||||||
goto out_release_mem_region;
|
goto out_release_mem_region;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set host specific parameters */
|
/* Set host specific parameters */
|
||||||
host->max_id = TW_MAX_UNITS;
|
host->max_id = TW_MAX_UNITS;
|
||||||
|
|||||||
Reference in New Issue
Block a user