Message ID | 1463402840-17062-9-git-send-email-maxime.ripard@free-electrons.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Hi, On Mon, May 16, 2016 at 8:47 PM, Maxime Ripard <maxime.ripard@free-electrons.com> wrote: > In case of an error, our pointer to the drm_panel structure attached to our > encoder will hold an error pointer, not a NULL pointer. > > Make sure we check the right thing. > > Fixes: 29e57fab97fc ("drm: sun4i: Add RGB output") > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> > --- > drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c > index 923f55039cb1..b46d2c15dc95 100644 > --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c > +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c > @@ -217,7 +217,7 @@ int sun4i_rgb_init(struct drm_device *drm) > int ret; > > /* If we don't have a panel, there's no point in going on */ > - if (!tcon->panel) > + if (IS_ERR(tcon->panel)) Without the next patch, tcon->panel could be the result of of_drm_find_panel(), which could be NULL. Use IS_ERR_OR_NULL here, or reorder/squash the patches. Regards ChenYu > return -ENODEV; > > rgb = devm_kzalloc(drm->dev, sizeof(*rgb), GFP_KERNEL); > -- > 2.8.2 > -- To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, May 17, 2016 at 11:51:36AM +0800, Chen-Yu Tsai wrote: > Hi, > > On Mon, May 16, 2016 at 8:47 PM, Maxime Ripard > <maxime.ripard@free-electrons.com> wrote: > > In case of an error, our pointer to the drm_panel structure attached to our > > encoder will hold an error pointer, not a NULL pointer. > > > > Make sure we check the right thing. > > > > Fixes: 29e57fab97fc ("drm: sun4i: Add RGB output") > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> > > --- > > drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c > > index 923f55039cb1..b46d2c15dc95 100644 > > --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c > > +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c > > @@ -217,7 +217,7 @@ int sun4i_rgb_init(struct drm_device *drm) > > int ret; > > > > /* If we don't have a panel, there's no point in going on */ > > - if (!tcon->panel) > > + if (IS_ERR(tcon->panel)) > > Without the next patch, tcon->panel could be the result of of_drm_find_panel(), > which could be NULL. > > Use IS_ERR_OR_NULL here, or reorder/squash the patches. Switched the order, and applied both, thanks! Maxime
diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c index 923f55039cb1..b46d2c15dc95 100644 --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c @@ -217,7 +217,7 @@ int sun4i_rgb_init(struct drm_device *drm) int ret; /* If we don't have a panel, there's no point in going on */ - if (!tcon->panel) + if (IS_ERR(tcon->panel)) return -ENODEV; rgb = devm_kzalloc(drm->dev, sizeof(*rgb), GFP_KERNEL);
In case of an error, our pointer to the drm_panel structure attached to our encoder will hold an error pointer, not a NULL pointer. Make sure we check the right thing. Fixes: 29e57fab97fc ("drm: sun4i: Add RGB output") Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> --- drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)