[PATCH] MSR: fix badzero.cocci warnings

kbuild test robot
2016-02-26T01:06:44Z

arch/x86/kernel/msr_whitelist.c:200:18-19: WARNING comparing pointer to 0
arch/x86/kernel/msr_whitelist.c:203:27-28: WARNING comparing pointer to 0

Compare pointer-typed values to NULL rather than 0

Semantic patch information:
This makes an effort to choose between !x and x == NULL. !x is used
if it has previously been used with the function used to initialize x.
This relies on type information. More type information can be obtained
using the option -all_includes and the option -I to specify an
include path.

Generated by: scripts/coccinelle/null/badzero.cocci

CC: Marty McFadden <mcfadden8@llnl.gov>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

msr_whitelist.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/msr_whitelist.c
+++ b/arch/x86/kernel/msr_whitelist.c
@@ -197,10 +197,10 @@ static const struct file_operations fops

static void delete_whitelist(void)
{
- if (whitelist == 0)
+ if (whitelist == NULL)
return;

- if (whitelist->msrdata != 0)
+ if (whitelist->msrdata != NULL)
kfree(whitelist->msrdata);

kfree(whitelist);