Commit dfa0c5fa authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Jiri Kosina

HID: core: use scnprintf in modalias_show()

scnprintf() exists to provide these semantics, so we might as well use
it.
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 406df153
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment