All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>,
	Ludovic Desroches <ludovic.desroches@microchip.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] memory: atmel-sdramc: check of_device_get_match_data() return value
Date: Wed, 7 Apr 2021 18:55:27 +0200	[thread overview]
Message-ID: <57470934-d2db-a360-8347-4debe5830f7b@canonical.com> (raw)
In-Reply-To: <YG3boJNqAoNCBeIB@piout.net>

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

WARNING: multiple messages have this Message-ID (diff)
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] memory: atmel-sdramc: check of_device_get_match_data() return value
Date: Wed, 7 Apr 2021 18:55:27 +0200	[thread overview]
Message-ID: <57470934-d2db-a360-8347-4debe5830f7b@canonical.com> (raw)
In-Reply-To: <YG3boJNqAoNCBeIB@piout.net>

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-04-07 16:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 15:44 [PATCH] memory: atmel-sdramc: check of_device_get_match_data() return value Krzysztof Kozlowski
2021-04-07 15:44 ` Krzysztof Kozlowski
2021-04-07 16:19 ` Alexandre Belloni
2021-04-07 16:19   ` Alexandre Belloni
2021-04-07 16:55   ` Krzysztof Kozlowski [this message]
2021-04-07 16:55     ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57470934-d2db-a360-8347-4debe5830f7b@canonical.com \
    --to=krzysztof.kozlowski@canonical.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=nicolas.ferre@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.