lkml.org 
[lkml]   [2015]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] ser_gigaset: fix deallocation of platform device structure
From
Date
Hi Peter,

Am 10.12.2015 um 15:04 schrieb Peter Hurley:

>>>> --- a/drivers/isdn/gigaset/ser-gigaset.c
>>>> +++ b/drivers/isdn/gigaset/ser-gigaset.c
>>>> @@ -370,19 +370,23 @@ 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);
>
> This is of marginal value and (I think) unnecessary; it implies
> the core will use the device after release, which would trigger
> many problems if true.

Agreed, but I'm just moving existing code here. Dropping the
dev_set_drvdata() call would be an unrelated change which should be done
in a separate patch if I understand the rules correctly.

Regards,
Tilman

--
Tilman Schmidt E-Mail: tilman@imap.cc
Bonn, Germany
Nous, on a des fleurs et des bougies pour nous protéger.

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2015-12-12 19:21    [W:1.311 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site