[PATCH v3 8/8] gpiolib: use %*pb format specifier when printing array masks

From: Dmitry Torokhov

Date: Fri Nov 06 2026 - 01:32:22 EST


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@xxxxxxxxx>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
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