[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <57470934-d2db-a360-8347-4debe5830f7b@canonical.com>
Date: Wed, 7 Apr 2021 18:55:27 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
To: Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc: Nicolas Ferre <nicolas.ferre@...rochip.com>,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] memory: atmel-sdramc: check of_device_get_match_data()
return value
On 07/04/2021 18:19, Alexandre Belloni wrote:
> Hi,
>
> On 07/04/2021 17:44:47+0200, Krzysztof Kozlowski wrote:
>> If the driver is probed, the of_device_get_match_data() should not
>> return NULL, however for sanity check its return value.
>>
>
> As you say, there is no way this will ever be the case, I don't see the
> point of checking the return value, this adds 12 bytes for nothing...
>
> Maybe coverity should be fixed as there are many drivers making the same
> (true) assumption and I don't think this is worth the churn.
There are also several drivers having this check. To me an explicit NULL
check is better and more readable than non-obvious assumption that the
of_device_id table contains data for each entry and there is no other
bind method (like for OF+I2C drivers). Even if the case is not real,
this is nice, simple and explicit code.
Best regards,
Krzysztof
Powered by blists - more mailing lists