chiark / gitweb /
bootchart: Remove unneeded check for NULL
authorStefan Beller <stefanbeller@googlemail.com>
Sun, 29 Dec 2013 23:09:56 +0000 (00:09 +0100)
committerKay Sievers <kay@vrfy.org>
Mon, 30 Dec 2013 18:10:22 +0000 (19:10 +0100)
Directly before the changed line there is:

while ((parent->next_ps && parent->pid != ps->ppid))
parent = parent->next_ps;

which looks one element ahead of the list, hence we can rely on parent
being non null here.
If 'parent' were NULL at that while loop already, it would crash as we're
dereferencing 'parent' when checking for next_ps already.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
src/bootchart/store.c

index 7f86cfe976c77c7e23621f825582f8960b8aa582..b6ba11356192eacd205965cd1edf67fa4927bb93 100644 (file)
@@ -345,7 +345,7 @@ schedstat_next:
                         while ((parent->next_ps && parent->pid != ps->ppid))
                                 parent = parent->next_ps;
 
-                        if ((!parent) || (parent->pid != ps->ppid)) {
+                        if (parent->pid != ps->ppid) {
                                 /* orphan */
                                 ps->ppid = 1;
                                 parent = ps_first->next_ps;