On Wednesday 10 September 2014 18:02:59 Viresh Kumar wrote: > > 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. > > Atleast in your case it isn't required to copy anymore but this driver can be > used by others which may not guarantee that.. > > > But if you like, I can add one more memory copy > > Its not what I like, as wasting memory isn't sensible at all.. But about what's > the right thing to do to make this code un-breakable.. > > @Arnd: Any inputs? platform_device_register_data() is the right way to register a platform device if one needs to do that, and it will always copy the data, so that should be used, and the driver should rely on the data not getting freed under it. Statically defining platform_device instances is generally a bad idea, and we should not do that, but if someone does it is up to them to make sure the platform_data is not marked as __init. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html