There's no equivalent to devname in the Linux API, but it's required for barebox and not populating the pointer in struct pwm_chip will lead to a crash inside pwmchip_add. Check that the pointer is non-NULL to catch this case. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- drivers/pwm/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index a3f27708e6ef..976357e6062f 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -97,6 +97,9 @@ int pwmchip_add(struct pwm_chip *chip, struct device *dev) struct param_d *p; int ret; + if (!chip->devname) + return -EINVAL; + if (_find_pwm(chip->devname)) return -EBUSY; -- 2.39.2