Re: [PATCH] platform/mellanox: mlxreg-lc: Check before variable dereferenced

From: Dan Carpenter
Date: Thu Nov 30 2023 - 06:47:42 EST


On Thu, Nov 30, 2023 at 05:44:07PM +0800, Yu Sun wrote:
> there is a warning saying variable dereferenced before
> check 'data->notifier' in line 828.
> add "for(data->notifier)" before variable deferenced.
^^^
Should have been "if (data->notifier)".

>
> Signed-off-by: Yu Sun <u202112062@xxxxxxxxxxx>
> Reviewed-by: Dongliang Mu <dzm91@xxxxxxxxxxx>
> Reviewed-by: Dan Carpenter <error27@xxxxxxxxx>

I didn't really explicitly give a Reviewed-by tag for this patch.
https://groups.google.com/g/hust-os-kernel-patches/c/c5hUaYIDcII/m/h4aFS7PkCQAJ
I also said that I thought it looked correct but that it needed a Fixes:
tag however the Fixes tag I suggested was wrong.

Looking at it now, the correct Fixes tag would be:
Fixes: 1c8ee06b637f ("platform/mellanox: Remove unnecessary code")

That commit says that the NULL check is not required. So now I'm
confused. On the one hand, the impulse is to trust the maintainer, but
on the other hand my review suggested that the NULL check might be
required.

regards,
dan carpenter