HID: picoLCD: fix a NULL test in picolcd_raw_cir()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 7 Sep 2012 06:47:41 +0000 (09:47 +0300)
committerJiri Kosina <jkosina@suse.cz>
Sat, 8 Sep 2012 19:19:07 +0000 (21:19 +0200)
Smatch complains that the NULL checking in this function is not
consistent and could lead to a NULL dereference.  The comments say that
we should return here if rc_dev is NULL so I've changed the test to
match the comment.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-picolcd_cir.c

index 14c5ce0e71bc6ce180fcfbd6a7462cbdbe9face3..13ca9191b6309a9ff388dbd32dd2f584cb2fffa9 100644 (file)
@@ -51,7 +51,7 @@ int picolcd_raw_cir(struct picolcd_data *data,
 
        /* ignore if rc_dev is NULL or status is shunned */
        spin_lock_irqsave(&data->lock, flags);
-       if (data->rc_dev && (data->status & PICOLCD_CIR_SHUN)) {
+       if (!data->rc_dev || (data->status & PICOLCD_CIR_SHUN)) {
                spin_unlock_irqrestore(&data->lock, flags);
                return 1;
        }