aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-picolcd_cir.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-09-07 02:47:41 -0400
committerJiri Kosina <jkosina@suse.cz>2012-09-08 15:19:07 -0400
commit02d9be1aa6e93f4819f230a1d570e2ff415fa294 (patch)
treeeb1e1468ec5d8820afc4b250601581be27691083 /drivers/hid/hid-picolcd_cir.c
parenteb9001cd8ffff9c9b1ed1ea85d36c862bea964c0 (diff)
HID: picoLCD: fix a NULL test in picolcd_raw_cir()
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>
Diffstat (limited to 'drivers/hid/hid-picolcd_cir.c')
-rw-r--r--drivers/hid/hid-picolcd_cir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/hid-picolcd_cir.c b/drivers/hid/hid-picolcd_cir.c
index 14c5ce0e71bc..13ca9191b630 100644
--- a/drivers/hid/hid-picolcd_cir.c
+++ b/drivers/hid/hid-picolcd_cir.c
@@ -51,7 +51,7 @@ int picolcd_raw_cir(struct picolcd_data *data,
51 51
52 /* ignore if rc_dev is NULL or status is shunned */ 52 /* ignore if rc_dev is NULL or status is shunned */
53 spin_lock_irqsave(&data->lock, flags); 53 spin_lock_irqsave(&data->lock, flags);
54 if (data->rc_dev && (data->status & PICOLCD_CIR_SHUN)) { 54 if (!data->rc_dev || (data->status & PICOLCD_CIR_SHUN)) {
55 spin_unlock_irqrestore(&data->lock, flags); 55 spin_unlock_irqrestore(&data->lock, flags);
56 return 1; 56 return 1;
57 } 57 }