2023-12-22 04:42:42

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: stm32/crc32 - fix parsing list of devices

On Fri, Dec 15, 2023 at 12:17:24PM +0100, Thomas Bourgoin wrote:
> smatch warnings:
> drivers/crypto/stm32/stm32-crc32.c:108 stm32_crc_get_next_crc() warn:
> can 'crc' even be NULL?
>
> Use list_first_entry_or_null instead of list_first_entry to retrieve
> the first device registered.
> The function list_first_entry always return a non NULL pointer even if
> the list is empty. Hence checking if the pointer returned is NULL does
> not tell if the list is empty or not.
>
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/r/[email protected]/
> Reported-by: Dan Carpenter <[email protected]>
> Closes: https://lore.kernel.org/r/[email protected]/
> Signed-off-by: Thomas Bourgoin <[email protected]>
> ---
> drivers/crypto/stm32/stm32-crc32.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt