From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: Sergio Perez Gonzalez <sperezglz@gmail.com>, nicolas.ferre@microchip.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, shuah@kernel.org
Subject: Re: [PATCH] net: macb: Check return value of dma_set_mask_and_coherent()
Date: Mon, 26 May 2025 11:04:20 +0300 [thread overview]
Message-ID: <8e1250b2-b6da-4294-b02b-98c9d231a181@tuxon.dev> (raw)
In-Reply-To: <20250526032034.84900-1-sperezglz@gmail.com>
On 26.05.2025 06:20, Sergio Perez Gonzalez wrote:
> Issue flagged by coverity. Add a safety check for the return value
> of dma_set_mask_and_coherent, go to a safe exit if it returns error.
>
> Link: https://scan7.scan.coverity.com/#/project-view/53936/11354?selectedIssue=1643754
>
> Signed-off-by: Sergio Perez Gonzalez <sperezglz@gmail.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> ---
> drivers/net/ethernet/cadence/macb_main.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index e1e8bd2ec155..d1f1ae5ea161 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -5283,7 +5283,11 @@ static int macb_probe(struct platform_device *pdev)
>
> #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
> if (GEM_BFEXT(DAW64, gem_readl(bp, DCFG6))) {
> - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44));
> + err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44));
> + if (err) {
> + dev_err(&pdev->dev, "failed to set DMA mask\n");
> + goto err_out_free_netdev;
> + }
> bp->hw_dma_cap |= HW_DMA_CAP_64B;
> }
> #endif
next prev parent reply other threads:[~2025-05-26 8:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-26 3:20 [PATCH] net: macb: Check return value of dma_set_mask_and_coherent() Sergio Perez Gonzalez
2025-05-26 8:04 ` Claudiu Beznea [this message]
2025-05-28 0:50 ` patchwork-bot+netdevbpf
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=8e1250b2-b6da-4294-b02b-98c9d231a181@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=sperezglz@gmail.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).