linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Fabian Frederick <fabf@skynet.be>
To: linux-kernel@vger.kernel.org
Cc: Fabian Frederick <fabf@skynet.be>,
	paulus@samba.org, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 2/7] powerpc/mv64x60_pci: replace sscanf by kstrtou32
Date: Sat, 12 Jul 2014 13:36:15 +0200	[thread overview]
Message-ID: <1405164980-9525-3-git-send-email-fabf@skynet.be> (raw)
In-Reply-To: <1405164980-9525-1-git-send-email-fabf@skynet.be>

See checkpatch warning
"Prefer kstrto<type> to single variable sscanf"

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 arch/powerpc/sysdev/mv64x60_pci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c
index 330d566..ca0b29c 100644
--- a/arch/powerpc/sysdev/mv64x60_pci.c
+++ b/arch/powerpc/sysdev/mv64x60_pci.c
@@ -52,14 +52,17 @@ static ssize_t mv64x60_hs_reg_write(struct file *filp, struct kobject *kobj,
 {
 	struct pci_dev *phb;
 	u32 v;
+	int rc;
 
 	if (off > 0)
 		return 0;
 	if (count <= 0)
 		return -EINVAL;
 
-	if (sscanf(buf, "%i", &v) != 1)
-		return -EINVAL;
+	rc = kstrtou32(buf, 0, &v);
+
+	if (rc)
+		return rc;
 
 	phb = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
 	if (!phb)
-- 
1.9.1

  parent reply	other threads:[~2014-07-12 11:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-12 11:36 [PATCH 0/7] arch/powerpc: convert single variable sscanf to kstrto<type> Fabian Frederick
2014-07-12 11:36 ` [PATCH 1/7] powerpc: fadump: replace sscanf by kstrtoint Fabian Frederick
2014-07-12 11:36 ` Fabian Frederick [this message]
2014-07-12 11:36 ` [PATCH 3/7] powerpc/powernv: replace sscanf %lx by kstrtoul 16 Fabian Frederick
2014-07-12 11:36 ` [PATCH 4/7] powerpc/sysfs: replace sscanf by kstrtol Fabian Frederick
2014-07-12 11:36 ` [PATCH 5/7] hugetlb: replace sscanf by kstrtoul Fabian Frederick
2014-07-12 11:36 ` [PATCH 6/7] powerpc/cell: replace sscanf by kstrtouint Fabian Frederick
2014-07-12 11:36 ` [PATCH 7/7] powerpc/pseries: replace sscanf by kstrtoul Fabian Frederick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405164980-9525-3-git-send-email-fabf@skynet.be \
    --to=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).