[PATCH v3 058/108] pwm: imx27: Make use of devm_pwmchip_alloc() function

Philipp Zabel p.zabel at pengutronix.de
Tue Dec 5 04:50:26 PST 2023


On Di, 2023-12-05 at 13:14 +0100, Uwe Kleine-König wrote:
> Hello Philipp,
> 
> On Tue, Dec 05, 2023 at 12:49:19PM +0100, Philipp Zabel wrote:
> > On Di, 2023-11-21 at 14:50 +0100, Uwe Kleine-König wrote:
> > > @@ -306,13 +308,15 @@ MODULE_DEVICE_TABLE(of, pwm_imx27_dt_ids);
> > >  
> > >  static int pwm_imx27_probe(struct platform_device *pdev)
> > >  {
> > > +	struct pwm_chip *chip;
> > >  	struct pwm_imx27_chip *imx;
> > >  	int ret;
> > >  	u32 pwmcr;
> > >  
> > > -	imx = devm_kzalloc(&pdev->dev, sizeof(*imx), GFP_KERNEL);
> > > -	if (imx == NULL)
> > > -		return -ENOMEM;
> > > +	chip = devm_pwmchip_alloc(&pdev->dev, 1, sizeof(*imx));
> > > +	if (IS_ERR(chip))
> > > +		return PTR_ERR(chip);
> > > +	imx = pwmchip_priv(chip);
> > 
> > Please use to_pwm_imx27_chip() here. Otherwise,
> > 
> > Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>
> 
> Thanks. This is already fixed in my tree for this and a few other
> drivers. Currently the patch looks as follows:
> 
> 	https://git.pengutronix.de/cgit/ukl/linux/commit/?h=pwm-lifetime-tracking&id=4fa8c8a8661fa6d91de0368693d4a92907fb5359
> 
> The only other changes since this v3 is the usage of
> pwmchip_get_drvdata() instead of pwmchip_priv(). Can I keep your
> Reviewed-by for this new variant?

Yes.

regards
Philipp



More information about the linux-arm-kernel mailing list