History

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.

Yang Guang committed 4 years ago

Commit e2cf0761 parent c217ab71 file · +2 −2Browse files

Unified · Split

drivers/ptp/ptp_sysfs.c+2−2
@@ -14,7 +14,7 @@ static ssize_t clock_name_show(struct device *dev, · 13 unmodified lines
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, · 366 unmodified lines
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,