Skip to content

Commit 1eb5980

Browse files
Yang Guanggregkh
authored andcommitted
ptp: replace snprintf with sysfs_emit
[ Upstream commit e2cf076 ] coccinelle report: ./drivers/ptp/ptp_sysfs.c:17:8-16: WARNING: use scnprintf or sprintf ./drivers/ptp/ptp_sysfs.c:390:8-16: WARNING: use scnprintf or sprintf Use sysfs_emit instead of scnprintf or sprintf makes more sense. Reported-by: Zeal Robot <[email protected]> Signed-off-by: Yang Guang <[email protected]> Signed-off-by: David Yang <[email protected]> Acked-by: Richard Cochran <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 052fb1c commit 1eb5980

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/ptp/ptp_sysfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static ssize_t clock_name_show(struct device *dev,
1414
struct device_attribute *attr, char *page)
1515
{
1616
struct ptp_clock *ptp = dev_get_drvdata(dev);
17-
return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name);
17+
return sysfs_emit(page, "%s\n", ptp->info->name);
1818
}
1919
static DEVICE_ATTR_RO(clock_name);
2020

@@ -387,7 +387,7 @@ static ssize_t ptp_pin_show(struct device *dev, struct device_attribute *attr,
387387

388388
mutex_unlock(&ptp->pincfg_mux);
389389

390-
return snprintf(page, PAGE_SIZE, "%u %u\n", func, chan);
390+
return sysfs_emit(page, "%u %u\n", func, chan);
391391
}
392392

393393
static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr,

0 commit comments

Comments
 (0)