Skip to content

Commit

Permalink
platform/chrome: kunit: initialize lock for fake ec_dev
Browse files Browse the repository at this point in the history
[ Upstream commit e410b4a ]

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

Reviewed-by: Guenter Roeck <groeck@chromium.org>
Link: https://lore.kernel.org/r/20231003080504.4011337-1-tzungbi@kernel.org
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Tzung-Bi Shih authored and gregkh committed Nov 28, 2023
1 parent ad1b721 commit 3df4c79
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/platform/chrome/cros_ec_proto_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 3df4c79

Please sign in to comment.