pwm: Don't initialize list head before calling list_add()
list_add() just overwrites the members of the element to add (here: chip->list) without any checks, even in the DEBUG_LIST case. So save the effort to initialize the list. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221117211143.3817381-5-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
4034e59448
commit
fa1b9aa449
@ -299,7 +299,6 @@ int pwmchip_add(struct pwm_chip *chip)
|
||||
radix_tree_insert(&pwm_tree, pwm->pwm, pwm);
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&chip->list);
|
||||
list_add(&chip->list, &pwm_chips);
|
||||
|
||||
mutex_unlock(&pwm_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user