2021-12-03 03:03:26

by Jiasheng Jiang

[permalink] [raw]
Subject: [PATCH v2] net: broadcom: Catch the Exception

The return value of dma_set_coherent_mask() is not always 0.
To catch the exception in case that dma is not support the mask.

Fixes: 9d61d138ab30 ("net: broadcom: rename BCM4908 driver & update DT binding")
Signed-off-by: Jiasheng Jiang <[email protected]>
---
Changelog

v1 -> v2

* Change 1. Correct the Fixes tags.
* Change 2. CC Florian.
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 02a569500234..376f81796a29 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -708,7 +708,9 @@ static int bcm4908_enet_probe(struct platform_device *pdev)

enet->irq_tx = platform_get_irq_byname(pdev, "tx");

- dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
+ err = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
+ if (err)
+ return err;

err = bcm4908_enet_dma_alloc(enet);
if (err)
--
2.25.1



2021-12-03 03:23:19

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v2] net: broadcom: Catch the Exception



On 12/2/2021 7:02 PM, Jiasheng Jiang wrote:
> The return value of dma_set_coherent_mask() is not always 0.
> To catch the exception in case that dma is not support the mask.
>
> Fixes: 9d61d138ab30 ("net: broadcom: rename BCM4908 driver & update DT binding")
> Signed-off-by: Jiasheng Jiang <[email protected]>

Can you come up with a better subject, maybe:

net: bcm4908: Handle dma_set_coherent_mask error codes

or something like that?

> ---
> Changelog
>
> v1 -> v2
>
> * Change 1. Correct the Fixes tags.
> * Change 2. CC Florian.
> ---
> drivers/net/ethernet/broadcom/bcm4908_enet.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
> index 02a569500234..376f81796a29 100644
> --- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
> +++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
> @@ -708,7 +708,9 @@ static int bcm4908_enet_probe(struct platform_device *pdev)
>
> enet->irq_tx = platform_get_irq_byname(pdev, "tx");
>
> - dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
> + err = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
> + if (err)
> + return err;
>
> err = bcm4908_enet_dma_alloc(enet);
> if (err)
>

--
Florian