Re: [PATCH 3/4] nvmem: imx-ocotp: Support accessing controller for i.MX8M Nano
From: Krzysztof Kozlowski
Date: Fri Jan 31 2025 - 09:08:02 EST
On 31/01/2025 14:50, Alexander Stein wrote:
>>> +
>>> + while (!of_parse_phandle_with_args(child, "access-controllers",
>>> + "#access-controller-cells",
>>> + idx++, &args)) {
>>> + of_node_put(args.np);
>>> + if (args.np != dev->of_node)
>>
>> You are using args.np after dropping the reference.
>
> Indeed, but is it really a problem? The args.np pointer is still the same.
> So the comparison is unaffected.
>
> Both branches need to drop the reference, no?
Ah, indeed, you do not use the reference except pointer comparison. It's
fine, maybe a bit less usual, but as you mentioned other alternative
also does not look good, so fine for me.
> But the following looks awefull as well.
>> if (args.np != dev->of_node) {
>> of_node_put(args.np);
>> continue;
>> }
>> of_node_put(args.np);
>
Best regards,
Krzysztof