[PATCH 2/2] HID: amd_sfh: Continue if fallback DMA mask is accepted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently, if a call to `set_dma_mask(DMA_BIT_MASK(64))` fails, the
driver calls `set_dma_mask(DMA_BIT_MASK(32))` and immediately returns
regardless of the result. If that second call were to succeed, the SFH
would not get initialized (defeating the whole purpose of falling back
to a 32-bit address space) but the driver would remain registered
(since `probe` returned 0).

Signed-off-by: Dylan MacKenzie <ecstaticmorse@xxxxxxxxx>
---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index c2de650cd8e..a4f363d082c 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -155,11 +155,15 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 
 	privdata->mmio = pcim_iomap_table(pdev)[2];
 	pci_set_master(pdev);
+
 	rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
-	if (rc) {
+	if (rc)
 		rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+	if (rc) {
+		pci_err(pdev, "Failed to set DMA mask");
 		return rc;
 	}
+
 	rc = devm_add_action_or_reset(&pdev->dev, amd_mp2_pci_remove, privdata);
 	if (rc)
 		return rc;
-- 
2.31.1




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux