Skip to content

Commit

Permalink
HID: picoLCD: fix a NULL test in picolcd_raw_cir()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Jiri Kosina committed Sep 8, 2012
1 parent eb9001c commit 02d9be1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/hid-picolcd_cir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 02d9be1

Please sign in to comment.