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.
Unified · Split
| @@ -14,7 +14,7 @@ static ssize_t clock_name_show(struct device *dev, · 13 unmodified lines | |||
| 14 | struct device_attribute *attr, char *page) | 14 | struct device_attribute *attr, char *page) |
| 15 | { | 15 | { |
| 16 | struct ptp_clock *ptp = dev_get_drvdata(dev); | 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 | static DEVICE_ATTR_RO(clock_name); | 19 | static DEVICE_ATTR_RO(clock_name); |
| 20 | 20 | ||
| @@ -387,7 +387,7 @@ static ssize_t ptp_pin_show(struct device *dev, struct device_attribute *attr, · 366 unmodified lines | |||
| 387 | 387 | ||
| 388 | mutex_unlock(&ptp->pincfg_mux); | 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 | static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr, | 393 | static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr, |