diff mbox series

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

Message ID 1646060055-11361-1-git-send-email-zheyuma97@gmail.com (mailing list archive)
State Accepted
Headers show
Series scsi: wd719x: Return proper error code when dma_set_mask() fails | expand

Commit Message

Zheyu Ma Feb. 28, 2022, 2:54 p.m. UTC
During the process of driver probing, the probe function should return < 0
for failure, otherwise, the kernel will treat value >= 0 as success.

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
 drivers/scsi/wd719x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Johannes Thumshirn Feb. 28, 2022, 3:43 p.m. UTC | #1
On 28/02/2022 15:54, Zheyu Ma wrote:
> 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,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Martin K. Petersen March 2, 2022, 4:22 a.m. UTC | #2
Zheyu,

> 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!
Martin K. Petersen March 9, 2022, 4:14 a.m. UTC | #3
On Mon, 28 Feb 2022 14:54:15 +0000, Zheyu Ma wrote:

> 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
diff mbox series

Patch

diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index 1a7947554581..2b24ef387d57 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -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;
 	}