Dear Viresh Kumar,
On Wed, 10 Sep 2014 17:52:59 +0530, Viresh Kumar wrote:
On 10 September 2014 17:38, Thomas Petazzoni
[off-list ref] wrote:
quoted
+ dt_cpufreq_driver.driver_data = dev_get_platdata(&pdev->dev);
I don't think this is right. What if platform device's platform data
is freed later?
That's why its always better to duplicate that structure instead of playing with
pointers.
Isn't the piece of code registering the platform_device supposed to
make sure that platform_data doesn't disappear? At least, in PATCH 3/4,
I'm using platform_device_register_data(), which does a kmemdup() of
the custom data being passed before assigning the struct
device->platform_data field.
But if you like, I can add one more memory copy :)
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com