diff mbox series

platform/chrome: kunit: initialize lock for fake ec_dev

Message ID 20231003080504.4011337-1-tzungbi@kernel.org (mailing list archive)
State Accepted
Commit e410b4ade83d06a046f6e32b5085997502ba0559
Headers show
Series platform/chrome: kunit: initialize lock for fake ec_dev | expand

Commit Message

Tzung-Bi Shih Oct. 3, 2023, 8:05 a.m. UTC
cros_ec_cmd_xfer() uses ec_dev->lock.  Initialize it.

Otherwise, dmesg shows the following:
> DEBUG_LOCKS_WARN_ON(lock->magic != lock)
> ...
> Call Trace:
>  ? __mutex_lock
>  ? __warn
>  ? __mutex_lock
>  ...
>  ? cros_ec_cmd_xfer

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 drivers/platform/chrome/cros_ec_proto_test.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Guenter Roeck Oct. 5, 2023, 2:14 a.m. UTC | #1
On Tue, Oct 3, 2023 at 1:05 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> cros_ec_cmd_xfer() uses ec_dev->lock.  Initialize it.
>
> Otherwise, dmesg shows the following:
> > DEBUG_LOCKS_WARN_ON(lock->magic != lock)
> > ...
> > Call Trace:
> >  ? __mutex_lock
> >  ? __warn
> >  ? __mutex_lock
> >  ...
> >  ? cros_ec_cmd_xfer
>
> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>

Reviewed-by: Guenter Roeck <groeck@chromium.org>

> ---
>  drivers/platform/chrome/cros_ec_proto_test.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/platform/chrome/cros_ec_proto_test.c b/drivers/platform/chrome/cros_ec_proto_test.c
> index 28f722396fc1..b6169d6f2467 100644
> --- a/drivers/platform/chrome/cros_ec_proto_test.c
> +++ b/drivers/platform/chrome/cros_ec_proto_test.c
> @@ -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
>
patchwork-bot+chrome-platform@kernel.org Oct. 5, 2023, 10:20 a.m. UTC | #2
Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <tzungbi@kernel.org>:

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:
> > DEBUG_LOCKS_WARN_ON(lock->magic != lock)
> > ...
> > Call Trace:
> >  ? __mutex_lock
> >  ? __warn
> >  ? __mutex_lock
> >  ...
> >  ? cros_ec_cmd_xfer
> 
> [...]

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!
patchwork-bot+chrome-platform@kernel.org Oct. 11, 2023, 2:20 a.m. UTC | #3
Hello:

This patch was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <tzungbi@kernel.org>:

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:
> > DEBUG_LOCKS_WARN_ON(lock->magic != lock)
> > ...
> > Call Trace:
> >  ? __mutex_lock
> >  ? __warn
> >  ? __mutex_lock
> >  ...
> >  ? cros_ec_cmd_xfer
> 
> [...]

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!
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_ec_proto_test.c b/drivers/platform/chrome/cros_ec_proto_test.c
index 28f722396fc1..b6169d6f2467 100644
--- a/drivers/platform/chrome/cros_ec_proto_test.c
+++ b/drivers/platform/chrome/cros_ec_proto_test.c
@@ -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;