Skip to contentSkip to conversation

platform/chrome: kunit: initialize lock for fake ec_dev

PATCH Applied Tzung-Bi Shih 3 participants 4 messages Oct 3, 2023 – Oct 11, 2023

Subsystems (2)
lore
Share & tools
lore

Tzung-Bi Shih

author maintainer
#0 lore raw

PATCH 1/1 platform/chrome: kunit: initialize lock for fake ec_dev

cros_ec_cmd_xfer() uses ec_dev->lock. Initialize it.

Otherwise, dmesg shows the following:

Quoted 8 lines

DEBUG_LOCKS_WARN_ON(lock->magic != lock)
...

Call Trace:
 ? __mutex_lock
 ? __warn
 ? __mutex_lock
 ...
 ? cros_ec_cmd_xfer
---
 drivers/platform/chrome/cros_ec_proto_test.c | 1 +
 1 file changed, 1 insertion(+)
drivers/platform/chrome/cros_ec_proto_test.c +1 -0
index 28f722396fc1..b6169d6f2467 100644
@@ -2668,6 +2668,7 @@ static int cros_ec_proto_test_init(struct kunit *test)
 	ec_dev->dev->release = cros_ec_proto_test_release;
 	ec_dev->cmd_xfer = cros_kunit_ec_xfer_mock;
 	ec_dev->pkt_xfer = cros_kunit_ec_xfer_mock;
+	mutex_init(&ec_dev->lock);
 
 	priv->msg = (struct cros_ec_command *)priv->_msg;
 
Signature · 1 line
2.42.0.582.g8ccd20d70d-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Tzung-Bi Shih

cros_ec_cmd_xfer() uses ec_dev->lock. Initialize it.

Otherwise, dmesg shows the following:

Quoted 8 lines

DEBUG_LOCKS_WARN_ON(lock->magic != lock)
...

Call Trace:
 ? __mutex_lock
 ? __warn
 ? __mutex_lock
 ...
 ? cros_ec_cmd_xfer
Quoted 1 line
Quoted 19 lines
---
 drivers/platform/chrome/cros_ec_proto_test.c | 1 +
 1 file changed, 1 insertion(+)
drivers/platform/chrome/cros_ec_proto_test.c +1 -1
index 28f722396fc1..b6169d6f2467 100644
@@ -2668,6 +2668,7 @@ static int cros_ec_proto_test_init(struct kunit *test)
        ec_dev->dev->release = cros_ec_proto_test_release;
        ec_dev->cmd_xfer = cros_kunit_ec_xfer_mock;
        ec_dev->pkt_xfer = cros_kunit_ec_xfer_mock;
+       mutex_init(&ec_dev->lock);
 
        priv->msg = (struct cros_ec_command *)priv->_msg;
 
--

2.42.0.582.g8ccd20d70d-goog

#2 lore raw
In reply to Tzung-Bi Shih
This patch was applied to chrome-platform/linux.git (for-kernelci) by Tzung-Bi Shih <[email protected]>:

Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci) by Tzung-Bi Shih <[email protected]>:

Quoted 12 lines · On Tue, 3 Oct 2023 08:05:04 +0000 you wrote:

cros_ec_cmd_xfer() uses ec_dev->lock. Initialize it.

Otherwise, dmesg shows the following:

Quoted 8 lines

DEBUG_LOCKS_WARN_ON(lock->magic != lock)
...

Call Trace:
 ? __mutex_lock
 ? __warn
 ? __mutex_lock
 ...
 ? cros_ec_cmd_xfer
Quoted 1 line

[...]

Here is the summary with links:
- platform/chrome: kunit: initialize lock for fake ec_dev

    https://git.kernel.org/chrome-platform/c/e410b4ade83d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#3 lore raw
In reply to Tzung-Bi Shih
This patch was applied to chrome-platform/linux.git (for-next) by Tzung-Bi Shih <[email protected]>:

Hello:

This patch was applied to chrome-platform/linux.git (for-next) by Tzung-Bi Shih <[email protected]>:

Quoted 12 lines · On Tue, 3 Oct 2023 08:05:04 +0000 you wrote:

cros_ec_cmd_xfer() uses ec_dev->lock. Initialize it.

Otherwise, dmesg shows the following:

Quoted 8 lines

DEBUG_LOCKS_WARN_ON(lock->magic != lock)
...

Call Trace:
 ? __mutex_lock
 ? __warn
 ? __mutex_lock
 ...
 ? cros_ec_cmd_xfer
Quoted 1 line

[...]

Here is the summary with links:
- platform/chrome: kunit: initialize lock for fake ec_dev

    https://git.kernel.org/chrome-platform/c/e410b4ade83d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html