From 02d9be1aa6e93f4819f230a1d570e2ff415fa294 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 7 Sep 2012 09:47:41 +0300 Subject: [PATCH] HID: picoLCD: fix a NULL test in picolcd_raw_cir() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Bruno Prémont Signed-off-by: Jiri Kosina --- drivers/hid/hid-picolcd_cir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-picolcd_cir.c b/drivers/hid/hid-picolcd_cir.c index 14c5ce0e71b..13ca9191b63 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, /* 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; } -- 2.46.0