[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YG3boJNqAoNCBeIB@piout.net>
Date: Wed, 7 Apr 2021 18:19:44 +0200
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
Cc: Nicolas Ferre <nicolas.ferre@...rochip.com>,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] memory: atmel-sdramc: check of_device_get_match_data()
return value
Hi,
On 07/04/2021 17:44:47+0200, Krzysztof Kozlowski wrote:
> If the driver is probed, the of_device_get_match_data() should not
> return NULL, however for sanity check its return value.
>
As you say, there is no way this will ever be the case, I don't see the
point of checking the return value, this adds 12 bytes for nothing...
Maybe coverity should be fixed as there are many drivers making the same
(true) assumption and I don't think this is worth the churn.
> Addresses-Coverity: Dereference null return value
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
> ---
> drivers/memory/atmel-sdramc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/memory/atmel-sdramc.c b/drivers/memory/atmel-sdramc.c
> index 9c49d00c2a96..e09b2617f63d 100644
> --- a/drivers/memory/atmel-sdramc.c
> +++ b/drivers/memory/atmel-sdramc.c
> @@ -45,6 +45,8 @@ static int atmel_ramc_probe(struct platform_device *pdev)
> struct clk *clk;
>
> caps = of_device_get_match_data(&pdev->dev);
> + if (!caps)
> + return -EINVAL;
>
> if (caps->has_ddrck) {
> clk = devm_clk_get(&pdev->dev, "ddrck");
> --
> 2.25.1
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists