Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clockevents: Use dedicated list iterator variable

To move the list iterator variable into the list_for_each_entry_*()
macro in the future it should be avoided to use the list iterator
variable after the loop body.

To *never* use the list iterator variable after the loop it was
concluded to use a separate iterator variable.

Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/
Link: https://lore.kernel.org/r/20220331215707.883957-1-jakobkoschel@gmail.com

authored by

Jakob Koschel and committed by
Thomas Gleixner
2966a991 a2026e44

+5 -4
+5 -4
kernel/time/clockevents.c
··· 690 690 { 691 691 char name[CS_NAME_LEN]; 692 692 ssize_t ret = sysfs_get_uname(buf, name, count); 693 - struct clock_event_device *ce; 693 + struct clock_event_device *ce = NULL, *iter; 694 694 695 695 if (ret < 0) 696 696 return ret; ··· 698 698 ret = -ENODEV; 699 699 mutex_lock(&clockevents_mutex); 700 700 raw_spin_lock_irq(&clockevents_lock); 701 - list_for_each_entry(ce, &clockevent_devices, list) { 702 - if (!strcmp(ce->name, name)) { 703 - ret = __clockevents_try_unbind(ce, dev->id); 701 + list_for_each_entry(iter, &clockevent_devices, list) { 702 + if (!strcmp(iter->name, name)) { 703 + ret = __clockevents_try_unbind(iter, dev->id); 704 + ce = iter; 704 705 break; 705 706 } 706 707 }