Hello, On Wed, Feb 14, 2024 at 10:31:54AM +0100, Uwe Kleine-König wrote: > @@ -256,9 +257,10 @@ struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base > if (WARN_ON(info->npwm > LPSS_MAX_PWMS)) > return ERR_PTR(-ENODEV); > > - lpwm = devm_kzalloc(dev, sizeof(*lpwm), GFP_KERNEL); > - if (!lpwm) > + chip = devm_pwmchip_alloc(dev, info->npwm, sizeof(*lpwm)); > + if (!chip) > return ERR_PTR(-ENOMEM); while adapting the patch for Andy's feedback I noticed this being wrong, devm_pwmchip_alloc() returns an error pointer and not NULL on failure. I'll squash the following change into the commit: diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c index 3247b420b67a..867e2bc8c601 100644 --- a/drivers/pwm/pwm-lpss.c +++ b/drivers/pwm/pwm-lpss.c @@ -258,8 +258,8 @@ struct pwm_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base, return ERR_PTR(-ENODEV); chip = devm_pwmchip_alloc(dev, info->npwm, sizeof(*lpwm)); - if (!chip) - return ERR_PTR(-ENOMEM); + if (IS_ERR(chip)) + return chip; lpwm = to_lpwm(chip); lpwm->regs = base; Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Attachment:
signature.asc
Description: PGP signature