From patchwork Fri Jul 24 16:51:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 6861991 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8747AC05AC for ; Fri, 24 Jul 2015 16:52:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0ACC205B7 for ; Fri, 24 Jul 2015 16:52:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB52C205BD for ; Fri, 24 Jul 2015 16:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752909AbbGXQwD (ORCPT ); Fri, 24 Jul 2015 12:52:03 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:48954 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752476AbbGXQwC (ORCPT ); Fri, 24 Jul 2015 12:52:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Message-Id:Date:Subject:Cc:To:From; bh=mvcncZSO9UH8ski3+QXbuoFNSIGg2hpR48dppHRa79c=; b=V+4zDiqppF0kQIONkl3A4mjHl2lqfAX1Ws4aGRD+YsCCECp5FyWggTHYk2tBANjRwtWlfxgCf2/LyvuLm2MqUKYA53pi0vAsJmN6+qxckrECUcfysz6CRfwB9GcWfy9uHr2rlY08rgFse/R1VjUdvHpDSyWz8ySGFLKpw0CgID8=; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:53003 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.85) (envelope-from ) id 1ZIgCW-003pG9-6K; Fri, 24 Jul 2015 16:52:00 +0000 From: Guenter Roeck To: "Rafael J. Wysocki" Cc: Len Brown , Robert Moore , Lv Zheng , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, devel@acpica.org, Guenter Roeck Subject: [PATCH] acpi: Use kstrtoul() instead of strtoul()/simple_strtoul() Date: Fri, 24 Jul 2015 09:51:57 -0700 Message-Id: <1437756717-11730-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.1.0 X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP simple_strtoul() is deprecated; replace with kstrtoul(). Return an error if the value passed to the sysfs attribute is not a number. Drop the definition of strtoul() since it is no longer needed. Signed-off-by: Guenter Roeck --- drivers/acpi/sysfs.c | 8 ++++++-- include/acpi/platform/aclinux.h | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 0876d77b3206..d6ea5712ec57 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c @@ -616,8 +616,12 @@ static ssize_t counter_set(struct kobject *kobj, all_counters[index].count = tmp; else result = -EINVAL; - } else - all_counters[index].count = strtoul(buf, NULL, 0); + } else { + if (!kstrtoul(buf, 0, &tmp)) + all_counters[index].count = tmp; + else + result = -EINVAL; + } if (ACPI_FAILURE(result)) result = -EINVAL; diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 74ba46c8157a..9925c1d5d58f 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -119,7 +119,6 @@ #define ACPI_MACHINE_WIDTH BITS_PER_LONG #define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); -#define strtoul simple_strtoul #define acpi_cache_t struct kmem_cache #define acpi_spinlock spinlock_t *