Skip to content

Commit 73e4290

Browse files
Wang Haidavem330
authored andcommitted
atm: Use list_for_each_entry() to simplify code in resources.c
Convert list_for_each() to list_for_each_entry() where applicable. This simplifies the code. Reported-by: Hulk Robot <[email protected]> Signed-off-by: Wang Hai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3e98ae0 commit 73e4290

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

net/atm/resources.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
5252
static struct atm_dev *__atm_dev_lookup(int number)
5353
{
5454
struct atm_dev *dev;
55-
struct list_head *p;
5655

57-
list_for_each(p, &atm_devs) {
58-
dev = list_entry(p, struct atm_dev, dev_list);
56+
list_for_each_entry(dev, &atm_devs, dev_list) {
5957
if (dev->number == number) {
6058
atm_dev_hold(dev);
6159
return dev;
@@ -215,8 +213,7 @@ int atm_getnames(void __user *buf, int __user *iobuf_len)
215213
return -ENOMEM;
216214
}
217215
tmp_p = tmp_buf;
218-
list_for_each(p, &atm_devs) {
219-
dev = list_entry(p, struct atm_dev, dev_list);
216+
list_for_each_entry(dev, &atm_devs, dev_list) {
220217
*tmp_p++ = dev->number;
221218
}
222219
mutex_unlock(&atm_dev_mutex);

0 commit comments

Comments
 (0)