All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2/3] Staging: lustre: use kstrtoul() instead of sscanf()
@ 2015-02-21 20:47 aybuke ozdemir
  2015-02-21 20:55 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: aybuke ozdemir @ 2015-02-21 20:47 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: aybuke ozdemir

This patch makes checkpatch.pl by fixing the following warning:
WARNING: Prefer kstrto<type> to single variable sscanf.
I used to kstrtoul can convert unsigned long instead of sscanf

Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
---
Changes since v1:
* Removed unnecessary variable rc1.
* The return value is changed(Returns 0 on success).
* Changed the description
---
 drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index a3367bf..fb99cdb 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -2198,7 +2198,8 @@ int ll_process_config(struct lustre_cfg *lcfg)
 	ptr = strrchr(lustre_cfg_string(lcfg, 0), '-');
 	if (!ptr || !*(++ptr))
 		return -EINVAL;
-	if (sscanf(ptr, "%lx", &x) != 1)
+	rc = kstrtoul(ptr, 16, &x);
+	if (rc != 0)
 		return -EINVAL;
 	sb = (void *)x;
 	/* This better be a real Lustre superblock! */
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-21 20:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-21 20:47 [PATCH v2 2/3] Staging: lustre: use kstrtoul() instead of sscanf() aybuke ozdemir
2015-02-21 20:55 ` [Outreachy kernel] " Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.