Skip to contentSkip to conversation

scsi: wd719x: Return proper error code when dma_set_mask() fails

PATCH Applied Zheyu Ma 3 participants 4 messages Feb 28, 2022 – Mar 9, 2022 SCSI

lore
Share & tools
lore

Zheyu Ma

author
#0 lore raw

PATCH 1/1 scsi: wd719x: Return proper error code when dma_set_mask() fails

During the process of driver probing, the probe function should return < 0 for failure, otherwise, the kernel will treat value >= 0 as success.

---
 drivers/scsi/wd719x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/wd719x.c +2 -1
index 1a7947554581..2b24ef387d57 100644
@@ -904,7 +904,8 @@ static int wd719x_pci_probe(struct pci_dev *pdev, const struct pci_device_id *d)
 	if (err)
 		goto fail;
 
-	if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
+	err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+	if (err) {
 		dev_warn(&pdev->dev, "Unable to set 32-bit DMA mask\n");
 		goto disable_device;
 	}
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Zheyu Ma

During the process of driver probing, the probe function should return < 0 for failure, otherwise, the kernel will treat value >= 0 as success.

"So set 'err' to the error value returned by dma_set_mask() in case of failure"

Otherwise looks good to me,

#2 lore raw
In reply to Zheyu Ma

Zheyu,

Quoted 3 lines

During the process of driver probing, the probe function should return < 0 for failure, otherwise, the kernel will treat value >= 0 as success.

Applied to 5.18/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw
In reply to Zheyu Ma
Quoted 4 lines · Zheyu Ma

During the process of driver probing, the probe function should return < 0 for failure, otherwise, the kernel will treat value >= 0 as success.

Applied to 5.18/scsi-queue, thanks!

[1/1] scsi: wd719x: Return proper error code when dma_set_mask() fails

      https://git.kernel.org/mkp/scsi/c/98cdcd6c6b4a
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering