kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] pinctrl: nxp: Fix resource leaks in for_each_child_of_node() loops
       [not found] ` <fca44dcf-e632-fed6-aee9-03a5b0c6b1d9@web.de>
@ 2023-06-13  6:41   ` Chester Lin
       [not found]     ` <b6c1500b-c901-00c7-e1be-1fa0088972a3@web.de>
  0 siblings, 1 reply; 2+ messages in thread
From: Chester Lin @ 2023-06-13  6:41 UTC (permalink / raw)
  To: Markus Elfring
  Cc: kernel-janitors, s32, linux-gpio, opensource.kernel,
	Linus Walleij, Lu Hongfei, LKML, cocci

On Mon, Jun 12, 2023 at 04:01:00PM +0200, Markus Elfring wrote:
> > Ensure child node references are decremented properly in the error path.
> …
> > +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c
> > @@ -279,8 +279,10 @@ static int s32_dt_node_to_map(struct pinctrl_dev *pctldev,
> >  		ret = s32_dt_group_node_to_map(pctldev, np, map,
> >  					       &reserved_maps, num_maps,
> >  					       np_config->name);
> > -		if (ret < 0)
> > +		if (ret < 0) {
> > +			of_node_put(np);
> >  			break;
> > +		}
> >  	}
> >
> >  	if (ret)
> 
> May the same error predicate be applied at two places here?
> 

I think these two error predicates can be combined together in another patch.

Regards,
Chester

> Regards,
> Markus

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

* Re: [PATCH] pinctrl: nxp: Adjust error predicates for improved exception handling in s32_dt_node_to_map()?
       [not found]     ` <b6c1500b-c901-00c7-e1be-1fa0088972a3@web.de>
@ 2023-06-13  9:27       ` Chester Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Chester Lin @ 2023-06-13  9:27 UTC (permalink / raw)
  To: Markus Elfring
  Cc: kernel-janitors, s32, linux-gpio, opensource.kernel,
	Linus Walleij, Lu Hongfei, LKML, cocci

On Tue, Jun 13, 2023 at 11:15:22AM +0200, Markus Elfring wrote:
> >>> Ensure child node references are decremented properly in the error path.
> >> …
> >>> +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c
> >>> @@ -279,8 +279,10 @@ static int s32_dt_node_to_map(struct pinctrl_dev *pctldev,
> >>>  		ret = s32_dt_group_node_to_map(pctldev, np, map,
> >>>  					       &reserved_maps, num_maps,
> >>>  					       np_config->name);
> >>> -		if (ret < 0)
> >>> +		if (ret < 0) {
> >>> +			of_node_put(np);
> >>>  			break;
> >>> +		}
> >>>  	}
> >>>
> >>>  	if (ret)
> >>
> >> May the same error predicate be applied at two places here?
> >>
> >
> > I think these two error predicates can be combined together in another patch.
> 
> Are you going to reduce such error predicates so that exception handling
> can be improved another bit?
> 
Yes, I am. There will be a patch to improve these error predicates. Thanks for
your suggestion.

Regards,
Chester

> Regards,
> Markus

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

end of thread, other threads:[~2023-06-13  9:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230606070201.14249-1-luhongfei@vivo.com>
     [not found] ` <fca44dcf-e632-fed6-aee9-03a5b0c6b1d9@web.de>
2023-06-13  6:41   ` [PATCH] pinctrl: nxp: Fix resource leaks in for_each_child_of_node() loops Chester Lin
     [not found]     ` <b6c1500b-c901-00c7-e1be-1fa0088972a3@web.de>
2023-06-13  9:27       ` [PATCH] pinctrl: nxp: Adjust error predicates for improved exception handling in s32_dt_node_to_map()? Chester Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).