提交 02d9be1a 编写于 作者: D Dan Carpenter 提交者: Jiri Kosina

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: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NBruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 eb9001cd
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册