Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/mellanox: Remove redundant 'NULL' check

Remove 'NULL' check for 'data->hpdev.client' in error flow of
mlxreg_lc_probe(). It cannot be 'NULL' at this point.

Fixes: b4b830a34d80 ("platform/mellanox: mlxreg-lc: Fix error flow and extend verbosity")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20220823201937.46855-5-vadimp@nvidia.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Vadim Pasternak and committed by
Hans de Goede
059209fd 1c8ee06b

+2 -4
+2 -4
drivers/platform/mellanox/mlxreg-lc.c
··· 893 893 regcache_sync_fail: 894 894 regmap_write_fail: 895 895 devm_regmap_init_i2c_fail: 896 - if (data->hpdev.client) { 897 - i2c_unregister_device(data->hpdev.client); 898 - data->hpdev.client = NULL; 899 - } 896 + i2c_unregister_device(data->hpdev.client); 897 + data->hpdev.client = NULL; 900 898 i2c_new_device_fail: 901 899 i2c_put_adapter(data->hpdev.adapter); 902 900 data->hpdev.adapter = NULL;