Skip to contentSkip to conversation

amba: bus: Replace sprintf with sysfs_emit

PATCH RESEND New Wang Jiayue 1 participant 1 message Feb 4 Arm primecell bus support

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 amba: bus: Replace sprintf with sysfs_emit

Use sysfs_emit() instead of sprintf() when writing to sysfs buffers, as recommended by the kernel documentation.

---
v2:
* Correct the prefix and content in title.

---
 drivers/amba/bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/amba/bus.c +2 -2
index 952c45ca6e48..59ae95d106ec 100644
@@ -89,7 +89,7 @@ static ssize_t driver_override_show(struct device *_dev,
 	ssize_t len;
 
 	device_lock(_dev);
-	len = sprintf(buf, "%s\n", dev->driver_override);
+	len = sysfs_emit(buf, "%s\n", dev->driver_override);
 	device_unlock(_dev);
 	return len;
 }
@@ -114,7 +114,7 @@ static ssize_t name##_show(struct device *_dev,				\
 			   struct device_attribute *attr, char *buf)	\
 {									\
 	struct amba_device *dev = to_amba_device(_dev);			\
-	return sprintf(buf, fmt, arg);					\
+	return sysfs_emit(buf, fmt, arg);				\
 }									\
 static DEVICE_ATTR_RO(name)
 
Signature · 1 line
2.34.1