Re: [PATCH 15/22] Input: iqs7222 - use cleanup facility for fwnodes

From: Jeff LaBundy
Date: Tue Sep 10 2024 - 11:14:49 EST


Hi Dmitry,

On Sun, Sep 08, 2024 at 06:34:21PM -0700, Dmitry Torokhov wrote:
> Hi Jeff,
>
> On Sun, Sep 08, 2024 at 07:12:10PM -0500, Jeff LaBundy wrote:
> > Hi Dmitry,
> >
> > On Tue, Sep 03, 2024 at 09:48:25PM -0700, Dmitry Torokhov wrote:
> > > Use __free(fwnode_handle) cleanup facility to ensure that references to
> > > acquired fwnodes are dropped at appropriate times automatically.
> > >
> > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> > > ---
> > > drivers/input/misc/iqs7222.c | 30 ++++++++++++++----------------
> > > 1 file changed, 14 insertions(+), 16 deletions(-)
> > >
> > > diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c
> > > index 9ca5a743f19f..d9b87606ff7a 100644
> > > --- a/drivers/input/misc/iqs7222.c
> > > +++ b/drivers/input/misc/iqs7222.c
> > > @@ -2385,9 +2385,9 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222,
> > > for (i = 0; i < ARRAY_SIZE(iqs7222_kp_events); i++) {
> > > const char *event_name = iqs7222_kp_events[i].name;
> > > u16 event_enable = iqs7222_kp_events[i].enable;
> > > - struct fwnode_handle *event_node;
> > >
> > > - event_node = fwnode_get_named_child_node(chan_node, event_name);
> > > + struct fwnode_handle *event_node __free(fwnode_handle) =
> > > + fwnode_get_named_child_node(chan_node, event_name);
> >
> > This leaves a newline amongst the declarations, but not in between the
> > declarations and code. I don't feel strongly against this, but it's
> > opposite of what I understand to be more common; please let me know in
> > case I have misunderstood. This comment applies to the other chunks as
> > well.
>
> Right, so this is actually combining declaration and initialization case
> that I mentioned in the other email, and it is closer in spirit to the
> code and the allocation check below. That is why it is separated from
> the declaration block.

Thanks again for the background information; please feel free to add:

Reviewed-by: Jeff LaBundy <jeff@xxxxxxxxxxx>

>
> Thanks.
>
> --
> Dmitry

Kind regards,
Jeff LaBundy