From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>, Nicolas Ferre <nicolas.ferre@microchip.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Ludovic Desroches <ludovic.desroches@microchip.com>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] memory: atmel-sdramc: check of_device_get_match_data() return value Date: Wed, 7 Apr 2021 17:44:47 +0200 [thread overview] Message-ID: <20210407154447.70540-1-krzysztof.kozlowski@canonical.com> (raw) If the driver is probed, the of_device_get_match_data() should not return NULL, however for sanity check its return value. Addresses-Coverity: Dereference null return value Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.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
WARNING: multiple messages have this Message-ID (diff)
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>, Nicolas Ferre <nicolas.ferre@microchip.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Ludovic Desroches <ludovic.desroches@microchip.com>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] memory: atmel-sdramc: check of_device_get_match_data() return value Date: Wed, 7 Apr 2021 17:44:47 +0200 [thread overview] Message-ID: <20210407154447.70540-1-krzysztof.kozlowski@canonical.com> (raw) If the driver is probed, the of_device_get_match_data() should not return NULL, however for sanity check its return value. Addresses-Coverity: Dereference null return value Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2021-04-07 15:44 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-07 15:44 Krzysztof Kozlowski [this message] 2021-04-07 15:44 ` [PATCH] memory: atmel-sdramc: check of_device_get_match_data() return value Krzysztof Kozlowski 2021-04-07 16:19 ` Alexandre Belloni 2021-04-07 16:19 ` Alexandre Belloni 2021-04-07 16:55 ` Krzysztof Kozlowski 2021-04-07 16:55 ` Krzysztof Kozlowski
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=20210407154447.70540-1-krzysztof.kozlowski@canonical.com \ --to=krzysztof.kozlowski@canonical.com \ --cc=alexandre.belloni@bootlin.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=ludovic.desroches@microchip.com \ --cc=nicolas.ferre@microchip.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.