From: Rasmus Villemoes Date: Tue, 9 Feb 2016 20:11:12 +0000 (+0100) Subject: drm/gma500: fix error path in gma_intel_setup_gmbus() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=52dfa12e45510fce566fb240135420d7a0b5d0e6;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/gma500: fix error path in gma_intel_setup_gmbus() 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 Link: http://patchwork.freedesktop.org/patch/msgid/1455048677-19882-2-git-send-email-linux@rasmusvillemoes.dk Reviewed-by: Andy Shevchenko Signed-off-by: Daniel Vetter --- 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); }