[PATCH 3/7] kernel-trace: Adjust two checks for null pointers in compatible_field()

From: SF Markus Elfring
Date: Fri May 05 2017 - 17:03:37 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 5 May 2017 20:00:11 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script âcheckpatch.plâ pointed information out like the following.

Comparison to NULL could be written !â

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
kernel/trace/trace_events_hist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index df566e21344d..36412deac24c 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -1324,7 +1324,7 @@ static bool compatible_field(struct ftrace_event_field *field,
{
if (field == test_field)
return true;
- if (field == NULL || test_field == NULL)
+ if (!field || !test_field)
return false;
if (strcmp(field->name, test_field->name) != 0)
return false;
--
2.12.2