Re: [PATCH 1/4] MMC: omap_hsmmc: set platform data after probe from DT node

Grant Likely
2012-10-13T12:37:20Z

Daniel Mack <zonque@gmail.com> wrote:

>On 13.10.2012 10:48, Grant Likely wrote:
>>
>> somedriver_probe(struct platform_device *pdev)
>> {
>> struct somedriver_private *somedriver;
>>
>> somedriver = devm_kzalloc(sizeof (*somedriver), GFP_KERNEL);
>> somedriver->pdata = pdev->platform_data;
>> if (OF)
>> somedriver->pdata = devm_kzalloc(sizeof
>> (*somedriver->pdata), GFP_KERNEL);
>> }
>>
>> The bonus with using devm_kzalloc is the driver doesn't even need to
>> do anything special to undo these allocations on failure or release.
>> :-)
>
>Ok, understood. Will keep an eye on this in the future. Thanks again
>for
>the explanation.
>
>For this particular driver, this means that both my and Balaji's ways
>of
>fixing this are wrong?

Balaji's patch looks fine since it uses a local copy of the platform data structure. It appears that the driver is already creating a local copy and Balaji is just bug fixing call sites that aren't using it yet.

g.

--
Grant Likely, P.Eng.
Secret Lab Technologies Ltd.