Re: [PATCH] firmware: arm_scmi: Fix late checks on pointer dereference
From: Dan Carpenter
Date: Wed May 04 2022 - 02:45:15 EST
On Tue, May 03, 2022 at 01:10:47PM +0100, Cristian Marussi wrote:
> A few dereferences could happen before the iterator pointer argument was
> checked for NULL, causing the following smatch warnings:
>
> drivers/firmware/arm_scmi/driver.c:1214 scmi_iterator_run() warn: variable
> dereferenced before check 'i' (see line 1210)
>
> Fix by moving the checks early and dropping some unneeded local references.
>
> No functional change.
If there is no chance these can be NULL then a different option is to
just delete the NULL checks.
regards,
dan carpenter