Commit f9c3fe55 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Zheng Zengkai
Browse files

pwm: lpc18xx-sct: Initialize driver data and hardware before pwmchip_add()

stable inclusion
from stable-v5.10.110
commit c0b3c06414c39ef473a9274f173c3737ddb09d7b
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c0b3c06414c39ef473a9274f173c3737ddb09d7b



--------------------------------

[ Upstream commit 0401f24c ]

When a driver calls pwmchip_add() it has to be prepared to immediately
get its callbacks called. So move allocation of driver data and hardware
initialization before the call to pwmchip_add().

This fixes a potential NULL pointer exception and a race condition on
register writes.

Fixes: 841e6f90 ("pwm: NXP LPC18xx PWM/SCT driver")
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarYu Liao <liaoyu15@huawei.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 5100a52d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment