* [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks @ 2022-08-23 20:19 Vadim Pasternak 2022-08-23 20:19 ` [PATCH platform 1/4] platform/mellanox: mlxreg-lc: Fix coverity warning Vadim Pasternak ` (4 more replies) 0 siblings, 5 replies; 7+ messages in thread From: Vadim Pasternak @ 2022-08-23 20:19 UTC (permalink / raw) To: hdegoede; +Cc: dan.carpenter, platform-driver-x86, Vadim Pasternak The patch set includes fixes for several issues: Patch #1: fixes coverity issue. Patch #2: fixes locking dependency issue. Patches #3-#4: remove unnecessary code. Vadim Pasternak (4): platform/mellanox: mlxreg-lc: Fix coverity warning platform/mellanox: mlxreg-lc: Fix locking issue platform/mellanox: Remove unnecessary code platform/mellanox: Remove redundant 'NULL' check drivers/platform/mellanox/mlxreg-lc.c | 53 ++++++++++++++++----------- 1 file changed, 31 insertions(+), 22 deletions(-) -- 2.20.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH platform 1/4] platform/mellanox: mlxreg-lc: Fix coverity warning 2022-08-23 20:19 [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Vadim Pasternak @ 2022-08-23 20:19 ` Vadim Pasternak 2022-08-23 20:19 ` [PATCH platform 2/4] platform/mellanox: mlxreg-lc: Fix locking issue Vadim Pasternak ` (3 subsequent siblings) 4 siblings, 0 replies; 7+ messages in thread From: Vadim Pasternak @ 2022-08-23 20:19 UTC (permalink / raw) To: hdegoede; +Cc: dan.carpenter, platform-driver-x86, Vadim Pasternak Fix smatch warning: drivers/platform/mellanox/mlxreg-lc.c:866 mlxreg_lc_probe() warn: passing zero to 'PTR_ERR' by removing 'err = PTR_ERR(regmap)'. Fixes: b4b830a34d80 ("platform/mellanox: mlxreg-lc: Fix error flow and extend verbosity") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> --- drivers/platform/mellanox/mlxreg-lc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c index 55834ccb4ac7..9a1bfcd24317 100644 --- a/drivers/platform/mellanox/mlxreg-lc.c +++ b/drivers/platform/mellanox/mlxreg-lc.c @@ -863,7 +863,6 @@ static int mlxreg_lc_probe(struct platform_device *pdev) if (err) { dev_err(&pdev->dev, "Failed to sync regmap for client %s at bus %d at addr 0x%02x\n", data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr); - err = PTR_ERR(regmap); goto regcache_sync_fail; } -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH platform 2/4] platform/mellanox: mlxreg-lc: Fix locking issue 2022-08-23 20:19 [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Vadim Pasternak 2022-08-23 20:19 ` [PATCH platform 1/4] platform/mellanox: mlxreg-lc: Fix coverity warning Vadim Pasternak @ 2022-08-23 20:19 ` Vadim Pasternak 2022-09-01 12:48 ` Hans de Goede 2022-08-23 20:19 ` [PATCH platform 3/4] platform/mellanox: Remove unnecessary code Vadim Pasternak ` (2 subsequent siblings) 4 siblings, 1 reply; 7+ messages in thread From: Vadim Pasternak @ 2022-08-23 20:19 UTC (permalink / raw) To: hdegoede; +Cc: dan.carpenter, platform-driver-x86, Vadim Pasternak Fix locking issues: - mlxreg_lc_state_update() takes a lock when set or clear "MLXREG_LC_POWERED". - All the devices can be deleted before MLXREG_LC_POWERED flag is cleared. To fix it: - Add lock() / unlock() at the beginning / end of mlxreg_lc_event_handler() and remove locking from mlxreg_lc_power_on_off() and mlxreg_lc_enable_disable() - Add locked version of mlxreg_lc_state_update() - mlxreg_lc_state_update_locked() for using outside mlxreg_lc_event_handler(). (2) Remove redundant NULL check for of if 'data->notifier'. Fixes: 62f9529b8d5c87b ("platform/mellanox: mlxreg-lc: Add initial support for Nvidia line card devices") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> --- drivers/platform/mellanox/mlxreg-lc.c | 37 ++++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c index 9a1bfcd24317..e578c7bc060b 100644 --- a/drivers/platform/mellanox/mlxreg-lc.c +++ b/drivers/platform/mellanox/mlxreg-lc.c @@ -460,8 +460,6 @@ static int mlxreg_lc_power_on_off(struct mlxreg_lc *mlxreg_lc, u8 action) u32 regval; int err; - mutex_lock(&mlxreg_lc->lock); - err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, ®val); if (err) goto regmap_read_fail; @@ -474,7 +472,6 @@ static int mlxreg_lc_power_on_off(struct mlxreg_lc *mlxreg_lc, u8 action) err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, regval); regmap_read_fail: - mutex_unlock(&mlxreg_lc->lock); return err; } @@ -491,8 +488,6 @@ static int mlxreg_lc_enable_disable(struct mlxreg_lc *mlxreg_lc, bool action) * line card which is already has been enabled. Disabling does not affect the disabled line * card. */ - mutex_lock(&mlxreg_lc->lock); - err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, ®val); if (err) goto regmap_read_fail; @@ -505,7 +500,6 @@ static int mlxreg_lc_enable_disable(struct mlxreg_lc *mlxreg_lc, bool action) err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, regval); regmap_read_fail: - mutex_unlock(&mlxreg_lc->lock); return err; } @@ -537,6 +531,15 @@ mlxreg_lc_sn4800_c16_config_init(struct mlxreg_lc *mlxreg_lc, void *regmap, static void mlxreg_lc_state_update(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) +{ + if (action) + mlxreg_lc->state |= state; + else + mlxreg_lc->state &= ~state; +} + +static void +mlxreg_lc_state_update_locked(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) { mutex_lock(&mlxreg_lc->lock); @@ -560,8 +563,11 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, dev_info(mlxreg_lc->dev, "linecard#%d state %d event kind %d action %d\n", mlxreg_lc->data->slot, mlxreg_lc->state, kind, action); - if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) + mutex_lock(&mlxreg_lc->lock); + if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) { + mutex_unlock(&mlxreg_lc->lock); return 0; + } switch (kind) { case MLXREG_HOTPLUG_LC_SYNCED: @@ -574,7 +580,7 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, if (!(mlxreg_lc->state & MLXREG_LC_POWERED) && action) { err = mlxreg_lc_power_on_off(mlxreg_lc, 1); if (err) - return err; + goto mlxreg_lc_power_on_off_fail; } /* In case line card is configured - enable it. */ if (mlxreg_lc->state & MLXREG_LC_CONFIGURED && action) @@ -588,12 +594,13 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, /* In case line card is configured - enable it. */ if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) err = mlxreg_lc_enable_disable(mlxreg_lc, 1); + mutex_unlock(&mlxreg_lc->lock); return err; } err = mlxreg_lc_create_static_devices(mlxreg_lc, mlxreg_lc->main_devs, mlxreg_lc->main_devs_num); if (err) - return err; + goto mlxreg_lc_create_static_devices_fail; /* In case line card is already in ready state - enable it. */ if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) @@ -620,6 +627,10 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, break; } +mlxreg_lc_power_on_off_fail: +mlxreg_lc_create_static_devices_fail: + mutex_unlock(&mlxreg_lc->lock); + return err; } @@ -665,7 +676,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, if (err) goto mlxreg_lc_create_static_devices_failed; - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_POWERED, 1); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_POWERED, 1); } /* Verify if line card is synchronized. */ @@ -676,7 +687,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, /* Power on line card if necessary. */ if (regval & mlxreg_lc->data->mask) { mlxreg_lc->state |= MLXREG_LC_SYNCED; - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_SYNCED, 1); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_SYNCED, 1); if (mlxreg_lc->state & ~MLXREG_LC_POWERED) { err = mlxreg_lc_power_on_off(mlxreg_lc, 1); if (err) @@ -684,7 +695,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, } } - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); return 0; @@ -904,6 +915,8 @@ static int mlxreg_lc_remove(struct platform_device *pdev) struct mlxreg_core_data *data = dev_get_platdata(&pdev->dev); struct mlxreg_lc *mlxreg_lc = platform_get_drvdata(pdev); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 0); + /* * Probing and removing are invoked by hotplug events raised upon line card insertion and * removing. If probing procedure fails all data is cleared. However, hotplug event still -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH platform 2/4] platform/mellanox: mlxreg-lc: Fix locking issue 2022-08-23 20:19 ` [PATCH platform 2/4] platform/mellanox: mlxreg-lc: Fix locking issue Vadim Pasternak @ 2022-09-01 12:48 ` Hans de Goede 0 siblings, 0 replies; 7+ messages in thread From: Hans de Goede @ 2022-09-01 12:48 UTC (permalink / raw) To: Vadim Pasternak; +Cc: dan.carpenter, platform-driver-x86 Hi, On 8/23/22 22:19, Vadim Pasternak wrote: > Fix locking issues: > - mlxreg_lc_state_update() takes a lock when set or clear > "MLXREG_LC_POWERED". > - All the devices can be deleted before MLXREG_LC_POWERED flag is cleared. > > To fix it: > - Add lock() / unlock() at the beginning / end of > mlxreg_lc_event_handler() and remove locking from > mlxreg_lc_power_on_off() and mlxreg_lc_enable_disable() > - Add locked version of mlxreg_lc_state_update() - > mlxreg_lc_state_update_locked() for using outside > mlxreg_lc_event_handler(). > > (2) Remove redundant NULL check for of if 'data->notifier'. > > Fixes: 62f9529b8d5c87b ("platform/mellanox: mlxreg-lc: Add initial support for Nvidia line card devices") > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> > --- > drivers/platform/mellanox/mlxreg-lc.c | 37 ++++++++++++++++++--------- > 1 file changed, 25 insertions(+), 12 deletions(-) > > diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c > index 9a1bfcd24317..e578c7bc060b 100644 > --- a/drivers/platform/mellanox/mlxreg-lc.c > +++ b/drivers/platform/mellanox/mlxreg-lc.c > @@ -460,8 +460,6 @@ static int mlxreg_lc_power_on_off(struct mlxreg_lc *mlxreg_lc, u8 action) > u32 regval; > int err; > > - mutex_lock(&mlxreg_lc->lock); > - > err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, ®val); > if (err) > goto regmap_read_fail; > @@ -474,7 +472,6 @@ static int mlxreg_lc_power_on_off(struct mlxreg_lc *mlxreg_lc, u8 action) > err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, regval); > > regmap_read_fail: > - mutex_unlock(&mlxreg_lc->lock); > return err; > } > > @@ -491,8 +488,6 @@ static int mlxreg_lc_enable_disable(struct mlxreg_lc *mlxreg_lc, bool action) > * line card which is already has been enabled. Disabling does not affect the disabled line > * card. > */ > - mutex_lock(&mlxreg_lc->lock); > - > err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, ®val); > if (err) > goto regmap_read_fail; > @@ -505,7 +500,6 @@ static int mlxreg_lc_enable_disable(struct mlxreg_lc *mlxreg_lc, bool action) > err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, regval); > > regmap_read_fail: > - mutex_unlock(&mlxreg_lc->lock); > return err; > } > > @@ -537,6 +531,15 @@ mlxreg_lc_sn4800_c16_config_init(struct mlxreg_lc *mlxreg_lc, void *regmap, > > static void > mlxreg_lc_state_update(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) > +{ > + if (action) > + mlxreg_lc->state |= state; > + else > + mlxreg_lc->state &= ~state; > +} > + > +static void > +mlxreg_lc_state_update_locked(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) > { > mutex_lock(&mlxreg_lc->lock); > > @@ -560,8 +563,11 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, > dev_info(mlxreg_lc->dev, "linecard#%d state %d event kind %d action %d\n", > mlxreg_lc->data->slot, mlxreg_lc->state, kind, action); > > - if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) > + mutex_lock(&mlxreg_lc->lock); > + if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) { > + mutex_unlock(&mlxreg_lc->lock); So here you are unlocking before return. > return 0; > + } > > switch (kind) { > case MLXREG_HOTPLUG_LC_SYNCED: > @@ -574,7 +580,7 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, > if (!(mlxreg_lc->state & MLXREG_LC_POWERED) && action) { > err = mlxreg_lc_power_on_off(mlxreg_lc, 1); > if (err) > - return err; > + goto mlxreg_lc_power_on_off_fail; Yet here you use a goto (better IMHO). > } > /* In case line card is configured - enable it. */ > if (mlxreg_lc->state & MLXREG_LC_CONFIGURED && action) > @@ -588,12 +594,13 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, > /* In case line card is configured - enable it. */ > if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) > err = mlxreg_lc_enable_disable(mlxreg_lc, 1); > + mutex_unlock(&mlxreg_lc->lock); and here is another unlocking before return. > return err; > } > err = mlxreg_lc_create_static_devices(mlxreg_lc, mlxreg_lc->main_devs, > mlxreg_lc->main_devs_num); > if (err) > - return err; > + goto mlxreg_lc_create_static_devices_fail; and here is an other goto. This is not very consistent. Can you please switch to goto-s everywhere? Preferable with just a simply single "out" label? I always prefer the goto-s here so that the function has a single entry + exit point and we can easily see that the lock + unlock is balanced since there is only 1 of each. Regards, Hans > > /* In case line card is already in ready state - enable it. */ > if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) > @@ -620,6 +627,10 @@ static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, > break; > } > > +mlxreg_lc_power_on_off_fail: > +mlxreg_lc_create_static_devices_fail: > + mutex_unlock(&mlxreg_lc->lock); > + > return err; > } > > @@ -665,7 +676,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, > if (err) > goto mlxreg_lc_create_static_devices_failed; > > - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_POWERED, 1); > + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_POWERED, 1); > } > > /* Verify if line card is synchronized. */ > @@ -676,7 +687,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, > /* Power on line card if necessary. */ > if (regval & mlxreg_lc->data->mask) { > mlxreg_lc->state |= MLXREG_LC_SYNCED; > - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_SYNCED, 1); > + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_SYNCED, 1); > if (mlxreg_lc->state & ~MLXREG_LC_POWERED) { > err = mlxreg_lc_power_on_off(mlxreg_lc, 1); > if (err) > @@ -684,7 +695,7 @@ static int mlxreg_lc_completion_notify(void *handle, struct i2c_adapter *parent, > } > } > > - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); > + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); > > return 0; > > @@ -904,6 +915,8 @@ static int mlxreg_lc_remove(struct platform_device *pdev) > struct mlxreg_core_data *data = dev_get_platdata(&pdev->dev); > struct mlxreg_lc *mlxreg_lc = platform_get_drvdata(pdev); > > + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 0); > + > /* > * Probing and removing are invoked by hotplug events raised upon line card insertion and > * removing. If probing procedure fails all data is cleared. However, hotplug event still ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH platform 3/4] platform/mellanox: Remove unnecessary code 2022-08-23 20:19 [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Vadim Pasternak 2022-08-23 20:19 ` [PATCH platform 1/4] platform/mellanox: mlxreg-lc: Fix coverity warning Vadim Pasternak 2022-08-23 20:19 ` [PATCH platform 2/4] platform/mellanox: mlxreg-lc: Fix locking issue Vadim Pasternak @ 2022-08-23 20:19 ` Vadim Pasternak 2022-08-23 20:19 ` [PATCH platform 4/4] platform/mellanox: Remove redundant 'NULL' check Vadim Pasternak 2022-09-01 12:46 ` [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Hans de Goede 4 siblings, 0 replies; 7+ messages in thread From: Vadim Pasternak @ 2022-08-23 20:19 UTC (permalink / raw) To: hdegoede; +Cc: dan.carpenter, platform-driver-x86, Vadim Pasternak Remove redundant 'NULL' check for of if 'data->notifier'. Replace 'return err' by 'return 0' in mlxreg_lc_probe(). Fixes: 62f9529b8d5c87b ("platform/mellanox: mlxreg-lc: Add initial support for Nvidia line card devices") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> --- drivers/platform/mellanox/mlxreg-lc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c index e578c7bc060b..1e0c3ddc46cd 100644 --- a/drivers/platform/mellanox/mlxreg-lc.c +++ b/drivers/platform/mellanox/mlxreg-lc.c @@ -825,10 +825,9 @@ static int mlxreg_lc_probe(struct platform_device *pdev) mutex_init(&mlxreg_lc->lock); /* Set event notification callback. */ - if (data->notifier) { - data->notifier->user_handler = mlxreg_lc_event_handler; - data->notifier->handle = mlxreg_lc; - } + 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) { dev_err(&pdev->dev, "Failed to get adapter for bus %d\n", @@ -888,7 +887,7 @@ static int mlxreg_lc_probe(struct platform_device *pdev) if (err) goto mlxreg_lc_config_init_fail; - return err; + return 0; mlxreg_lc_config_init_fail: regcache_sync_fail: -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH platform 4/4] platform/mellanox: Remove redundant 'NULL' check 2022-08-23 20:19 [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Vadim Pasternak ` (2 preceding siblings ...) 2022-08-23 20:19 ` [PATCH platform 3/4] platform/mellanox: Remove unnecessary code Vadim Pasternak @ 2022-08-23 20:19 ` Vadim Pasternak 2022-09-01 12:46 ` [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Hans de Goede 4 siblings, 0 replies; 7+ messages in thread From: Vadim Pasternak @ 2022-08-23 20:19 UTC (permalink / raw) To: hdegoede; +Cc: dan.carpenter, platform-driver-x86, Vadim Pasternak 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> --- drivers/platform/mellanox/mlxreg-lc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mellanox/mlxreg-lc.c index 1e0c3ddc46cd..1e071df4c9f5 100644 --- a/drivers/platform/mellanox/mlxreg-lc.c +++ b/drivers/platform/mellanox/mlxreg-lc.c @@ -893,10 +893,8 @@ static int mlxreg_lc_probe(struct platform_device *pdev) regcache_sync_fail: regmap_write_fail: devm_regmap_init_i2c_fail: - if (data->hpdev.client) { - i2c_unregister_device(data->hpdev.client); - data->hpdev.client = NULL; - } + i2c_unregister_device(data->hpdev.client); + data->hpdev.client = NULL; i2c_new_device_fail: i2c_put_adapter(data->hpdev.adapter); data->hpdev.adapter = NULL; -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks 2022-08-23 20:19 [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Vadim Pasternak ` (3 preceding siblings ...) 2022-08-23 20:19 ` [PATCH platform 4/4] platform/mellanox: Remove redundant 'NULL' check Vadim Pasternak @ 2022-09-01 12:46 ` Hans de Goede 4 siblings, 0 replies; 7+ messages in thread From: Hans de Goede @ 2022-09-01 12:46 UTC (permalink / raw) To: Vadim Pasternak; +Cc: dan.carpenter, platform-driver-x86 Hi All, On 8/23/22 22:19, Vadim Pasternak wrote: > The patch set includes fixes for several issues: > Patch #1: fixes coverity issue. > Patch #2: fixes locking dependency issue. > Patches #3-#4: remove unnecessary code. Thank you for your patch-series, I've applied the series to my review-hans branch: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans I will also send this out as part of my next fixes pull-req for 6.0-rc#. Note I do have one code-style remark to patch 2/4, since I want to add this to my fixes pull-req I've taken 2/4 as is. Please send a follow-up (incremental) patch addressing the code-style issue. See my reply to patch 2/4. Regards, Hans > > Vadim Pasternak (4): > platform/mellanox: mlxreg-lc: Fix coverity warning > platform/mellanox: mlxreg-lc: Fix locking issue > platform/mellanox: Remove unnecessary code > platform/mellanox: Remove redundant 'NULL' check > > drivers/platform/mellanox/mlxreg-lc.c | 53 ++++++++++++++++----------- > 1 file changed, 31 insertions(+), 22 deletions(-) > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-09-01 12:48 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-08-23 20:19 [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Vadim Pasternak 2022-08-23 20:19 ` [PATCH platform 1/4] platform/mellanox: mlxreg-lc: Fix coverity warning Vadim Pasternak 2022-08-23 20:19 ` [PATCH platform 2/4] platform/mellanox: mlxreg-lc: Fix locking issue Vadim Pasternak 2022-09-01 12:48 ` Hans de Goede 2022-08-23 20:19 ` [PATCH platform 3/4] platform/mellanox: Remove unnecessary code Vadim Pasternak 2022-08-23 20:19 ` [PATCH platform 4/4] platform/mellanox: Remove redundant 'NULL' check Vadim Pasternak 2022-09-01 12:46 ` [PATCH platform 0/4] Fixes for issues with coverity, locking, redundant checks Hans de Goede
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).