Patchwork dmaengine: stm32-mdma: Add a check on read_u32_array

login
register
mail settings
Submitter Aditya Pakki
Date Dec. 28, 2018, 7:26 p.m.
Message ID <20181228192641.9713-1-pakki001@umn.edu>
Download mbox | patch
Permalink /patch/690689/
State New
Headers show

Comments

Aditya Pakki - Dec. 28, 2018, 7:26 p.m.
In stm32_mdma_probe, after reading the property "st,ahb-addr-masks", the
second call is not checked for failure. This time of check to time of use
case of "count" error is sent upstream.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/dma/stm32-mdma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Pierre Yves MORDRET - Jan. 4, 2019, 8:05 a.m.
Hello

Acked-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>

Regards

On 12/28/18 8:26 PM, Aditya Pakki wrote:
> In stm32_mdma_probe, after reading the property "st,ahb-addr-masks", the
> second call is not checked for failure. This time of check to time of use
> case of "count" error is sent upstream.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>  drivers/dma/stm32-mdma.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
> index 390e4cae0e1a..485dea177704 100644
> --- a/drivers/dma/stm32-mdma.c
> +++ b/drivers/dma/stm32-mdma.c
> @@ -1579,9 +1579,11 @@ static int stm32_mdma_probe(struct platform_device *pdev)
>  
>  	dmadev->nr_channels = nr_channels;
>  	dmadev->nr_requests = nr_requests;
> -	device_property_read_u32_array(&pdev->dev, "st,ahb-addr-masks",
> +	ret = device_property_read_u32_array(&pdev->dev, "st,ahb-addr-masks",
>  				       dmadev->ahb_addr_masks,
>  				       count);
> +	if (ret)
> +		return ret;
>  	dmadev->nr_ahb_addr_masks = count;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
Vinod Koul - Jan. 4, 2019, 2:33 p.m.
On 28-12-18, 13:26, Aditya Pakki wrote:
> In stm32_mdma_probe, after reading the property "st,ahb-addr-masks", the
> second call is not checked for failure. This time of check to time of use
> case of "count" error is sent upstream.

Applied, thanks

Patch

diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
index 390e4cae0e1a..485dea177704 100644
--- a/drivers/dma/stm32-mdma.c
+++ b/drivers/dma/stm32-mdma.c
@@ -1579,9 +1579,11 @@  static int stm32_mdma_probe(struct platform_device *pdev)
 
 	dmadev->nr_channels = nr_channels;
 	dmadev->nr_requests = nr_requests;
-	device_property_read_u32_array(&pdev->dev, "st,ahb-addr-masks",
+	ret = device_property_read_u32_array(&pdev->dev, "st,ahb-addr-masks",
 				       dmadev->ahb_addr_masks,
 				       count);
+	if (ret)
+		return ret;
 	dmadev->nr_ahb_addr_masks = count;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);