Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ptp: replace snprintf with sysfs_emit

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 <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Yang Guang and committed by
David S. Miller
e2cf0765 c217ab7a

+2 -2
+2 -2
drivers/ptp/ptp_sysfs.c
··· 14 14 struct device_attribute *attr, char *page) 15 15 { 16 16 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); 18 18 } 19 19 static DEVICE_ATTR_RO(clock_name); 20 20 ··· 387 387 388 388 mutex_unlock(&ptp->pincfg_mux); 389 389 390 - return snprintf(page, PAGE_SIZE, "%u %u\n", func, chan); 390 + return sysfs_emit(page, "%u %u\n", func, chan); 391 391 } 392 392 393 393 static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr,