linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma: xilinx: check the return value of dma_set_mask() in zynqmp_dma_probe()
@ 2022-03-03  2:43 Jia-Ju Bai
  2022-03-04  8:20 ` Michael Tretter
  0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2022-03-03  2:43 UTC (permalink / raw)
  To: vkoul, michal.simek, m.tretter, yukuai3, lars, libaokun1
  Cc: dmaengine, linux-arm-kernel, linux-kernel, Jia-Ju Bai

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;
 	dma_cap_set(DMA_MEMCPY, zdev->common.cap_mask);
 
 	p = &zdev->common;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dma: xilinx: check the return value of dma_set_mask() in zynqmp_dma_probe()
  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
  2022-03-05  8:38   ` Jia-Ju Bai
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tretter @ 2022-03-04  8:20 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: vkoul, michal.simek, yukuai3, lars, libaokun1, dmaengine,
	linux-arm-kernel, linux-kernel, kernel

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
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dma: xilinx: check the return value of dma_set_mask() in zynqmp_dma_probe()
  2022-03-04  8:20 ` Michael Tretter
@ 2022-03-05  8:38   ` Jia-Ju Bai
  0 siblings, 0 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2022-03-05  8:38 UTC (permalink / raw)
  To: Michael Tretter
  Cc: vkoul, michal.simek, yukuai3, lars, libaokun1, dmaengine,
	linux-arm-kernel, linux-kernel, kernel



On 2022/3/4 16:20, Michael Tretter wrote:
> 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.

Hi Michael,

Thanks for the advice.
I will send a V2 patch.


Best wishes,
Jia-Ju Bai

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-05  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-03-05  8:38   ` Jia-Ju Bai

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).