spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe()
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:ffdfbafdc4
("spmi: Use devm_spmi_controller_alloc()") Fixes:231601cd22
("spmi: pmic-arb: Add support for PMIC v7") Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Link: https://lore.kernel.org/r/82a0768e-95b0-4091-bdd1-14c3e893726b@web.de Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: David Collins <quic_collinsd@quicinc.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org> Link: https://lore.kernel.org/r/20240507210809.3479953-6-sboyd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
eda4923d78
commit
c86f90e30a
@ -1462,8 +1462,8 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
|
|||||||
*/
|
*/
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
|
||||||
core = devm_ioremap(&ctrl->dev, res->start, resource_size(res));
|
core = devm_ioremap(&ctrl->dev, res->start, resource_size(res));
|
||||||
if (IS_ERR(core))
|
if (!core)
|
||||||
return PTR_ERR(core);
|
return -ENOMEM;
|
||||||
|
|
||||||
pmic_arb->core_size = resource_size(res);
|
pmic_arb->core_size = resource_size(res);
|
||||||
|
|
||||||
@ -1495,15 +1495,15 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
|
|||||||
"obsrvr");
|
"obsrvr");
|
||||||
pmic_arb->rd_base = devm_ioremap(&ctrl->dev, res->start,
|
pmic_arb->rd_base = devm_ioremap(&ctrl->dev, res->start,
|
||||||
resource_size(res));
|
resource_size(res));
|
||||||
if (IS_ERR(pmic_arb->rd_base))
|
if (!pmic_arb->rd_base)
|
||||||
return PTR_ERR(pmic_arb->rd_base);
|
return -ENOMEM;
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
|
||||||
"chnls");
|
"chnls");
|
||||||
pmic_arb->wr_base = devm_ioremap(&ctrl->dev, res->start,
|
pmic_arb->wr_base = devm_ioremap(&ctrl->dev, res->start,
|
||||||
resource_size(res));
|
resource_size(res));
|
||||||
if (IS_ERR(pmic_arb->wr_base))
|
if (!pmic_arb->wr_base)
|
||||||
return PTR_ERR(pmic_arb->wr_base);
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS;
|
pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS;
|
||||||
|
Loading…
Reference in New Issue
Block a user