From: Ingo Flaschberger <ingo.flaschberger@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: unbind/bind w1-gpio with device tree produce a crash
Date: Wed, 04 Mar 2015 17:38:48 +0100 [thread overview]
Message-ID: <54F73518.3000304@gmail.com> (raw)
In-Reply-To: <54F681A2.9020803@gmail.com>
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
>
next prev parent reply other threads:[~2015-03-04 16:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 3:53 unbind/bind w1-gpio with device tree produce a crash Ingo Flaschberger
2015-03-04 16:38 ` Ingo Flaschberger [this message]
[not found] ` <54F7C5D4.3000604@gmail.com>
2015-03-05 7:35 ` Fwd: " Markus Pargmann
2015-03-05 11:56 ` Ingo Flaschberger
2015-03-09 10:18 ` [PATCH] w1: gpio: Fix problematic platform_data usage Markus Pargmann
2015-04-10 10:22 ` Markus Pargmann
2016-03-22 11:59 ` Ingo Flaschberger
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=54F73518.3000304@gmail.com \
--to=ingo.flaschberger@gmail.com \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox