* [PATCH] HID: core: use scnprintf in modalias_show()
@ 2015-11-14 21:08 Rasmus Villemoes
2015-11-20 9:48 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2015-11-14 21:08 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Rasmus Villemoes, linux-input, linux-kernel
scnprintf() exists to provide these semantics, so we might as well use
it.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/hid/hid-core.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index c6f7a694f67a..efa3660e23a0 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2223,12 +2223,9 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
char *buf)
{
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
- int len;
-
- len = snprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
- hdev->bus, hdev->group, hdev->vendor, hdev->product);
- return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
+ return scnprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
+ hdev->bus, hdev->group, hdev->vendor, hdev->product);
}
static DEVICE_ATTR_RO(modalias);
--
2.6.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] HID: core: use scnprintf in modalias_show()
2015-11-14 21:08 [PATCH] HID: core: use scnprintf in modalias_show() Rasmus Villemoes
@ 2015-11-20 9:48 ` Jiri Kosina
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2015-11-20 9:48 UTC (permalink / raw)
To: Rasmus Villemoes; +Cc: linux-input, linux-kernel
On Sat, 14 Nov 2015, Rasmus Villemoes wrote:
> scnprintf() exists to provide these semantics, so we might as well use
> it.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Applied to hid.git#for-4.5/core. Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-20 9:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-14 21:08 [PATCH] HID: core: use scnprintf in modalias_show() Rasmus Villemoes
2015-11-20 9:48 ` Jiri Kosina
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.