mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Linus Walleij <linusw@kernel.org>,
	 Bartosz Golaszewski <brgl@kernel.org>
Cc: Andy Shevchenko <andy@kernel.org>,
	 Janusz Krzysztofik <jmkrzyszt@gmail.com>,
	linux-gpio@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@intel.com>
Subject: [PATCH v3 8/8] gpiolib: use %*pb format specifier when printing array masks
Date: Thu, 05 Nov 2026 22:30:22 -0800	[thread overview]
Message-ID: <20261105-b4-gpiolib-free-v3-8-bb47ad58642d@gmail.com> (raw)
In-Reply-To: <20261105-b4-gpiolib-free-v3-0-bb47ad58642d@gmail.com>

In gpiod_get_array(), the dev_dbg() statement prints get_mask, set_mask,
and invert_mask using %lx after dereferencing them as raw unsigned long
pointers. This truncates masks wider than BITS_PER_LONG to their first
word and relies on the raw unsigned long pointer representation of
bitmaps.

Switch to the %*pb format specifier, passing the mask size and pointer
for each mask.

Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/gpio/gpiolib.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 83edb89a364a..079b5a715eaa 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -5362,10 +5362,11 @@ struct gpio_descs *__must_check gpiod_get_array(struct device *dev,
 	}
 	if (descs->info)
 		dev_dbg(dev,
-			"GPIO array info: chip=%s, size=%d, get_mask=%lx, set_mask=%lx, invert_mask=%lx\n",
+			"GPIO array info: chip=%s, size=%d, get_mask=%*pb, set_mask=%*pb, invert_mask=%*pb\n",
 			descs->info->gdev->label, descs->info->size,
-			*descs->info->get_mask, *descs->info->set_mask,
-			*descs->info->invert_mask);
+			descs->info->size, descs->info->get_mask,
+			descs->info->size, descs->info->set_mask,
+			descs->info->size, descs->info->invert_mask);
 	return_ptr(descs);
 }
 EXPORT_SYMBOL_GPL(gpiod_get_array);

-- 
2.56.0.506.g506a7eabc5-goog


  parent reply	other threads:[~2026-11-06  6:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  6:30 [PATCH v3 0/8] gpiolib: scope-based management and cleanup for GPIO descriptor arrays Dmitry Torokhov
2026-11-06  6:30 ` [PATCH v3 1/8] gpiolib: fix GPIO descriptor leak in gpiod_get_array() Dmitry Torokhov
2026-11-06  6:30 ` [PATCH v3 2/8] gpiolib: fix fast-path cancellation " Dmitry Torokhov
2026-11-06  6:30 ` [PATCH v3 3/8] gpiolib: of: return -ENOENT from of_gpio_count() stub Dmitry Torokhov
2026-11-06  6:30 ` [PATCH v3 4/8] gpiolib: add support for scope-based management of GPIO descriptors Dmitry Torokhov
2026-11-06  6:30 ` [PATCH v3 5/8] gpiolib: use __free(gpiod_put_array) in gpiod_get_array() Dmitry Torokhov
2026-11-06  6:30 ` [PATCH v3 6/8] gpiolib: avoid krealloc() " Dmitry Torokhov
2026-11-06 13:56   ` Linus Walleij
2026-11-06  6:30 ` [PATCH v3 7/8] gpiolib: use bitmap_zalloc() for fastpath bitmaps Dmitry Torokhov
2026-11-06 13:56   ` Linus Walleij
2026-11-06  6:30 ` Dmitry Torokhov [this message]
2026-11-06 13:57   ` [PATCH v3 8/8] gpiolib: use %*pb format specifier when printing array masks Linus Walleij

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=20261105-b4-gpiolib-free-v3-8-bb47ad58642d@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=brgl@kernel.org \
    --cc=jmkrzyszt@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®