mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests: ublk: fix unused_result error
@ 2026-09-14 11:01 Dirk Gouders
  2026-09-20 13:44 ` Ming Lei
  2026-09-21 16:32 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Dirk Gouders @ 2026-09-14 11:01 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Ming Lei, Jens Axboe, Linux Kernel, linux-kselftest, linux-block,
	Dirk Gouders

Commit 166b476b8dee (selftests/ublk: add shared memory zero-copy
support in kublk, 2026-03-31) introduced a write(2), ignoring its
return value and thus causing an error, when building.

Fix this by using the common workaround "(void)!" to trick the
compiler the result is being used.

Signed-off-by: Dirk Gouders <dirk@gouders.net>
---
 tools/testing/selftests/ublk/kublk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ublk/kublk.c b/tools/testing/selftests/ublk/kublk.c
index 2400b4615766..5b19bfcfa8d7 100644
--- a/tools/testing/selftests/ublk/kublk.c
+++ b/tools/testing/selftests/ublk/kublk.c
@@ -1589,7 +1589,7 @@ static int ublk_start_daemon(const struct dev_ctx *ctx, struct ublk_dev *dev)
 
 	/* Signal listener thread to stop and wait for it */
 	if (linfo.stop_efd >= 0) {
-		write(linfo.stop_efd, &stop_val, sizeof(stop_val));
+		(void)!write(linfo.stop_efd, &stop_val, sizeof(stop_val));
 		pthread_join(listener, NULL);
 		close(linfo.stop_efd);
 		ublk_shmem_sock_destroy(dinfo->dev_id, linfo.sock_fd);
-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests: ublk: fix unused_result error
  2026-09-14 11:01 [PATCH] selftests: ublk: fix unused_result error Dirk Gouders
@ 2026-09-20 13:44 ` Ming Lei
  2026-09-21 16:32 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2026-09-20 13:44 UTC (permalink / raw)
  To: Dirk Gouders
  Cc: Shuah Khan, Ming Lei, Jens Axboe, Linux Kernel, linux-kselftest,
	linux-block

On Mon, Sep 14, 2026 at 6:11 AM Dirk Gouders <dirk@gouders.net> wrote:
>
> Commit 166b476b8dee (selftests/ublk: add shared memory zero-copy
> support in kublk, 2026-03-31) introduced a write(2), ignoring its
> return value and thus causing an error, when building.
>
> Fix this by using the common workaround "(void)!" to trick the
> compiler the result is being used.
>
> Signed-off-by: Dirk Gouders <dirk@gouders.net>
> ---
>  tools/testing/selftests/ublk/kublk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/ublk/kublk.c b/tools/testing/selftests/ublk/kublk.c
> index 2400b4615766..5b19bfcfa8d7 100644
> --- a/tools/testing/selftests/ublk/kublk.c
> +++ b/tools/testing/selftests/ublk/kublk.c
> @@ -1589,7 +1589,7 @@ static int ublk_start_daemon(const struct dev_ctx *ctx, struct ublk_dev *dev)
>
>         /* Signal listener thread to stop and wait for it */
>         if (linfo.stop_efd >= 0) {
> -               write(linfo.stop_efd, &stop_val, sizeof(stop_val));
> +               (void)!write(linfo.stop_efd, &stop_val, sizeof(stop_val));
>                 pthread_join(listener, NULL);
>                 close(linfo.stop_efd);
>                 ublk_shmem_sock_destroy(dinfo->dev_id, linfo.sock_fd);

Reviewed-by: Ming Lei <tom.leiming@gmail.com>

Thanks,
Ming Lei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests: ublk: fix unused_result error
  2026-09-14 11:01 [PATCH] selftests: ublk: fix unused_result error Dirk Gouders
  2026-09-20 13:44 ` Ming Lei
@ 2026-09-21 16:32 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2026-09-21 16:32 UTC (permalink / raw)
  To: Shuah Khan, Dirk Gouders
  Cc: Ming Lei, Linux Kernel, linux-kselftest, linux-block


On Mon, 14 Sep 2026 13:01:09 +0200, Dirk Gouders wrote:
> Commit 166b476b8dee (selftests/ublk: add shared memory zero-copy
> support in kublk, 2026-03-31) introduced a write(2), ignoring its
> return value and thus causing an error, when building.
> 
> Fix this by using the common workaround "(void)!" to trick the
> compiler the result is being used.
> 
> [...]

Applied, thanks!

[1/1] selftests: ublk: fix unused_result error
      commit: 687cb38c4330d52d58dbf426a3eb523850052d10

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-21 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 11:01 [PATCH] selftests: ublk: fix unused_result error Dirk Gouders
2026-09-20 13:44 ` Ming Lei
2026-09-21 16:32 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®