]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: pm8001: Fix pm8001_tag_alloc() failures handling
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Sun, 20 Feb 2022 03:17:56 +0000 (12:17 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Feb 2022 02:31:19 +0000 (21:31 -0500)
commitc00546cf16888ebc8ae78e6988797a21c5c448dc
tree83814c9ea751d30a000e04978b84b10c555ad032
parentcf885ac07367ff74f8d4c739c5efa5e5f314021b
scsi: pm8001: Fix pm8001_tag_alloc() failures handling

In mpi_set_phy_profile_req() and in pm8001_set_phy_profile_single(), if
pm8001_tag_alloc() fails to allocate a new tag, a warning message is issued
but the uninitialized tag variable is still used to build a command. Avoid
this by returning early in case of tag allocation failure.

Also make sure to always return the error code returned by
pm8001_tag_alloc() when this function fails instead of an arbitrary value.

Link: https://lore.kernel.org/r/20220220031810.738362-18-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/pm8001/pm80xx_hwi.c