summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2015-11-14 22:08:08 +0100
committerJiri Kosina <jkosina@suse.cz>2015-11-20 10:48:04 +0100
commitdfa0c5faf1b8964fa508373232b4cb597a5c226b (patch)
treea2ffa63bab70f89d01bdff92e6a50868afbea053 /drivers/hid
parent406df15344cc54be9f6852917b19394c375c7b59 (diff)
downloadlinux-dfa0c5faf1b8964fa508373232b4cb597a5c226b.tar.bz2
HID: core: use scnprintf in modalias_show()
scnprintf() exists to provide these semantics, so we might as well use it. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index d5ddb7573691..3c1cfc6d9964 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2217,12 +2217,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);