* [PATCH] clk: mmp: Fix NULL vs IS_ERR() check
@ 2025-03-07 6:47 Charles Han
2025-03-07 11:18 ` Krzysztof Kozlowski
2025-03-07 19:05 ` Stephen Boyd
0 siblings, 2 replies; 3+ messages in thread
From: Charles Han @ 2025-03-07 6:47 UTC (permalink / raw)
To: mturquette, sboyd, duje.mihanovic; +Cc: linux-clk, linux-kernel, Charles Han
The devm_kzalloc() function returns NULL on error, not error pointers.
Fix the check.
Fixes: 03437e857b0a ("clk: mmp: Add Marvell PXA1908 APMU driver")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
---
drivers/clk/mmp/clk-pxa1908-apmu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/mmp/clk-pxa1908-apmu.c b/drivers/clk/mmp/clk-pxa1908-apmu.c
index 8cfb1258202f..d3a070687fc5 100644
--- a/drivers/clk/mmp/clk-pxa1908-apmu.c
+++ b/drivers/clk/mmp/clk-pxa1908-apmu.c
@@ -87,8 +87,8 @@ static int pxa1908_apmu_probe(struct platform_device *pdev)
struct pxa1908_clk_unit *pxa_unit;
pxa_unit = devm_kzalloc(&pdev->dev, sizeof(*pxa_unit), GFP_KERNEL);
- if (IS_ERR(pxa_unit))
- return PTR_ERR(pxa_unit);
+ if (!pxa_unit)
+ return -ENOMEM;
pxa_unit->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pxa_unit->base))
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] clk: mmp: Fix NULL vs IS_ERR() check
2025-03-07 6:47 [PATCH] clk: mmp: Fix NULL vs IS_ERR() check Charles Han
@ 2025-03-07 11:18 ` Krzysztof Kozlowski
2025-03-07 19:05 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-07 11:18 UTC (permalink / raw)
To: Charles Han, mturquette, sboyd, duje.mihanovic; +Cc: linux-clk, linux-kernel
On 07/03/2025 07:47, Charles Han wrote:
> The devm_kzalloc() function returns NULL on error, not error pointers.
> Fix the check.
>
> Fixes: 03437e857b0a ("clk: mmp: Add Marvell PXA1908 APMU driver")
> Signed-off-by: Charles Han <hanchunchao@inspur.com>
> ---
> drivers/clk/mmp/clk-pxa1908-apmu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
This one might be actually correct (in other cases you were blindly
copying some code like returning -ENOMEM while code expects NULL).
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] clk: mmp: Fix NULL vs IS_ERR() check
2025-03-07 6:47 [PATCH] clk: mmp: Fix NULL vs IS_ERR() check Charles Han
2025-03-07 11:18 ` Krzysztof Kozlowski
@ 2025-03-07 19:05 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2025-03-07 19:05 UTC (permalink / raw)
To: Charles Han, duje.mihanovic, mturquette
Cc: linux-clk, linux-kernel, Charles Han
Quoting Charles Han (2025-03-06 22:47:07)
> The devm_kzalloc() function returns NULL on error, not error pointers.
> Fix the check.
>
> Fixes: 03437e857b0a ("clk: mmp: Add Marvell PXA1908 APMU driver")
> Signed-off-by: Charles Han <hanchunchao@inspur.com>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-07 19:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 6:47 [PATCH] clk: mmp: Fix NULL vs IS_ERR() check Charles Han
2025-03-07 11:18 ` Krzysztof Kozlowski
2025-03-07 19:05 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox