mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 07:01:57 +00:00
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>
This commit is contained in:
parent
406df15344
commit
dfa0c5faf1
@ -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",
|
||||
return scnprintf(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;
|
||||
}
|
||||
static DEVICE_ATTR_RO(modalias);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user