All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe()
@ 2024-02-04  9:24 Markus Elfring
  2024-02-04  9:27 ` Dmitry Baryshkov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Markus Elfring @ 2024-02-04  9:24 UTC (permalink / raw)
  To: kernel-janitors, AngeloGioacchino Del Regno, Bjorn Andersson,
	David Collins, Fei Shao, Greg Kroah-Hartman, Peng Wu,
	Stephen Boyd, Vinod Koul
  Cc: LKML, Dmitry Baryshkov

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 4 Feb 2024 09:39:48 +0100

The devm_ioremap() function does not return error pointers.
It returns NULL on error.
This issue was detected once more also by using the Coccinelle software.

Update three checks (and corresponding error codes) for failed
function calls accordingly.

Fixes: ffdfbafdc4f4 ("spmi: Use devm_spmi_controller_alloc()")
Fixes: 231601cd22bd ("spmi: pmic-arb: Add support for PMIC v7")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---

See also:
Suggestion by Peng Wu
[PATCH -next] spmi: pmic-arb: fix a NULL vs IS_ERR() check in spmi_pmic_arb_probe()
https://lore.kernel.org/lkml/20221115090927.47143-1-wupeng58@huawei.com/
https://lkml.org/lkml/2022/11/15/197


 drivers/spmi/spmi-pmic-arb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 9ed1180fe31f..937c15324513 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -1462,8 +1462,8 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 	 */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
 	core = devm_ioremap(&ctrl->dev, res->start, resource_size(res));
-	if (IS_ERR(core))
-		return PTR_ERR(core);
+	if (!core)
+		return -ENOMEM;

 	pmic_arb->core_size = resource_size(res);

@@ -1495,15 +1495,15 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 						   "obsrvr");
 		pmic_arb->rd_base = devm_ioremap(&ctrl->dev, res->start,
 						 resource_size(res));
-		if (IS_ERR(pmic_arb->rd_base))
-			return PTR_ERR(pmic_arb->rd_base);
+		if (!pmic_arb->rd_base)
+			return -ENOMEM;

 		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
 						   "chnls");
 		pmic_arb->wr_base = devm_ioremap(&ctrl->dev, res->start,
 						 resource_size(res));
-		if (IS_ERR(pmic_arb->wr_base))
-			return PTR_ERR(pmic_arb->wr_base);
+		if (!pmic_arb->wr_base)
+			return -ENOMEM;
 	}

 	pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS;
--
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe()
  2024-02-04  9:24 [PATCH] spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe() Markus Elfring
@ 2024-02-04  9:27 ` Dmitry Baryshkov
  2024-02-05 23:42 ` David Collins
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2024-02-04  9:27 UTC (permalink / raw)
  To: Markus Elfring
  Cc: kernel-janitors, AngeloGioacchino Del Regno, Bjorn Andersson,
	David Collins, Fei Shao, Greg Kroah-Hartman, Peng Wu,
	Stephen Boyd, Vinod Koul, LKML

On Sun, 4 Feb 2024 at 10:24, Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 4 Feb 2024 09:39:48 +0100
>
> The devm_ioremap() function does not return error pointers.
> It returns NULL on error.
> This issue was detected once more also by using the Coccinelle software.
>
> Update three checks (and corresponding error codes) for failed
> function calls accordingly.
>
> Fixes: ffdfbafdc4f4 ("spmi: Use devm_spmi_controller_alloc()")
> Fixes: 231601cd22bd ("spmi: pmic-arb: Add support for PMIC v7")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>
> See also:
> Suggestion by Peng Wu
> [PATCH -next] spmi: pmic-arb: fix a NULL vs IS_ERR() check in spmi_pmic_arb_probe()
> https://lore.kernel.org/lkml/20221115090927.47143-1-wupeng58@huawei.com/
> https://lkml.org/lkml/2022/11/15/197
>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe()
  2024-02-04  9:24 [PATCH] spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe() Markus Elfring
  2024-02-04  9:27 ` Dmitry Baryshkov
