Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1336314imu; Wed, 28 Nov 2018 08:07:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/VxS5+Km+5TY1ZHHHcZvxy1F4dol6S01kQi5HHXpOHHikwHYYWt+pb01aF0jTNa+0lb4qso X-Received: by 2002:a62:5a83:: with SMTP id o125-v6mr23631696pfb.40.1543421226395; Wed, 28 Nov 2018 08:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543421226; cv=none; d=google.com; s=arc-20160816; b=Timi+vLChvj+AY6RKtHNWYmBpQ5+GgB7+TJWGl3OPQrIMnu/FRp1JgUnCHcTOalHaI Z2cwaGKw0sN+nuM7NJZtl1HfxAStNNd39aY5pH14pB4t74yRpPTmgawl05uysyHUDVCF 3HBym9mLHYkEIAra0hYFoA6DpnH/KpGNrVI7iKEyPRPP3iTf/gUlXL4Fd4vLbvxMKKn2 fKCV3n+VDYSn7wDN5hdtJTAS2VsNILCokLJMFDp+Cm/OmnDPVZMeMN6p6P1LASLBPUhj qciSY8fDmZFJqWJF7YYRxM4rb3cyi5KbozZ2UCuuxXBWDqOG5i1UHncAlmBEmuiZ1/dq 64Lw== 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=lW1BZX0bMFu0mLdGp+n6XPc+fUEIFjmdlrwMxcxBHIIzZZ2VVUBFwiH6mXDBXIN14d gUAkvlaw+PRdABGb5dCfhlxfQ70TS4cXfa8hYO2V/U86POo0QBY+pJ+Odcf4dZkiv9pz ahGdUPjo3xJFxbBumVFFGjnrNiPDoP4IcniUoYp4x5VIsnRUdHryUDLlGVR+fjUMludw WuAgSdQEwuRJi5c48RydtveOqJbWjYAm6PXNWcnbbKQkA2bV+sRKBTgpB4OjM9++nwLq cHI3thz+06R7sp8sAtXvfk2TmEa+MQDCGjn8gFTg5hUsteh8Gz9ZOYQ+a6BR3yE7Lp52 0c6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Gw4B6iW+; 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 59si8941711ple.291.2018.11.28.08.06.18; Wed, 28 Nov 2018 08:07:06 -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=Gw4B6iW+; 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 S1728977AbeK2DFO (ORCPT + 99 others); Wed, 28 Nov 2018 22:05:14 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42108 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727979AbeK2DFN (ORCPT ); Wed, 28 Nov 2018 22:05:13 -0500 Received: by mail-pf1-f193.google.com with SMTP id 64so10359359pfr.9 for ; Wed, 28 Nov 2018 08:03:05 -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=Gw4B6iW+qdnhgfd/FAdkgikS8HhOs7Vp4qshaFNkY1Sn4wGxu5fuJaA9NnFgkNcwtU xaXhVkJR/bRpuVlCYV9f5hNZBBU/TjiiktSjbaVttBmKZScI3Ztcwf+eSmeHkQErb/nH eycWmvoUbmXn6JhmAbKHiC0EWL0ycY2L61vGtmcEaT9eRyFM18OIOS378aaFNfDA90JZ cL/BN7qXssFBFuQuHpTViq//5v9hEM80LJgGO1XPgXDM8xqgv59OAmKr4PQ7l/ZU7AxF /CqZLRvxdg+1e60IgIErySjA3/WsSCQG5EsFDBifS+S78vg1oW1BC8hW0GtofZA+dxKs fuYQ== 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=JQjoRL11YWWDmJ7ONfWAD9DljMV9rFi/4HuzA1MNTxGO+HzaJUbFtclmEuRlmIvqbF gdIDldrJkInFATukruYxhazsAf3eKNYEQ1DawYURAi8UKxL2RC0bVW2cvZlZO9Iec9ha IojOOTGjCDBIo7Y3HcmoQgk5m46aqGcYNBD1SmottTS8WRdO7oo2nZKmYL3nro3nH6dB mABg57GimItLYUQzw1vUjNl212n4yTffjRvpuBi3mnf9sQsA5fNiDBYjYxO/Q4w0IC5k Q8Mh9HvT42YESWA+w5UV6/EmPJvD7DvxWYH7I0qERN8RgT5J028wONJo6OBaAVRu4jVk Mmpw== X-Gm-Message-State: AA+aEWYqr/8+yVO0UyYd+gCRO+ypbvzo6IUCOWrNciZE7Cw/E/FZn+SX l4CsIDQomQJkhPL8OG96uCc= X-Received: by 2002:a63:e711:: with SMTP id b17mr32685960pgi.363.1543420984721; Wed, 28 Nov 2018 08:03:04 -0800 (PST) Received: from ubuntu.localdomain ([104.238.150.158]) by smtp.gmail.com with ESMTPSA id i123sm15823809pfg.164.2018.11.28.08.03.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 08:03:04 -0800 (PST) From: Kaitao Cheng To: gregkh@linuxfoundation.org Cc: rafael@kernel.org, smuchun@gmail.com, pilgrimtao@163.com, linux-kernel@vger.kernel.org, Kaitao cheng Subject: [PATCH RESEND v2] driver core: Replace simple_strto{l,ul} by kstrtou{l,ul} Date: Wed, 28 Nov 2018 08:02:49 -0800 Message-Id: <20181128160249.6082-1-pilgrimtao@gmail.com> X-Mailer: git-send-email 2.17.1 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