netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Denis Kirjanov <kda@linux-powerpc.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] net: altera: Handle dma_set_coherent_mask error codes
Date: Fri, 15 Jul 2022 16:44:17 -0700	[thread overview]
Message-ID: <20220715164417.577cbae3@kernel.org> (raw)
In-Reply-To: <20220714132342.13051-1-kda@linux-powerpc.org>

On Thu, 14 Jul 2022 16:23:42 +0300 Denis Kirjanov wrote:
> handle the error in the case that DMA mask is not supportyed
> 
> Fixes: bbd2190ce96d ("Altera TSE: Add main and header file for Altera Ethernet Driver")
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
> ---
>  drivers/net/ethernet/altera/altera_tse_main.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
> index 8c5828582c21..7773d978321a 100644
> --- a/drivers/net/ethernet/altera/altera_tse_main.c
> +++ b/drivers/net/ethernet/altera/altera_tse_main.c
> @@ -1439,10 +1439,14 @@ static int altera_tse_probe(struct platform_device *pdev)
>  	}
>  
>  	if (!dma_set_mask(priv->device, DMA_BIT_MASK(priv->dmaops->dmamask))) {
> -		dma_set_coherent_mask(priv->device,
> +		ret = dma_set_coherent_mask(priv->device,
>  				      DMA_BIT_MASK(priv->dmaops->dmamask));
> +		if (ret)
> +			goto err_free_netdev;
>  	} else if (!dma_set_mask(priv->device, DMA_BIT_MASK(32))) {
> -		dma_set_coherent_mask(priv->device, DMA_BIT_MASK(32));
> +		ret = dma_set_coherent_mask(priv->device, DMA_BIT_MASK(32));
> +		if (ret)
> +			goto err_free_netdev;
>  	} else {
>  		ret = -EIO;
>  		goto err_free_netdev;

Practically speaking this can't fail, see Christophe's patches like 
b6f2f0352c0302

If you want to be on the safe side just replace the dma_set_mask()
with dma_set_mask_and_coherent() and let the else branch handle the
failure.

Please CC maintainers when reposting.

      reply	other threads:[~2022-07-15 23:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 13:23 [PATCH] net: altera: Handle dma_set_coherent_mask error codes Denis Kirjanov
2022-07-15 23:44 ` Jakub Kicinski [this message]

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=20220715164417.577cbae3@kernel.org \
    --to=kuba@kernel.org \
    --cc=kda@linux-powerpc.org \
    --cc=netdev@vger.kernel.org \
    /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).