mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] hwmon: Minor errno and sysfs fixes
@ 2025-12-19 15:48 Kari Argillander
  2025-12-19 15:48 ` [PATCH 1/2] hwmon: Fix wrong return errno in *sanitize_name() Kari Argillander
  2025-12-19 15:48 ` [PATCH 2/2] hwmon: Use sysfs_emit in show function callsbacks Kari Argillander
  0 siblings, 2 replies; 5+ messages in thread
From: Kari Argillander @ 2025-12-19 15:48 UTC (permalink / raw)
  To: Kari Argillander, Guenter Roeck; +Cc: linux-hwmon, linux-kernel

This series contains two small hwmon cleanups.

The first patch fixes an incorrect errno returned by sanitize_name()
when called with a NULL pointer. Returning ENOMEM in that case is
misleading. EINVAL better reflects the actual error.

The second patch switches sysfs show callbacks to sysfs_emit(), as
recommended by Documentation/filesystems/sysfs.rst. While the risk of
overflow with sprintf() is low in practice, using sysfs_emit() avoids
the issue entirely and aligns the code with current kernel guidance.
This also simplifies Rust bindings, where overflows cannot be ignored.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
---
Kari Argillander (2):
      hwmon: Fix wrong return errno in *sanitize_name()
      hwmon: Use sysfs_emit in show function callsbacks

 drivers/hwmon/hwmon.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
base-commit: cc3aa43b44bdb43dfbac0fcb51c56594a11338a8
change-id: 20251219-hwmon-fixes-b8e205834d20

Best regards,
-- 
Kari Argillander <kari.argillander@gmail.com>


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

end of thread, other threads:[~2025-12-19 16:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-19 15:48 [PATCH 0/2] hwmon: Minor errno and sysfs fixes Kari Argillander
2025-12-19 15:48 ` [PATCH 1/2] hwmon: Fix wrong return errno in *sanitize_name() Kari Argillander
2025-12-19 16:46   ` Guenter Roeck
2025-12-19 15:48 ` [PATCH 2/2] hwmon: Use sysfs_emit in show function callsbacks Kari Argillander
2025-12-19 16:47   ` Guenter Roeck

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®