Re: [PATCH v3 2/4] input: misc: pm8941-pwrkey: add support for PON GEN3 base addresses

From: Stephen Boyd
Date: Thu Feb 03 2022 - 16:17:00 EST


Quoting Anjelique Melendez (2022-02-02 17:08:05)
> diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
> index e0240db12d4f..2a42a676b021 100644
> --- a/drivers/input/misc/pm8941-pwrkey.c
> +++ b/drivers/input/misc/pm8941-pwrkey.c
> @@ -200,15 +207,21 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "failed to locate regmap\n");
> return -ENODEV;
> }
> + }
>
> - error = of_property_read_u32(parent->of_node,
> - "reg", &pwrkey->baseaddr);
> - } else {
> - error = of_property_read_u32(pdev->dev.of_node, "reg",
> - &pwrkey->baseaddr);
> + addr = of_get_address(regmap_node, 0, NULL, NULL);
> + if (!addr) {
> + dev_err(&pdev->dev, "reg property missing\n");
> + return -EINVAL;
> + }
> + pwrkey->baseaddr = be32_to_cpup(*addr);
> +
> + if (pwrkey->data->has_pon_pbs) {
> + /* PON_PBS base address is optional */
> + addr = of_get_address(regmap_node, 1, NULL, NULL);
> + if (addr)
> + pwrkey->pon_pbs_baseaddr = be32_to_cpup(*addr);

With the deref dropped.

Reviewed-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>