From: Andre Prendel <andre.prendel@gmx.de>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] k8temp: Unset driver data in exit_remove
Date: Wed, 06 May 2009 07:54:26 +0000 [thread overview]
Message-ID: <20090506075426.GB4386@ubuntu> (raw)
In-Reply-To: <20090506071741.GA4386@ubuntu>
On Wed, May 06, 2009 at 09:36:45AM +0200, Jean Delvare wrote:
> Hi Andre,
>
> On Wed, 6 May 2009 09:17:41 +0200, Andre Prendel wrote:
> > Hi Jean, Rudolf,
> >
> > after infiltrating the sensors user space part, I think it's time to
> > dive into kernel space. So I took a look at some of the sensor drivers
> > to get an understanding. Unfortunately I couldn't find a bug to fix,
> > so I had to do something else :)
> >
> > I don't know whether this patch is worth to be applied, but I have to
> > start somewhere.
>
> No, I don't want to apply this, sorry. While your patch is technically
> correct, I prefer to always keep dev_set_drvdata(dev, NULL) or
> equivalent right before freeing the data structure that may have been
> used as the driver data. When developers copy and paste code around, it
> makes it way less likely for them to leave dangling pointers behind.
>
> Given that this is an error path and thus normally not taken, we don't
> care about performance there, robustness is more important.
I agree with you.
> > I'm very interested in doing more kernel stuff. So if you have some
> > work to do, please tell me about it.
>
> I'll remember that :) Actually you may want to look at the abandoned
> tmp401 driver. Hans de Goede worked on it originally but it never made
> it into mainline. That's a pity because it was almost ready. I seem to
> remember it needs to be updated due to i2c infrastructure changes, and
> minor cleanups were needed before I would take the driver into mainline:
>
> http://lists.lm-sensors.org/pipermail/lm-sensors/2008-June/023411.html
> http://lists.lm-sensors.org/pipermail/lm-sensors/2008-August/024024.html
>
> Is this something you'd be interested in? If you don't have any
> supported chip, I can send you chip dumps, which you can feed into
> i2c-stub to emulate a chip. Or if you are into soldering, you may be
> able to ask TI for free chip samples.
Yes, it sounds interesting, I will have a look this.
Thanks
Andre
> > Thanks
> > Andre
> > ---
> >
> > At the exit_free label in k8temp_probe() the driver data is set to
> > NULL. This field isn't set before. So this should be done in
> > exit_remove.
> >
> > Signed-off-by: Andre Prendel <andre.prendel@gmx.de>
> > ---
> >
> > --- linux-2.6.orig/drivers/hwmon/k8temp.c 2009-05-05 21:31:44.000000000 +0200
> > +++ linux-2.6/drivers/hwmon/k8temp.c 2009-05-05 21:35:03.000000000 +0200
> > @@ -281,8 +281,8 @@
> > device_remove_file(&pdev->dev,
> > &sensor_dev_attr_temp4_input.dev_attr);
> > device_remove_file(&pdev->dev, &dev_attr_name);
> > -exit_free:
> > dev_set_drvdata(&pdev->dev, NULL);
> > +exit_free:
> > kfree(data);
> > exit:
> > return err;
> >
>
>
> --
> Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2009-05-06 7:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-06 7:17 [lm-sensors] [PATCH] k8temp: Unset driver data in exit_remove Andre Prendel
2009-05-06 7:36 ` Jean Delvare
2009-05-06 7:54 ` Andre Prendel [this message]
2009-05-06 7:54 ` Hans de Goede
2009-05-06 8:59 ` Andre Prendel
2009-05-06 14:03 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090506075426.GB4386@ubuntu \
--to=andre.prendel@gmx.de \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.