@ 2024-02-05 23:42 ` David Collins
  2024-02-06  9:21 ` AngeloGioacchino Del Regno
  2024-04-08  3:30 ` Stephen Boyd
  3 siblings, 0 replies; 5+ messages in thread
From: David Collins @ 2024-02-05 23:42 UTC (permalink / raw)
  To: Markus Elfring, kernel-janitors, AngeloGioacchino Del Regno,
	Bjorn Andersson, Fei Shao, Greg Kroah-Hartman, Peng Wu,
	Stephen Boyd, Vinod Koul
  Cc: LKML, Dmitry Baryshkov

On 2/4/24 01:24, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 4 Feb 2024 09:39:48 +0100
> 
> The devm_ioremap() function does not return error pointers.
> It returns NULL on error.
> This issue was detected once more also by using the Coccinelle software.
> 
> Update three checks (and corresponding error codes) for failed
> function calls accordingly.
> 
> Fixes: ffdfbafdc4f4 ("spmi: Use devm_spmi_controller_alloc()")
> Fixes: 231601cd22bd ("spmi: pmic-arb: Add support for PMIC v7")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> 
> See also:
> Suggestion by Peng Wu
> [PATCH -next] spmi: pmic-arb: fix a NULL vs IS_ERR() check in spmi_pmic_arb_probe()
> https://lore.kernel.org/lkml/20221115090927.47143-1-wupeng58@huawei.com/
> https://lkml.org/lkml/2022/11/15/197
> 
> 
>  drivers/spmi/spmi-pmic-arb.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: David Collins <quic_collinsd@quicinc.com>

Thanks for making this fix.

Take care,
David


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe()
  2024-02-04  9:24 [PATCH] spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe() Markus Elfring
  2024-02-04  9:27 ` Dmitry Baryshkov
  2024-02-05 23:42 ` David Collins
@ 2024-02-06  9:21 ` AngeloGioacchino Del Regno
  2024-04-08  3:30 ` Stephen Boyd
  3 siblings, 0 replies; 5+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-02-06  9:21 UTC (permalink / raw)
  To: Markus Elfring, kernel-janitors, Bjorn Andersson, David Collins,
	Fei Shao, Greg Kroah-Hartman, Peng Wu, Stephen Boyd, Vinod Koul
  Cc: LKML, Dmitry Baryshkov

Il 04/02/24 10:24, Markus Elfring ha scritto:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 4 Feb 2024 09:39:48 +0100
> 
> The devm_ioremap() function does not return error pointers.
> It returns NULL on error.
> This issue was detected once more also by using the Coccinelle software.
> 
> Update three checks (and corresponding error codes) for failed
> function calls accordingly.
> 
> Fixes: ffdfbafdc4f4 ("spmi: Use devm_spmi_controller_alloc()")
> Fixes: 231601cd22bd ("spmi: pmic-arb: Add support for PMIC v7")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe()
  2024-02-04  9:24 [PATCH] spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe() Markus Elfring
                   ` (2 preceding siblings ...)
  2024-02-06  9:21 ` AngeloGioacchino Del Regno
@ 2024-04-08  3:30 ` Stephen Boyd
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2024-04-08  3:30 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Bjorn Andersson, David Collins,
	Fei Shao, Greg Kroah-Hartman, Markus Elfring, Peng Wu,
	Vinod Koul, kernel-janitors
  Cc: LKML, Dmitry Baryshkov

Quoting Markus Elfring (2024-02-04 01:24:18)
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 4 Feb 2024 09:39:48 +0100
> 
> The devm_ioremap() function does not return error pointers.
> It returns NULL on error.
> This issue was detected once more also by using the Coccinelle software.
> 
> Update three checks (and corresponding error codes) for failed
> function calls accordingly.
> 
> Fixes: ffdfbafdc4f4 ("spmi: Use devm_spmi_controller_alloc()")
> Fixes: 231601cd22bd ("spmi: pmic-arb: Add support for PMIC v7")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

Applied to spmi-next

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-08  3:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-04  9:24 [PATCH] spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe() Markus Elfring
2024-02-04  9:27 ` Dmitry Baryshkov
2024-02-05 23:42 ` David Collins
2024-02-06  9:21 ` AngeloGioacchino Del Regno
2024-04-08  3:30 ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.