linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: vkoul@kernel.org, michal.simek@xilinx.com, yukuai3@huawei.com,
	lars@metafoo.de, libaokun1@huawei.com, dmaengine@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] dma: xilinx: check the return value of dma_set_mask() in zynqmp_dma_probe()
Date: Fri, 4 Mar 2022 09:20:24 +0100	[thread overview]
Message-ID: <20220304082024.GO8137@pengutronix.de> (raw)
In-Reply-To: <20220303024334.813-1-baijiaju1990@gmail.com>

On Wed, 02 Mar 2022 18:43:34 -0800, Jia-Ju Bai wrote:
> The function dma_set_mask() in zynqmp_dma_probe() can fail, so its
> return value should be checked.
> 
> Fixes: b0cc417c1637 ("dmaengine: Add Xilinx zynqmp dma engine driver support")
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/dma/xilinx/zynqmp_dma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index 7aa63b652027..963fb1de93af 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -1050,7 +1050,8 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
>  	zdev->dev = &pdev->dev;
>  	INIT_LIST_HEAD(&zdev->common.channels);
>  
> -	dma_set_mask(&pdev->dev, DMA_BIT_MASK(44));
> +	if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(44)))
> +		return -EIO;

Thanks.

You may print an error message with dev_err_probe and forward the return value
of dma_set_mask.

Michael

>  	dma_cap_set(DMA_MEMCPY, zdev->common.cap_mask);
>  
>  	p = &zdev->common;
> -- 
> 2.17.1
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-03-04  8:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03  2:43 [PATCH] dma: xilinx: check the return value of dma_set_mask() in zynqmp_dma_probe() Jia-Ju Bai
2022-03-04  8:20 ` Michael Tretter [this message]
2022-03-05  8:38   ` Jia-Ju Bai

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=20220304082024.GO8137@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=baijiaju1990@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lars@metafoo.de \
    --cc=libaokun1@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=vkoul@kernel.org \
    --cc=yukuai3@huawei.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).