[PATCH] pinctrl: sunplus: Delete an unnecessary check before kfree() in sppctl_dt_node_to_map()
Andy Shevchenko
andy.shevchenko at gmail.com
Tue Jun 6 07:39:02 PDT 2023
On Tue, Jun 6, 2023 at 4:26 PM Markus Elfring <Markus.Elfring at web.de> wrote:
>
> From: Markus Elfring <elfring at users.sourceforge.net>
> 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 at gmail.com>
> Signed-off-by: Markus Elfring <elfring at users.sourceforge.net>
> ---
> 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
More information about the linux-arm-kernel
mailing list