Skip to content

Commit babf09c

Browse files
committed
Merge tag 'tag-chrome-platform-fixes-for-v5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux
Pull chrome platform fixes from Benson Leung: "Two fixes: - Fix locking and close a potential race condition in the new wilco_ec driver. - Fix a warning in cros_ec_debugfs on systems that do not support console logging, such as the Asus C201" * tag 'tag-chrome-platform-fixes-for-v5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: platform/chrome: cros_ec_debugfs: cancel/schedule logging work only if supported platform/chrome: Fix locking pattern in wilco_ec_mailbox()
2 parents b7a4214 + 57aeef7 commit babf09c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

drivers/platform/chrome/cros_ec_debugfs.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,14 +440,16 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
440440

441441
ret = cros_ec_create_pdinfo(debug_info);
442442
if (ret)
443-
goto remove_debugfs;
443+
goto remove_log;
444444

445445
ec->debug_info = debug_info;
446446

447447
dev_set_drvdata(&pd->dev, ec);
448448

449449
return 0;
450450

451+
remove_log:
452+
cros_ec_cleanup_console_log(debug_info);
451453
remove_debugfs:
452454
debugfs_remove_recursive(debug_info->dir);
453455
return ret;
@@ -467,7 +469,8 @@ static int __maybe_unused cros_ec_debugfs_suspend(struct device *dev)
467469
{
468470
struct cros_ec_dev *ec = dev_get_drvdata(dev);
469471

470-
cancel_delayed_work_sync(&ec->debug_info->log_poll_work);
472+
if (ec->debug_info->log_buffer.buf)
473+
cancel_delayed_work_sync(&ec->debug_info->log_poll_work);
471474

472475
return 0;
473476
}
@@ -476,7 +479,8 @@ static int __maybe_unused cros_ec_debugfs_resume(struct device *dev)
476479
{
477480
struct cros_ec_dev *ec = dev_get_drvdata(dev);
478481

479-
schedule_delayed_work(&ec->debug_info->log_poll_work, 0);
482+
if (ec->debug_info->log_buffer.buf)
483+
schedule_delayed_work(&ec->debug_info->log_poll_work, 0);
480484

481485
return 0;
482486
}

drivers/platform/chrome/wilco_ec/mailbox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@ int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg)
223223
msg->command, msg->type, msg->flags, msg->response_size,
224224
msg->request_size);
225225

226+
mutex_lock(&ec->mailbox_lock);
226227
/* Prepare request packet */
227228
rq = ec->data_buffer;
228229
wilco_ec_prepare(msg, rq);
229230

230-
mutex_lock(&ec->mailbox_lock);
231231
ret = wilco_ec_transfer(ec, msg, rq);
232232
mutex_unlock(&ec->mailbox_lock);
233233

0 commit comments

Comments
 (0)