From: sashiko-bot@kernel.org
To: "Jinseob Kim" <kimjinseob88@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v11 7/8] iio: osf: add core KUnit tests
Date: Sun, 11 Oct 2026 23:29:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-167514@kernel.org> (raw)
In-Reply-To: <20261011231340.42885-8-kimjinseob88@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] kunit: missing mutex_destroy() for dynamically allocated locks
- [Low] kconfig: OSF KUnit tests unnecessarily restricted to built-in modularity
--
commit 168e51876dbdd13bb34af3a59ad653d5632d1c07
Author: Jinseob Kim <kimjinseob88@gmail.com>
iio: osf: add core KUnit tests
This commit adds focused unit tests for the Open Sensor Fusion core, exercising
capability discovery, inventories, exact lengths, and reserved wire bytes. It
also covers sample-cache admission and deferred cleanup routines.
> diff --git a/drivers/iio/sensorhubs/osf/Kconfig b/drivers/iio/sensorhubs/osf/Kconfig
> index f955a1f2993d2..316f33be1327c 100644
> --- a/drivers/iio/sensorhubs/osf/Kconfig
> +++ b/drivers/iio/sensorhubs/osf/Kconfig
> @@ -13,3 +13,15 @@ config OPEN_SENSOR_FUSION
[ ... ]
> +config OPEN_SENSOR_FUSION_KUNIT_TEST
> + bool "KUnit tests for Open Sensor Fusion" if !KUNIT_ALL_TESTS
> + depends on OPEN_SENSOR_FUSION=y && KUNIT=y
[Severity: Low]
Does this unnecessarily restrict test coverage when the driver is built as a
loadable module?
Since the test object is appended to open-sensor-fusion-y in the Makefile,
it seems it can be successfully built and executed inside the loadable
module open-sensor-fusion.ko.
While it makes sense to avoid OPEN_SENSOR_FUSION=y with KUNIT=m to prevent
link errors, forcing the driver to be built-in reduces coverage on standard
distribution kernels. Could a dependency like depends on OPEN_SENSOR_FUSION
&& !(OPEN_SENSOR_FUSION=y && KUNIT=m) work better here to allow modular
test execution?
> diff --git a/drivers/iio/sensorhubs/osf/osf_core_test.c b/drivers/iio/sensorhubs/osf/osf_core_test.c
> new file mode 100644
> index 0000000000000..fabf19018b200
> --- /dev/null
> +++ b/drivers/iio/sensorhubs/osf/osf_core_test.c
> @@ -0,0 +1,1056 @@
[ ... ]
> +static void osf_test_unregister_pending(void *data)
> +{
> + osf_core_unregister_iio(data);
> +}
[Severity: Low]
Does this custom teardown path miss a call to mutex_destroy() for the
pending device's latest_lock initialized during osf_core_init()?
Since KUnit will automatically free the allocated memory for the pending
device at the end of the test, leaving the active mutex undestroyed can
leave stale pointers in the lockdep tracking structures, causing debug
splats when CONFIG_DEBUG_MUTEXES is enabled.
[ ... ]
> +static void osf_session_fault_buffer_race_test(struct kunit *test)
> +{
> + struct osf_test_context *ctx = test->priv;
[ ... ]
> + race = kunit_kzalloc(test, sizeof(*race), GFP_KERNEL);
> + KUNIT_ASSERT_NOT_NULL(test, race);
> + race->ctx = ctx;
> + mutex_init(&race->rx_lock);
> + init_completion(&race->started);
[Severity: Low]
Are we missing a corresponding mutex_destroy() for the dynamically
allocated race->rx_lock before the test finishes?
Similar to the issue above, the race object is managed by kunit_kzalloc()
and will be automatically freed. Freeing active mutex memory without
destroying it could trigger lockdep warnings.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261011231340.42885-1-kimjinseob88@gmail.com?part=7
next prev parent reply other threads:[~2026-10-11 23:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 23:13 [PATCH v11 0/8] iio: add Open Sensor Fusion UART support Jinseob Kim
2026-10-11 23:13 ` [PATCH v11 1/8] dt-bindings: iio: add Open Sensor Fusion device Jinseob Kim
2026-10-12 19:10 ` Conor Dooley
2026-10-11 23:13 ` [PATCH v11 2/8] Documentation: iio: add Open Sensor Fusion driver overview Jinseob Kim
2026-10-11 23:13 ` [PATCH v11 3/8] iio: osf: add protocol decoding Jinseob Kim
2026-10-11 23:13 ` [PATCH v11 4/8] iio: osf: add validated stream parser Jinseob Kim
2026-10-11 23:13 ` [PATCH v11 5/8] iio: osf: add UART transport and core receive path Jinseob Kim
2026-10-11 23:13 ` [PATCH v11 6/8] iio: osf: add IIO devices from capability reports Jinseob Kim
2026-10-11 23:29 ` sashiko-bot
2026-10-11 23:13 ` [PATCH v11 7/8] iio: osf: add core KUnit tests Jinseob Kim
2026-10-11 23:29 ` sashiko-bot [this message]
2026-10-11 23:13 ` [PATCH v11 8/8] iio: osf: add IIO " Jinseob Kim
2026-10-11 23:39 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-167514@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kimjinseob88@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox