Re: [PATCH] pinctrl: sunplus: Delete an unnecessary check before kfree() in sppctl_dt_node_to_map()

From: Andy Shevchenko
Date: Tue Jun 06 2023 - 10:42:35 EST


On Tue, Jun 6, 2023 at 4:26 PM Markus Elfring <Markus.Elfring@xxxxxx> wrote:
>
> From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> Date: Tue, 6 Jun 2023 15:00:18 +0200

You need to utilize what MAINTAINERS file has.

> It can be known that the function “kfree” performs a null pointer check
> for its input parameter.
> It is therefore not needed to repeat such a check before its call.
>
> Thus remove a redundant pointer check.

Seems reasonable to me.
FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>

> Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/pinctrl/sunplus/sppctl.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/sunplus/sppctl.c b/drivers/pinctrl/sunplus/sppctl.c
> index e91ce5b5d559..150996949ede 100644
> --- a/drivers/pinctrl/sunplus/sppctl.c
> +++ b/drivers/pinctrl/sunplus/sppctl.c
> @@ -971,8 +971,7 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node
>
> sppctl_map_err:
> for (i = 0; i < (*num_maps); i++)
> - if (((*map)[i].type == PIN_MAP_TYPE_CONFIGS_PIN) &&
> - (*map)[i].data.configs.configs)
> + if ((*map)[i].type == PIN_MAP_TYPE_CONFIGS_PIN)
> kfree((*map)[i].data.configs.configs);
> kfree(*map);
> of_node_put(parent);
> --
> 2.40.1
>


--
With Best Regards,
Andy Shevchenko