drivers/net/can/kvaser_pciefd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Ammend error handling for the use of "dma_set_mask_and_coherent()"
inside "kvaser_pciefd_setup_dma()".
Link: https://scan5.scan.coverity.com/#/project-view/36179/10063?selectedIssue=1631256
Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
---
drivers/net/can/kvaser_pciefd.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c
index cf0d51805272..e5b67e92f602 100644
--- a/drivers/net/can/kvaser_pciefd.c
+++ b/drivers/net/can/kvaser_pciefd.c
@@ -1106,7 +1106,12 @@ static int kvaser_pciefd_setup_dma(struct kvaser_pciefd *pcie)
/* Disable the DMA */
iowrite32(0, KVASER_PCIEFD_SRB_ADDR(pcie) + KVASER_PCIEFD_SRB_CTRL_REG);
- dma_set_mask_and_coherent(&pcie->pci->dev, DMA_BIT_MASK(64));
+ int err = dma_set_mask_and_coherent(&pcie->pci->dev, DMA_BIT_MASK(64));
+
+ if (err) {
+ dev_err(&pcie->pci->dev, "Failed to set 64-bit DMA mask\n");
+ return err;
+ }
for (i = 0; i < KVASER_PCIEFD_DMA_COUNT; i++) {
pcie->dma_data[i] = dmam_alloc_coherent(&pcie->pci->dev,
--
2.43.0
Hello I Hsin Cheng, thanks for your contribution. On 05.05.2025 22:11:54, I Hsin Cheng wrote: > Ammend error handling for the use of "dma_set_mask_and_coherent()" > inside "kvaser_pciefd_setup_dma()". > > Link: https://scan5.scan.coverity.com/#/project-view/36179/10063?selectedIssue=1631256 This link is not public. > Signed-off-by: I Hsin Cheng <richard120310@gmail.com> If I understand the documentation correctly: https://www.kernel.org/doc/html/next/core-api/dma-api-howto.html | dma_set_mask_and_coherent() never return fail when DMA_BIT_MASK(64). Also see discussion: https://lore.kernel.org/all/f61b536397092bd46d701cba2a0fc41430964b73.camel@kvaser.com/ regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
© 2016 - 2026 Red Hat, Inc.