[PATCH next] clk: mmp: pxa1908-apbcp: Fix a NULL vs IS_ERR() bug in probe

Dan Carpenter posted 1 patch 1 year, 5 months ago
drivers/clk/mmp/clk-pxa1908-apbcp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH next] clk: mmp: pxa1908-apbcp: Fix a NULL vs IS_ERR() bug in probe
Posted by Dan Carpenter 1 year, 5 months ago
The devm_kzalloc() function doesn't return error pointers, it returns
NULL on error.  Update the check to match.

Fixes: a89233dbd4df ("clk: mmp: Add Marvell PXA1908 APBCP driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/clk/mmp/clk-pxa1908-apbcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/mmp/clk-pxa1908-apbcp.c b/drivers/clk/mmp/clk-pxa1908-apbcp.c
index 08f3845cbb1b..f638d7e89b47 100644
--- a/drivers/clk/mmp/clk-pxa1908-apbcp.c
+++ b/drivers/clk/mmp/clk-pxa1908-apbcp.c
@@ -48,8 +48,8 @@ static int pxa1908_apbcp_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.45.2
Re: [PATCH next] clk: mmp: pxa1908-apbcp: Fix a NULL vs IS_ERR() bug in probe
Posted by Stephen Boyd 1 year, 5 months ago
Quoting Dan Carpenter (2024-11-20 09:18:44)
> The devm_kzalloc() function doesn't return error pointers, it returns
> NULL on error.  Update the check to match.
> 
> Fixes: a89233dbd4df ("clk: mmp: Add Marvell PXA1908 APBCP driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

Applied to clk-next
Re: [PATCH next] clk: mmp: pxa1908-apbcp: Fix a NULL vs IS_ERR() bug in probe
Posted by Duje Mihanović 1 year, 5 months ago
On Wednesday 20 November 2024 18:18:44 Central European Standard Time Dan 
Carpenter wrote:
> The devm_kzalloc() function doesn't return error pointers, it returns
> NULL on error.  Update the check to match.
> 
> Fixes: a89233dbd4df ("clk: mmp: Add Marvell PXA1908 APBCP driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

Acked-by: Duje Mihanović <duje.mihanovic@skole.hr>

Regards,
-- 
Duje