[lm-sensors] [PATCH 2/3] hwmon/f71882fg: Set platform drvdata to NULL later

Guenter Roeck guenter.roeck at ericsson.com
Sun Mar 13 15:39:25 CET 2011


On Sun, Mar 13, 2011 at 10:02:20AM -0400, Jean Delvare wrote:
> On Sun, 13 Mar 2011 13:50:33 +0100, Hans de Goede wrote:
> > This avoids a possible race leading to trying to dereference NULL.
> > 
> > Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> > ---
> >  drivers/hwmon/f71882fg.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
> > index 9cb52f5..a4d430e 100644
> > --- a/drivers/hwmon/f71882fg.c
> > +++ b/drivers/hwmon/f71882fg.c
> > @@ -2280,7 +2280,6 @@ static int f71882fg_remove(struct platform_device *pdev)
> >  	int nr_temps = (data->type == f71808e) ? 2 : 3;
> >  	u8 start_reg = f71882fg_read8(data, F71882FG_REG_START);
> >  
> > -	platform_set_drvdata(pdev, NULL);
> >  	if (data->hwmon_dev)
> >  		hwmon_device_unregister(data->hwmon_dev);
> >  
> > @@ -2363,6 +2362,7 @@ static int f71882fg_remove(struct platform_device *pdev)
> >  		}
> >  	}
> >  
> > +	platform_set_drvdata(pdev, NULL);
> >  	kfree(data);
> >  
> >  	return 0;
> 
> 
> Acked-by: Jean Delvare <khali at linux-fr.org>
> 
> I'd suggest a
> Cc: stable at kernel.org
> for this fix too.
> 
Applied, and added.

Thanks,
Guenter




More information about the lm-sensors mailing list