clk: mmp: Fix NULL vs IS_ERR() check
Subsystems (2)
PATCH 1/1 clk: mmp: Fix NULL vs IS_ERR() check
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 <[email protected]>
--- drivers/clk/mmp/clk-pxa1908-apmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/mmp/clk-pxa1908-apmu.c +2 -2
@@ -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))
Signature · 1 line
2.43.0
Quoted 8 lines · 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 <[email protected]>--- 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 <[email protected]>
Best regards,
Krzysztof
Quoting Charles Han (2025-03-06 22:47:07)
Quoted 6 lines
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 <[email protected]>---
Applied to clk-next