[U-Boot] [PATCH 4/5] serial: zynq: Check priv pointer get via dev_get_priv()

Simon Glass sjg at chromium.org
Thu Jun 14 14:16:04 UTC 2018


Hi Michal,

On 14 June 2018 at 07:05, Michal Simek <michal.simek at xilinx.com> wrote:
> On 14.6.2018 14:58, Simon Glass wrote:
>> Hi,
>>
>> On 14 June 2018 at 03:32, Michal Simek <michal.simek at xilinx.com> wrote:
>>> Make sure that functions are working with proper strcture.
>>>
>>> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
>>> ---
>>>
>>> Reported by: Coverity (local)
>>>
>>> ---
>>>  drivers/serial/serial_zynq.c | 27 ++++++++++++++++++++++++---
>>>  1 file changed, 24 insertions(+), 3 deletions(-)
>>
>> But priv cannot be NULL if the device has been probed. So this check
>> is confusing at best.
>>
>> If this is from coverity, perhaps you can find a way to mask it?
>
> Let me talk to local guy how to do it.
>
> Also can you please look at that driver and tell me if we using private
> structure is used properly?
> Because I think we should be using platdata instead.
> What was that rule for using platdate versus private data?

Private data is created when the device is probed and freed when the
device is removed.

Platform data is created when the device is bound, and survives
probe/remove cycles.

Strictly speaking, platform data should be used to hold the decoded
device tree properties. Private data should be used for run-time
things the device needs to keep track of.

Regards,
Simon


More information about the U-Boot mailing list