Skip to content

Commit 6635ffb

Browse files
committed
input: touchscreen: atmel_mxt_ts: fix smatch warnings
Fixes smatch warnings for : drivers/input/touchscreen/atmel_mxt_ts.c:427 mxt_debug_msg_enable() warn: inconsistent returns 'mutex:&data->debug_msg_lock'. Locked on: line 422 Unlocked on: line 415 drivers/input/touchscreen/atmel_mxt_ts.c:471 mxt_debug_msg_add() warn: inconsistent returns 'mutex:&data->debug_msg_lock'. Locked on: line 455 Unlocked on: line 471 drivers/input/touchscreen/atmel_mxt_ts.c:1496 mxt_interrupt() error: we previously assumed 'data->flash' could be null (see line 1493) Fixes "5a23661" (atmel_mxt_ts.c: move to current github.com/atmel-maxtouch) Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
1 parent 5a23661 commit 6635ffb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/input/touchscreen/atmel_mxt_ts.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,10 @@ static void mxt_debug_msg_enable(struct mxt_data *data)
418418

419419
data->debug_msg_data = kcalloc(DEBUG_MSG_MAX,
420420
data->T5_msg_size, GFP_KERNEL);
421-
if (!data->debug_msg_data)
421+
if (!data->debug_msg_data) {
422+
mutex_unlock(&data->debug_msg_lock);
422423
return;
424+
}
423425

424426
data->debug_v2_enabled = true;
425427
mutex_unlock(&data->debug_msg_lock);
@@ -451,6 +453,7 @@ static void mxt_debug_msg_add(struct mxt_data *data, u8 *msg)
451453
mutex_lock(&data->debug_msg_lock);
452454

453455
if (!data->debug_msg_data) {
456+
mutex_unlock(&data->debug_msg_lock);
454457
dev_err(dev, "No buffer!\n");
455458
return;
456459
}
@@ -685,6 +688,9 @@ static int mxt_check_bootloader(struct mxt_data *data)
685688
u8 state;
686689
int ret;
687690

691+
if (!f)
692+
return -EINVAL;
693+
688694
/* Handle interrupt after download/flash process */
689695
if (f->pos >= f->fw->size) {
690696
complete(&f->flash_completion);

0 commit comments

Comments
 (0)