Skip to contentSkip to conversation

mailbox: imx: Fix an IS_ERR() vs NULL bug

PATCH In review Dan Carpenter 2 participants 2 messages Nov 24, 2021 – Nov 25, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mailbox: imx: Fix an IS_ERR() vs NULL bug

The devm_kzalloc() function does not return error pointers, it returns NULL on failure.

Fixes 97961f78e8bc ("mailbox: imx: support i.MX8ULP S4 MU")
---
 drivers/mailbox/imx-mailbox.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mailbox/imx-mailbox.c +2 -2
index ffe36a6bef9e..544de2db6453 100644
@@ -563,8 +563,8 @@ static int imx_mu_probe(struct platform_device *pdev)
 		size = sizeof(struct imx_sc_rpc_msg_max);
 
 	priv->msg = devm_kzalloc(dev, size, GFP_KERNEL);
-	if (IS_ERR(priv->msg))
-		return PTR_ERR(priv->msg);
+	if (!priv->msg)
+		return -ENOMEM;
 
 	priv->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(priv->clk)) {
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines

Subject: [PATCH] mailbox: imx: Fix an IS_ERR() vs NULL bug

The devm_kzalloc() function does not return error pointers, it returns NULL on failure.

Fixes 97961f78e8bc ("mailbox: imx: support i.MX8ULP S4 MU")
Quoted 19 lines
---
 drivers/mailbox/imx-mailbox.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mailbox/imx-mailbox.c +2 -2
index ffe36a6bef9e..544de2db6453 100644
@@ -563,8 +563,8 @@ static int imx_mu_probe(struct platform_device
 *pdev)
 		size = sizeof(struct imx_sc_rpc_msg_max);
 
 	priv->msg = devm_kzalloc(dev, size, GFP_KERNEL);
-	if (IS_ERR(priv->msg))
-		return PTR_ERR(priv->msg);
+	if (!priv->msg)
+		return -ENOMEM;
 
 	priv->clk = devm_clk_get(dev, NULL);
Quoted 3 lines

if (IS_ERR(priv->clk)) {
--
2.20.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel