Message ID | d0a1fc55-3ef6-444e-b3ef-fdc937d8d57a@kili.mountain (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/imx/lcdc: fix a NULL vs IS_ERR() bug in probe | expand |
On Wed, Mar 22, 2023 at 12:06:55PM +0300, Dan Carpenter wrote: > The devm_drm_dev_alloc() function returns error pointers. It never > returns NULL. Fix the check. > > Fixes: c87e859cdeb5 ("drm/imx/lcdc: Implement DRM driver for imx25") > Signed-off-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Thanks! Uwe
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> writes: > On Wed, Mar 22, 2023 at 12:06:55PM +0300, Dan Carpenter wrote: >> The devm_drm_dev_alloc() function returns error pointers. It never >> returns NULL. Fix the check. >> >> Fixes: c87e859cdeb5 ("drm/imx/lcdc: Implement DRM driver for imx25") >> Signed-off-by: Dan Carpenter <error27@gmail.com> > > Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > Pushed to drm-misc (drm-misc-next). Thanks!
On Sat, Apr 15, 2023 at 11:51:28PM +0200, Javier Martinez Canillas wrote: > Uwe Kleine-König <u.kleine-koenig@pengutronix.de> writes: > > > On Wed, Mar 22, 2023 at 12:06:55PM +0300, Dan Carpenter wrote: > >> The devm_drm_dev_alloc() function returns error pointers. It never > >> returns NULL. Fix the check. > >> > >> Fixes: c87e859cdeb5 ("drm/imx/lcdc: Implement DRM driver for imx25") > >> Signed-off-by: Dan Carpenter <error27@gmail.com> > > > > Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > > > > Pushed to drm-misc (drm-misc-next). Thanks! > This still hasn't hit linux-next (although the latest linux-next is from last Friday, Apr 28, so maybe it will soon?) regards, dan carpenter
diff --git a/drivers/gpu/drm/imx/lcdc/imx-lcdc.c b/drivers/gpu/drm/imx/lcdc/imx-lcdc.c index 24bc7b310367..fc1a4f6657c5 100644 --- a/drivers/gpu/drm/imx/lcdc/imx-lcdc.c +++ b/drivers/gpu/drm/imx/lcdc/imx-lcdc.c @@ -399,8 +399,8 @@ static int imx_lcdc_probe(struct platform_device *pdev) lcdc = devm_drm_dev_alloc(dev, &imx_lcdc_drm_driver, struct imx_lcdc, drm); - if (!lcdc) - return -ENOMEM; + if (IS_ERR(lcdc)) + return PTR_ERR(lcdc); drm = &lcdc->drm;
The devm_drm_dev_alloc() function returns error pointers. It never returns NULL. Fix the check. Fixes: c87e859cdeb5 ("drm/imx/lcdc: Implement DRM driver for imx25") Signed-off-by: Dan Carpenter <error27@gmail.com> --- drivers/gpu/drm/imx/lcdc/imx-lcdc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)