From: Andrew Morton Date: Wed, 20 Feb 2013 02:16:33 +0000 (+1100) Subject: drivers-char-miscc-misc_register-do-not-loop-on-misc_list-unconditionally-fix X-Git-Tag: next-20130220~1^2~103 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1f6f23dd36170e4667a731ab59ff1c03e90f8cf1;p=karo-tx-linux.git drivers-char-miscc-misc_register-do-not-loop-on-misc_list-unconditionally-fix reduce scope of local `c' Cc: "Dae S. Kim" Cc: Arnd Bergmann Cc: Dae S. Kim Cc: Greg KH Signed-off-by: Andrew Morton --- diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 7b262b69c653..190d4423653f 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -183,7 +183,6 @@ static const struct file_operations misc_fops = { int misc_register(struct miscdevice * misc) { - struct miscdevice *c; dev_t dev; int err = 0; @@ -200,6 +199,8 @@ int misc_register(struct miscdevice * misc) misc->minor = DYNAMIC_MINORS - i - 1; set_bit(i, misc_minors); } else { + struct miscdevice *c; + list_for_each_entry(c, &misc_list, list) { if (c->minor == misc->minor) { mutex_unlock(&misc_mtx);