From: Stefan Beller Date: Sun, 29 Dec 2013 23:09:56 +0000 (+0100) Subject: bootchart: Remove unneeded check for NULL X-Git-Tag: v209~591 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=226b735a745c1e9bbab24b47460d7304def9d38f;hp=818156512411835a4a7f070e6fec3d7b80e1f629 bootchart: Remove unneeded check for NULL 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 --- diff --git a/src/bootchart/store.c b/src/bootchart/store.c index 7f86cfe97..b6ba11356 100644 --- a/src/bootchart/store.c +++ b/src/bootchart/store.c @@ -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;