Re: [PATCH v2 1/4] of_net: Add NVMEM support to of_get_mac_address

From: Petr Åtetiar
Date: Wed May 08 2019 - 05:03:08 EST


Rob Herring <robh@xxxxxxxxxx> [2019-05-07 11:06:43]:

Hi,

> > Honestly I don't know if it's necessary to have it, but so far address,
> > mac-address and local-mac-address properties provide this DT nodes, so I've
> > simply thought, that it would be good to have it for MAC address from NVMEM as
> > well in order to stay consistent.
>
> If you want to be consistent, then fill in 'local-mac-address' with
> the value from nvmem. We don't need the same thing with a new name
> added to DT. (TBC, I'm not suggesting you do that here.)

Ok, got it.

> But really, my point with using devm_kzalloc() is just return the
> data, not store in DT and free it when the driver unbinds.

Ok, I've simply misunderstood your point, sorry, I'll handle it in the follow
up fix series, along with the DT documentation update.

> Allocating it with devm_kzalloc AND adding it to DT as you've done in v4
> leads to 2 entities refcounting the allocation. If the driver unbinds, the
> buffer is freed, but DT code is still referencing that memory.

Indeed, I did it wrong, will fix that.

> 'nvmem-mac-address' is not a documented property. That would need to
> be documented before using upstream. Though, for reasons above, I
> don't think it should be.

Ok, it makes sense now. Thanks for the detailed explanation.

-- ynezz