platform/mellanox: mlxreg-hotplug: Remove redundant NULL-check
authorDaniil Dulov <d.dulov@aladdin.ru>
Wed, 6 Mar 2024 15:38:04 +0000 (18:38 +0300)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 12 Mar 2024 10:48:36 +0000 (12:48 +0200)
Pointer item is checked fo NULL at mlxreg_hotplug_work_helper() and then
it is dereferenced to produce dev_err().
This pointer is also dereferenced before calling this function and should
never be NULL except some piece of hardware is broken as it is said in
the comment before the check. So, this check can be safely removed.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: c6acad68eb2d ("platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface")
Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20240306153804.6509-1-d.dulov@aladdin.ru
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/mellanox/mlxreg-hotplug.c

index 5c022b258f91af91204f3eda15e2d34bb3da625e..0ce9fff1f7d4d41cf3891d26ae91bff45d87e891 100644 (file)
@@ -348,20 +348,6 @@ mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv,
        u32 regval, bit;
        int ret;
 
-       /*
-        * Validate if item related to received signal type is valid.
-        * It should never happen, excepted the situation when some
-        * piece of hardware is broken. In such situation just produce
-        * error message and return. Caller must continue to handle the
-        * signals from other devices if any.
-        */
-       if (unlikely(!item)) {
-               dev_err(priv->dev, "False signal: at offset:mask 0x%02x:0x%02x.\n",
-                       item->reg, item->mask);
-
-               return;
-       }
-
        /* Mask event. */
        ret = regmap_write(priv->regmap, item->reg + MLXREG_HOTPLUG_MASK_OFF,
                           0);