From: Dylan MacKenzie <ecstaticmorse@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Nehal Shah <nehal-bakulchandra.shah@amd.com>,
Sandeep Singh <sandeep.singh@amd.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] HID: amd_sfh: Continue if fallback DMA mask is accepted
Date: Mon, 21 Jun 2021 17:15:02 -0700 [thread overview]
Message-ID: <20210622001503.47541-3-ecstaticmorse@gmail.com> (raw)
In-Reply-To: <20210622001503.47541-1-ecstaticmorse@gmail.com>
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@gmail.com>
---
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
next prev parent reply other threads:[~2021-06-22 0:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-22 0:15 [PATCH 0/2] HID: amd_sfh: Minor DMA mapping bugfixes Dylan MacKenzie
2021-06-22 0:15 ` [PATCH 1/2] HID: amd_sfh: Set correct DMA mask Dylan MacKenzie
2021-06-22 0:15 ` Dylan MacKenzie [this message]
2021-07-28 9:28 ` [PATCH 0/2] HID: amd_sfh: Minor DMA mapping bugfixes Jiri Kosina
2021-07-28 9:33 ` Jiri Kosina
2021-07-28 19:22 ` Basavaraj Natikar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210622001503.47541-3-ecstaticmorse@gmail.com \
--to=ecstaticmorse@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nehal-bakulchandra.shah@amd.com \
--cc=sandeep.singh@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).