diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2022-12-02 19:35:12 +0100 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2022-12-06 12:46:07 +0100 |
commit | fa1b9aa4492cc4f29178ef38ca0467c48714250e (patch) | |
tree | 199d06063719dd2a8bef6fb80579bc5a91378ac1 /drivers/pwm | |
parent | 4034e5944884dca1673e52cc392b07d0d35b6ff0 (diff) | |
download | linux-fa1b9aa4492cc4f29178ef38ca0467c48714250e.tar.gz |
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>
Diffstat (limited to 'drivers/pwm')
-rw-r--r-- | drivers/pwm/core.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index b43b24bd3c9f..61bacd8d9b44 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -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); |