mlxreg_lc_probe() warn: variable dereferenced before check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Vadim,

The kernel test robot pointed me to the following warning in my tree:

drivers/platform/mellanox/mlxreg-lc.c:903 mlxreg_lc_probe() warn: variable dereferenced before check 'data->notifier' (see line 828)

I took a quick peek and data comes from:

        data = dev_get_platdata(&pdev->dev);

And then indeed after that if data != NULL data-> notifiers gets derefenced
unconditionally in the normal code path:

        /* Set event notification callback. */
        data->notifier->user_handler = mlxreg_lc_event_handler;
        data->notifier->handle = mlxreg_lc;

Where as the error exit path has:

        /* Clear event notification callback and handle. */
        if (data->notifier) {
                data->notifier->user_handler = NULL;
                data->notifier->handle = NULL;
        }

It seems to me that either both uses of data->notifier need a check;
or none of the two uses of data->notifier need a check ?

Can you take a look at this please?  (and cook up a patch ?)

Regards,

Hans





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux