Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2069264imu; Tue, 6 Nov 2018 08:37:08 -0800 (PST) X-Google-Smtp-Source: AJdET5dbxHDBnlqxAhQkcXC/DmpIYa5fFDF0OrNcnaIsAMS0Gp8BlwnYeEpGrlIOhY9PPFDG3FAR X-Received: by 2002:a62:1a92:: with SMTP id a140-v6mr26801069pfa.219.1541522228228; Tue, 06 Nov 2018 08:37:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541522228; cv=none; d=google.com; s=arc-20160816; b=qY0Ki89uBzSTphT3WcbujhsVagY2GShrf5ZxGWVR+gPxYtjRgmFe7dDZKPdu2jzpFq r2fOkd62KV6fWMe7wdevbeUudaOC7ATkDLgbo4sZLJNrjK3kjoIGNLSOvRsYeAvdkAPn oKzCQsh/+BiH3qKMO1H3Jwum3Is+LGKuhUD3Ybi6F9LSEeGMfew8lqzFcnGI2tJBFEBz LT/Bjw+YrW2S/LGQPYNqGg8Q2G9DdSbq6TWJ7mUwvJRgVeOyQyfijNNHwQEYM/mBL24f abAzME94zX/85KYbYLvzF8GIY3qE7zN0xSNRHvfTyDj1adBUpOMERXlKxEQsR0qtyV/n Johw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=DdzvoSy2h2u5B6dtluZVRVLXIvWmyO3wmCU9GEAMkSM=; b=mAPfY5fv0zpvro4JimjBwImXPo1nwMq3AVYZF7HGsUYLRd7CATLe+TQnqIiGth6oFl OIhaiothcmrFP5t2hmvBmt0ebL0xkfv5lj1ZGdBWdEbVNiMFIfUsQck0FkbeXTOG7POe CzKy92LQU/BnWhQrwusfFrapOxeZM1ry4trxsTi1TdM91De9M8ho1XTB6lQ+5k+q1o7m 9Y3vdpCnCPH7vq76rAfc3zO0frqi+t6tXjQDpszm6+r73krH7YWTFs0Lt3nmy2hhQx2h Wv1oO20aKDM5tq06JMRwtDrD8SlUqwFrQR2sZMDjktEcwifSwEDXIQuZQBw6NI9YNnze 7VnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gNdAIDjU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13-v6si45829811pgj.229.2018.11.06.08.36.52; Tue, 06 Nov 2018 08:37:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gNdAIDjU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389278AbeKGCBL (ORCPT + 99 others); Tue, 6 Nov 2018 21:01:11 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:45350 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387685AbeKGCBL (ORCPT ); Tue, 6 Nov 2018 21:01:11 -0500 Received: by mail-pl1-f194.google.com with SMTP id o19-v6so6438824pll.12 for ; Tue, 06 Nov 2018 08:35:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=DdzvoSy2h2u5B6dtluZVRVLXIvWmyO3wmCU9GEAMkSM=; b=gNdAIDjUgEk0J/V+ZzUawg2xno7kGvH2+uL520CKi2f+CTfbgdC0TEroPk3naDdk2/ GF1uF/hGvZxMv5ARQuLF0YN4UJF0US+ipfg5Qr+9PmBUCmX4VfhqfcmPLbizNiWQUX+X CC22ULHw5tuf+YlPYlf44/+94Ne2jIWwh3RFJ/vIDOsPBEDpBMhEwkPJ4lq/3pkryLXp voKm0+GZ6ZZIF8NgrZLnFgDdFoCCRAD3ymMsIr3c/Fm4oB0AwOdGs2k193WKQomrId/O rgFVC47mon0swj/yf5byAKIVYwyEIh5itShfbeei9b+xGnwL8wlzA+uwqRQVYqhYo+kt S+bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DdzvoSy2h2u5B6dtluZVRVLXIvWmyO3wmCU9GEAMkSM=; b=Rboo8RaV42P1UKz3FkplpmfAVnuqkaF/WF6t5ghogWK5JcCrRqpDRizY33FKXl2xgE vfhmRfkLb+1xJhzB0v+O+8ugh03OFcgWUJwYw5KPkdHSmf2bCQMg+V2pgfLDL3fuxmfx IbLpwzYNgaSZeYOjicUgyTMOtJRNSDUrkNT1ZTc6uxwOzf+STNGbiju1wrh7Y6ArSFfk vADzIETpZTgwzWZnQgZMjkcofjv2BbKLHA71Ssk7LNFKWEBRY47wbMucI8tpaS+4J2IW s+F4z5qn4asK6azr1NCm9BjNkiUnNtFWCeZNWOsZAM6eytkkOKmxJF4Avf0tNp4nhQtR J9hg== X-Gm-Message-State: AGRZ1gIRu8TPmpvsIrl+B4H8FLlfnhwsZuXz57tv5cmUA2XAktWlBIyD m/+nntcJCmSVIM6UZ0XfCdU= X-Received: by 2002:a17:902:b943:: with SMTP id h3-v6mr25557646pls.124.1541522110933; Tue, 06 Nov 2018 08:35:10 -0800 (PST) Received: from ubuntu.localdomain ([104.238.150.158]) by smtp.gmail.com with ESMTPSA id t77-v6sm39005730pfj.79.2018.11.06.08.35.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Nov 2018 08:35:10 -0800 (PST) From: Kaitao Cheng To: gregkh@linuxfoundation.org Cc: rafael@kernel.org, linux-kernel@vger.kernel.org, smuchun@gmail.com, pilgrimtao@163.com, Kaitao cheng Subject: [PATCH] driver core: Replace simple_strto{l,ul} by kstrtou{l,ul} Date: Tue, 6 Nov 2018 08:34:54 -0800 Message-Id: <1541522094-5113-1-git-send-email-pilgrimtao@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kaitao cheng The simple_strto{l,ul} are deprecated, use kstrtou{l,ul} instead. Signed-off-by: Kaitao cheng --- drivers/base/core.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 04bbcd7..ed145fb 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -794,10 +794,12 @@ ssize_t device_store_ulong(struct device *dev, const char *buf, size_t size) { struct dev_ext_attribute *ea = to_ext_attr(attr); - char *end; - unsigned long new = simple_strtoul(buf, &end, 0); - if (end == buf) - return -EINVAL; + int ret; + unsigned long new; + + ret = kstrtoul(buf, 0, &new); + if (ret) + return ret; *(unsigned long *)(ea->var) = new; /* Always return full write size even if we didn't consume all */ return size; @@ -818,9 +820,14 @@ ssize_t device_store_int(struct device *dev, const char *buf, size_t size) { struct dev_ext_attribute *ea = to_ext_attr(attr); - char *end; - long new = simple_strtol(buf, &end, 0); - if (end == buf || new > INT_MAX || new < INT_MIN) + int ret; + long new; + + ret = kstrtol(buf, 0, &new); + if (ret) + return ret; + + if (new > INT_MAX || new < INT_MIN) return -EINVAL; *(int *)(ea->var) = new; /* Always return full write size even if we didn't consume all */ -- 2.7.4