mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers: scsi: megaraid: Add missing check for dma_set_mask
@ 2024-07-01  3:41 Haoxiang Li
  2024-07-01 12:12 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2024-07-01  3:41 UTC (permalink / raw)
  To: kashyap.desai, sumit.saxena, shivasharan.srikanteshwara,
	chandrakanth.patil, James.Bottomley, martin.petersen, usuraj35
  Cc: megaraidlinux.pdl, linux-scsi, linux-kernel, Haoxiang Li

pdev->dev cannot perform DMA properly if dma_set_mask() returns non-zero.
Add check for dma_set_mask() and return the error if it fails.

Fixes: ec090ef8cd1c ("scsi: megaraid: Remove pci-dma-compat wrapper API")
Signed-off-by: Haoxiang Li <make24@iscas.ac.cn>
---
 drivers/scsi/megaraid.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 38976f94453e..5ddcba488c89 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4406,10 +4406,12 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	/* Set the Mode of addressing to 64 bit if we can */
 	if ((adapter->flag & BOARD_64BIT) && (sizeof(dma_addr_t) == 8)) {
-		dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
+		if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))
+			goto out_free_mbox;
 		adapter->has_64bit_addr = 1;
 	} else  {
-		dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+		if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)))
+			goto out_free_mbox;
 		adapter->has_64bit_addr = 0;
 	}
 		
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers: scsi: megaraid: Add missing check for dma_set_mask
  2024-07-01  3:41 [PATCH] drivers: scsi: megaraid: Add missing check for dma_set_mask Haoxiang Li
@ 2024-07-01 12:12 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2024-07-01 12:12 UTC (permalink / raw)
  To: Haoxiang Li, megaraidlinux.pdl, linux-scsi, kernel-janitors,
	Chandrakanth patil, James Bottomley, Kashyap Desai,
	Martin K. Petersen, Shivasharan Srikanteshwara, Sumit Saxena,
	Suraj Upadhyay
  Cc: LKML

> pdev->dev cannot perform DMA properly if dma_set_mask() returns non-zero.

Can a wording approach (like the following) become a part of a better change description?

  Direct memory access can not be properly performed any more
  after a dma_set_mask() call failed.


> Add check for dma_set_mask()

How do you think about to avoid a repeated reference to a function name?


>                                  return the error if it fails.

How can this happen after you did not store the return value (in the local variable “error”)
for further usage (according to your proposed source code adjustment)?


…
> Signed-off-by: Haoxiang Li <make24@iscas.ac.cn>

I find it interesting that another personal name is presented here.
I noticed that some patches were published with the name “Ma Ke” previously.
How will requirements be resolved for the Developer's Certificate of Origin?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc6#n398


How do you think about to use a summary phrase like “Complete error handling
in megaraid_probe_one()”?

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-01 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-01  3:41 [PATCH] drivers: scsi: megaraid: Add missing check for dma_set_mask Haoxiang Li
2024-07-01 12:12 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®