]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: mmp: Fix NULL vs IS_ERR() check
authorCharles Han <hanchunchao@inspur.com>
Fri, 7 Mar 2025 06:47:07 +0000 (14:47 +0800)
committerStephen Boyd <sboyd@kernel.org>
Fri, 7 Mar 2025 19:05:01 +0000 (11:05 -0800)
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>
Link: https://lore.kernel.org/r/20250307064708.209511-1-hanchunchao@inspur.com
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mmp/clk-pxa1908-apmu.c

index 8cfb1258202f6f312a7c01128ad91d1b02b3cffc..d3a070687fc5b9fb5338f377f82e7664ca0aac29 100644 (file)
@@ -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))