Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1284908
| From | Paul Bolle <pebolle@tiscali.nl> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: gigaset: freeing an active object |
| Date | 2015-12-06 21:20 +0100 |
| Message-ID | <qCNWO-3cn-11@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <qAjzP-43e-5@gated-at.bofh.it> <qAB3I-739-13@gated-at.bofh.it> <qBpjQ-5xC-15@gated-at.bofh.it> <qCHHH-7vV-13@gated-at.bofh.it> <qCJzQ-fR-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On zo, 2015-12-06 at 16:29 +0100, Tilman Schmidt wrote:
> So the solution might be as simple as moving the kfree() call from
> gigaset_freecshw() to gigaset_device_release(). Something like this:
>
> --- a/drivers/isdn/gigaset/ser-gigaset.c
> +++ b/drivers/isdn/gigaset/ser-gigaset.c
> @@ -370,19 +370,18 @@ static void gigaset_freecshw(struct cardstate
> *cs)
> tasklet_kill(&cs->write_tasklet);
> if (!cs->hw.ser)
> return;
> - dev_set_drvdata(&cs->hw.ser->dev.dev, NULL);
> platform_device_unregister(&cs->hw.ser->dev);
> - kfree(cs->hw.ser);
> - cs->hw.ser = NULL;
> }
>
> static void gigaset_device_release(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> + struct cardstate *cs = dev_get_drvdata(dev);
>
> - /* adapted from platform_device_release() in
> drivers/base/platform.c */
> - kfree(dev->platform_data);
> - kfree(pdev->resource);
> + if (!cs)
> + return;
> + dev_set_drvdata(dev, NULL);
> + kfree(cs->hw.ser);
> + cs->hw.ser = NULL;
> }
This solution assumes that the struct platform_device is moved out of
the struct ser_cardstate, doesn't it? In other words, this is something
to do on top of my (draft) patch. Otherwise we'd still be freeing memory
managed through reference counting.
Thanks,
Paul Bolle
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: gigaset: freeing an active object Paul Bolle <pebolle@tiscali.nl> - 2015-11-30 19:10 +0100
Re: gigaset: freeing an active object Tilman Schmidt <tilman@imap.cc> - 2015-11-30 19:40 +0100
Re: gigaset: freeing an active object Paul Bolle <pebolle@tiscali.nl> - 2015-11-30 22:10 +0100
Re: gigaset: freeing an active object Tilman Schmidt <tilman@imap.cc> - 2015-12-01 10:40 +0100
Re: gigaset: freeing an active object Paul Bolle <pebolle@tiscali.nl> - 2015-12-01 11:10 +0100
Re: gigaset: freeing an active object Peter Hurley <peter@hurleysoftware.com> - 2015-12-03 00:50 +0100
Re: gigaset: freeing an active object Paul Bolle <pebolle@tiscali.nl> - 2015-12-06 14:40 +0100
Re: gigaset: freeing an active object Tilman Schmidt <tilman@imap.cc> - 2015-12-06 16:40 +0100
Re: gigaset: freeing an active object Paul Bolle <pebolle@tiscali.nl> - 2015-12-06 21:20 +0100
Re: gigaset: freeing an active object Tilman Schmidt <tilman@imap.cc> - 2015-12-07 10:30 +0100
Re: gigaset: freeing an active object Paul Bolle <pebolle@tiscali.nl> - 2015-12-07 13:30 +0100
Re: gigaset: freeing an active object Tilman Schmidt <tilman@imap.cc> - 2015-12-07 19:50 +0100
csiph-web