2018-11-21 13:31:56

by Frank Lee

[permalink] [raw]
Subject: [PATCH] ata: pata_macio: add of_node_put()

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.

Signed-off-by: Yangtao Li <[email protected]>
---
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
--
2.17.0



2018-11-21 15:33:49

by Frank Lee

[permalink] [raw]
Subject: Re: [PATCH] ata: pata_macio: add of_node_put()

On Wed, Nov 21, 2018 at 11:24 PM Sergei Shtylyov
<[email protected]> 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 <[email protected]>
> > ---
> > 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

2018-11-21 18:17:20

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH] ata: pata_macio: add of_node_put()

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()?

> Signed-off-by: Yangtao Li <[email protected]>
> ---
> 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

2018-11-21 18:18:00

by Frank Lee

[permalink] [raw]
Subject: Re: [PATCH] ata: pata_macio: add of_node_put()

On Wed, Nov 21, 2018 at 11:31 PM Frank Lee <[email protected]> wrote:
>
> On Wed, Nov 21, 2018 at 11:24 PM Sergei Shtylyov
> <[email protected]> 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:

Yeah,this is a typo.
Need me to resend a patch?

Thanks,
Yangtao
> Hi Sergei:
>
> What do you mean?
> Why not release the refcount of root?
>
> Yours,
> Yangtao
> >
> > > Signed-off-by: Yangtao Li <[email protected]>
> > > ---
> > > 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

2018-11-23 03:48:33

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH] ata: pata_macio: add of_node_put()

On 21.11.2018 18:33, Frank Lee 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:
>
> Yeah,this is a typo.
> Need me to resend a patch?

This is more of a question for the libata maintainers (but I would resend).

> Thanks,
> Yangtao

MBR, Sergei

Subject: Re: [PATCH] ata: pata_macio: add of_node_put()


On 11/21/2018 02: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.
>
> Signed-off-by: Yangtao Li <[email protected]>

Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>

> 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
>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

2018-12-21 01:20:32

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] ata: pata_macio: add of_node_put()

On 12/20/18 10:03 AM, Bartlomiej Zolnierkiewicz wrote:
>
> On 11/21/2018 02: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.
>>
>> Signed-off-by: Yangtao Li <[email protected]>
>
> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>

Yangtao, were you going to resend this one?

--
Jens Axboe


2018-12-21 08:04:23

by Frank Lee

[permalink] [raw]
Subject: Re: [PATCH] ata: pata_macio: add of_node_put()

On Fri, Dec 21, 2018 at 2:01 AM Jens Axboe <[email protected]> wrote:
>
> On 12/20/18 10:03 AM, Bartlomiej Zolnierkiewicz wrote:
> >
> > On 11/21/2018 02: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.
> >>
> >> Signed-off-by: Yangtao Li <[email protected]>
> >
> > Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>
>
> Yangtao, were you going to resend this one?
Actually,I've rensent the v2 at Nov 22.And I just changed the changelog.
Can you pick it up?

Thanks,
Yangtao

2018-12-21 22:36:41

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] ata: pata_macio: add of_node_put()

On 12/20/18 6:09 PM, Frank Lee wrote:
> On Fri, Dec 21, 2018 at 2:01 AM Jens Axboe <[email protected]> wrote:
>>
>> On 12/20/18 10:03 AM, Bartlomiej Zolnierkiewicz wrote:
>>>
>>> On 11/21/2018 02: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.
>>>>
>>>> Signed-off-by: Yangtao Li <[email protected]>
>>>
>>> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>
>>
>> Yangtao, were you going to resend this one?
> Actually,I've rensent the v2 at Nov 22.And I just changed the changelog.
> Can you pick it up?

I missed that, sorry. I'll pick it up.

--
Jens Axboe