[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190603195927.GN2742@minyard.net>
Date: Mon, 3 Jun 2019 14:59:27 -0500
From: Corey Minyard <minyard@....org>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Suzuki K Poulose <suzuki.poulose@....com>,
linux-kernel@...r.kernel.org, rafael@...nel.org,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [RFC PATCH 02/57] drivers: ipmi: Drop device reference
On Mon, Jun 03, 2019 at 09:09:21PM +0200, Greg KH wrote:
> On Mon, Jun 03, 2019 at 04:49:28PM +0100, Suzuki K Poulose wrote:
> > Drop the reference to a device found via bus_find_device()
> >
> > Cc: Corey Minyard <minyard@....org>
> > Cc: Arnd Bergmann <arnd@...db.de>
> > Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
> > ---
> > drivers/char/ipmi/ipmi_si_platform.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c
> > index f2a91c4..ff82353 100644
> > --- a/drivers/char/ipmi/ipmi_si_platform.c
> > +++ b/drivers/char/ipmi/ipmi_si_platform.c
> > @@ -442,6 +442,7 @@ void ipmi_remove_platform_device_by_name(char *name)
> > pdev_match_name))) {
> > struct platform_device *pdev = to_platform_device(dev);
> >
> > + put_device(dev);
> > platform_device_unregister(pdev);
>
> So you drop the reference, and then actually use the pointer?
I did think about this, and in this case you can, I think.
platform_device_unregister() does a put_device() at the end of it's
processing, right?
But it is better style to do it the other way, so I can change it.
-corey
>
> The drop needs to be _after_ the call to platform_device_unregister().
>
> thanks,
>
> greg k-h
Powered by blists - more mailing lists