Skip to content

Commit faa5f5d

Browse files
groeckdavem330
authored andcommitted
net/sched: taprio: Drop unnecessary NULL check after container_of
The rcu_head pointer passed to taprio_free_sched_cb is never NULL. That means that the result of container_of() operations on it is also never NULL, even though rcu_head is the first element of the structure embedding it. On top of that, it is misleading to perform a NULL check on the result of container_of() because the position of the contained element could change, which would make the check invalid. Remove the unnecessary NULL check. This change was made automatically with the following Coccinelle script. @@ type t; identifier v; statement s; @@ <+... ( t v = container_of(...); | v = container_of(...); ) ... when != v - if (\( !v \| v == NULL \) ) s ...+> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cac6fb0 commit faa5f5d

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

net/sched/sch_taprio.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@ static void taprio_free_sched_cb(struct rcu_head *head)
114114
struct sched_gate_list *sched = container_of(head, struct sched_gate_list, rcu);
115115
struct sched_entry *entry, *n;
116116

117-
if (!sched)
118-
return;
119-
120117
list_for_each_entry_safe(entry, n, &sched->entries, list) {
121118
list_del(&entry->list);
122119
kfree(entry);

0 commit comments

Comments
 (0)