lkml.org 
[lkml]   [2015]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: unbind/bind w1-gpio with device tree produce a crash
is it ok, to create a new global variable that tracks if pdata was 
alloced via devm_kzalloc and sets pdata to NULL in w1_gpio_remove?

Am 04.03.2015 um 04:53 schrieb Ingo Flaschberger:
> If w1-gpio is probed via device-tree configuration, pdata is allocated
> via devm_kzalloc.
> When the device is unbind (and bind later) the allocated memory of
> pdate is freed - but it will not be allocacted again.
>
> static int w1_gpio_probe(struct platform_device *pdev)
> struct w1_bus_master *master;
> struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
> int err;
>
> if(pdata == NULL) {
> if (of_have_populated_dt()) {
> err = w1_gpio_probe_dt(pdev);
> if (err < 0)
> return err;
> }
> }
>
> How to detect if pdata was allocated via device-tree devm_kzalloc and
> not "hardcoded"?
> Then I could set pdev->dev.platform_data to NULL in w1_gpio_remove
> which will solve the crash.
>
> Kind regards,
> Ingo Flascherger
>



\
 
 \ /
  Last update: 2015-03-04 18:21    [W:0.079 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site