diff mbox

[1/5] drm/gma500: fix error path in gma_intel_setup_gmbus()

Message ID 1455048677-19882-2-git-send-email-linux@rasmusvillemoes.dk (mailing list archive)
State New, archived
Headers show

Commit Message

Rasmus Villemoes Feb. 9, 2016, 8:11 p.m. UTC
The current code fails to call i2c_del_adapter on
dev_prev->gmbus[0].adapter, and if the for loop above failed already
at i==0, all hell breaks loose when we do the loop body for
i = -1,-2,...

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/gpu/drm/gma500/intel_gmbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andy Shevchenko Feb. 10, 2016, 6:41 a.m. UTC | #1
On Tue, Feb 9, 2016 at 10:11 PM, Rasmus Villemoes
<linux@rasmusvillemoes.dk> wrote:
> The current code fails to call i2c_del_adapter on
> dev_prev->gmbus[0].adapter, and if the for loop above failed already
> at i==0, all hell breaks loose when we do the loop body for
> i = -1,-2,...
>

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/gpu/drm/gma500/intel_gmbus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/gma500/intel_gmbus.c b/drivers/gpu/drm/gma500/intel_gmbus.c
> index 566d330aaeea..e7e22187c539 100644
> --- a/drivers/gpu/drm/gma500/intel_gmbus.c
> +++ b/drivers/gpu/drm/gma500/intel_gmbus.c
> @@ -436,7 +436,7 @@ int gma_intel_setup_gmbus(struct drm_device *dev)
>         return 0;
>
>  err:
> -       while (--i) {
> +       while (i--) {
>                 struct intel_gmbus *bus = &dev_priv->gmbus[i];
>                 i2c_del_adapter(&bus->adapter);
>         }
> --
> 2.1.4
>
Daniel Vetter Feb. 10, 2016, 7:26 a.m. UTC | #2
On Wed, Feb 10, 2016 at 08:41:17AM +0200, Andy Shevchenko wrote:
> On Tue, Feb 9, 2016 at 10:11 PM, Rasmus Villemoes
> <linux@rasmusvillemoes.dk> wrote:
> > The current code fails to call i2c_del_adapter on
> > dev_prev->gmbus[0].adapter, and if the for loop above failed already
> > at i==0, all hell breaks loose when we do the loop body for
> > i = -1,-2,...
> >
> 
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Applied to drm-misc, thanks.
-Daniel

> 
> > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> > ---
> >  drivers/gpu/drm/gma500/intel_gmbus.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/gma500/intel_gmbus.c b/drivers/gpu/drm/gma500/intel_gmbus.c
> > index 566d330aaeea..e7e22187c539 100644
> > --- a/drivers/gpu/drm/gma500/intel_gmbus.c
> > +++ b/drivers/gpu/drm/gma500/intel_gmbus.c
> > @@ -436,7 +436,7 @@ int gma_intel_setup_gmbus(struct drm_device *dev)
> >         return 0;
> >
> >  err:
> > -       while (--i) {
> > +       while (i--) {
> >                 struct intel_gmbus *bus = &dev_priv->gmbus[i];
> >                 i2c_del_adapter(&bus->adapter);
> >         }
> > --
> > 2.1.4
> >
> 
> 
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/gma500/intel_gmbus.c b/drivers/gpu/drm/gma500/intel_gmbus.c
index 566d330aaeea..e7e22187c539 100644
--- a/drivers/gpu/drm/gma500/intel_gmbus.c
+++ b/drivers/gpu/drm/gma500/intel_gmbus.c
@@ -436,7 +436,7 @@  int gma_intel_setup_gmbus(struct drm_device *dev)
 	return 0;
 
 err:
-	while (--i) {
+	while (i--) {
 		struct intel_gmbus *bus = &dev_priv->gmbus[i];
 		i2c_del_adapter(&bus->adapter);
 	}