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.
Remember this, 'if (data->notifier)'
>
Add a fixes tag here. Dan has provided a correct tag for you, and you
can paste it here.
To find this tag, run command:
$ git blame drivers/platform/mellanox/mlxreg-lc.c -L 828,829
and you will get the result:
1c8ee06b637f0 (Vadim Pasternak 2022-08-23 23:19:36 +0300 828) data->notifier->user_handler = mlxreg_lc_event_handler;
1c8ee06b637f0 (Vadim Pasternak 2022-08-23 23:19:36 +0300 829) data->notifier->handle = mlxreg_lc;
So '1c8ee06b637f0' is the commit hash you want, and then:
$ git log --pretty="Fixes: %h (\"%s\")" 1c8ee06b637f0 -1
here we get the tag you need:
Fixes: 1c8ee06b637f ("platform/mellanox: Remove unnecessary code")
You can refer to the link below:
https://ixy0caf7465.feishu.cn/wiki/K9zVw6nGAicMRCkaM1fcWx3Onhh#GKiCdgWKuoCwq0xikifcbDaenFc
You need to delete the above line according to Dan. Please notice that
we only add the 'Reviewed-by' tag only if the reviewer reply to your
patch and contains the tag.
Besides, Dan's commonly used email address is
dan.ca...@linaro.org now :)
You can refer to the link below for details:
https://ixy0caf7465.feishu.cn/wiki/K9zVw6nGAicMRCkaM1fcWx3Onhh#T2Med2qQmoIWcsxqmOichbAIncc
> ---
> drivers/platform/mellanox/mlxreg-lc.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c
> index 43d119e3a473..e92add40750b 100644
> --- a/drivers/platform/mellanox/mlxreg-lc.c
> +++ b/drivers/platform/mellanox/mlxreg-lc.c
> @@ -824,9 +824,12 @@ static int mlxreg_lc_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> mutex_init(&mlxreg_lc->lock);
> - /* Set event notification callback. */
> - data->notifier->user_handler = mlxreg_lc_event_handler;
> - data->notifier->handle = mlxreg_lc;
> +
> + if (data->notifier) {
> + /* Set event notification callback. */
> + data->notifier->user_handler = mlxreg_lc_event_handler;
> + data->notifier->handle = mlxreg_lc;
> + }
>
> data->hpdev.adapter = i2c_get_adapter(data->
hpdev.nr);
> if (!data->hpdev.adapter) {
> --
> 2.42.0
The author of the previous commit has confirmed that we need a NULL
check here. So just fix up this patch and send a v2 version. If you are
not sure, you can send the patch to our private mailing list first.
--
Appreciate for your effors to our contribution group!
Regards,
Yalong Zou
HUST CSE