[PATCH 1/2] sh: push-switch: use sysfs_emit() in switch_show

Thorsten Blum <[email protected]>
Newsgroups gmane.linux.ports.sh.devel,gmane.linux.kernel
Message-ID <[email protected]>
Replace sprintf() with sysfs_emit() in switch_show(). sysfs_emit() is
preferred for formatting sysfs output because it provides safer bounds
checking.

Signed-off-by: Thorsten Blum <[email protected]>
---
 arch/sh/drivers/push-switch.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sh/drivers/push-switch.c b/arch/sh/drivers/push-switch.c
index a39e2edd4dcb..9a60e2e088a8 100644
--- a/arch/sh/drivers/push-switch.c
+++ b/arch/sh/drivers/push-switch.c
@@ -9,6 +9,7 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
+#include <linux/sysfs.h>
 #include <asm/push-switch.h>
 
 #define DRV_NAME "push-switch"
@@ -19,7 +20,7 @@ static ssize_t switch_show(struct device *dev,
 			   char *buf)
 {
 	struct push_switch_platform_info *psw_info = dev->platform_data;
-	return sprintf(buf, "%s\n", psw_info->name);
+	return sysfs_emit(buf, "%s\n", psw_info->name);
 }
 static DEVICE_ATTR_RO(switch);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.