Re: [PATCH] ata: pata_macio: add of_node_put()
From: Frank Lee
Date: Wed Nov 21 2018 - 10:31:49 EST
On Wed, Nov 21, 2018 at 11:24 PM Sergei Shtylyov
<sergei.shtylyov@xxxxxxxxxxxxxxxxxx> wrote:
>
> Hello!
>
> On 11/21/2018 04:04 PM, Yangtao Li wrote:
>
> > of_find_node_by_path() acquires a reference to the node
> > returned by it and that reference needs to be dropped by its caller.
> > bl_idle_init() doesn't do that, so fix it.
>
> I thought we're inside pata_macio_cable_detect()?
Hi Sergeiï
What do you mean?
Why not release the refcount of root?
Yours,
Yangtao
>
> > Signed-off-by: Yangtao Li <tiny.windzz@xxxxxxxxx>
> > ---
> > drivers/ata/pata_macio.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c
> > index 9588e685d994..8cc9c429ad95 100644
> > --- a/drivers/ata/pata_macio.c
> > +++ b/drivers/ata/pata_macio.c
> > @@ -483,6 +483,8 @@ static int pata_macio_cable_detect(struct ata_port *ap)
> > struct device_node *root = of_find_node_by_path("/");
> > const char *model = of_get_property(root, "model", NULL);
> >
> > + of_node_put(root);
> > +
> > if (cable && !strncmp(cable, "80-", 3)) {
> > /* Some drives fail to detect 80c cable in PowerBook
> > * These machine use proprietary short IDE cable
>
> MBR, Sergei