Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2628862imm; Fri, 24 Aug 2018 02:34:34 -0700 (PDT) X-Google-Smtp-Source: ANB0VdasGGkcI1cmwYw0Gn9TszKJWDeLLcncUPgYtiSzhQNei3zjm+QplXWjeczJII24Dv4eMN2k X-Received: by 2002:a17:902:7586:: with SMTP id j6-v6mr867660pll.295.1535103274460; Fri, 24 Aug 2018 02:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535103274; cv=none; d=google.com; s=arc-20160816; b=NzSSlawYTFLuCrj/KfffVaYmnHUynnCApMgMsSoxuAHbC3IbN8dO8urLkRu2dqugta 0MfDEjhqIPuY9hVe9B621P1hdezjgQmMUNwmaPNjyZNkiXIrFnfMIVtJ2S5WPFWrHfHe p+qEuEZZPSv4LyQTrwhfRJRkO5M8taNfKKrAwJ5/O5YGea4qXeEGnc/WSiLDNXX16p45 TzyJL8QL1Bup27/t5R0JagJp5Y5sSzKy9N4DR1uamk3NwO7I7db9U3GPkqZwnAdm3Nsa 8PC0sgtmYX4hsgQItNuYBRqmnmDK5/evuqlKEhUNHOu962W1ZKHD0Zvlt3rX8SSVEf7A 3Tdg== 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:to:from :arc-authentication-results; bh=+j9m636q4azH8t/GdDDXUeGulFKZttdeRlgUSknOSF0=; b=i4oTqiSMIrdxmjdnFNJfkIShxeAreZFJBRG4+5Fu1jVh7adERvShka3HLiydvLFBRX mYAEcM79UpmP29mCQ1PDK1U+Iv/VuMGXjgB9Daviwb8FRa7H3POxWGxzuxm2P4QSMLgi poeaiaGtixUBq+QVfn6o6ha4Oxaj6Gt9MQW55yRwSSVCMEpLZrF7osj70g1JbMgUjd3U xtAVxtGu0RXIckKQsbB6VacHPLYll5bymcqWMaRLQf2yZ7xE0KiyVTMFcYSI7/7VrI7O 8CncRKrzbzPdebH5oJV3qp4riUkgfXdOGq2dRESmD8ujPMGXwguWR3j5zs7GkwlTUIwq CUtA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20-v6si6446020pgm.406.2018.08.24.02.34.19; Fri, 24 Aug 2018 02:34:34 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbeHXNG6 (ORCPT + 99 others); Fri, 24 Aug 2018 09:06:58 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:38115 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbeHXNG6 (ORCPT ); Fri, 24 Aug 2018 09:06:58 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app08-12008 (RichMail) with SMTP id 2ee85b7fd0d1de7-da7fc; Fri, 24 Aug 2018 17:33:05 +0800 (CST) X-RM-TRANSID: 2ee85b7fd0d1de7-da7fc X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from bclinux72.localdomain (unknown[223.105.0.243]) by rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id 2ee35b7fd0d0bcb-475a2; Fri, 24 Aug 2018 17:33:05 +0800 (CST) X-RM-TRANSID: 2ee35b7fd0d0bcb-475a2 From: Ding Xiang To: marcel@holtmann.org, johan.hedberg@gmail.com, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2] Bluetooth: bt3c_cs: Fix obsolete function Date: Fri, 24 Aug 2018 06:44:25 -0400 Message-Id: <1535107465-5470-1-git-send-email-dingxiang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org simple_strtol and simple_strtoul are obsolete, both place use kstrtoul instead. V2: fix error tmp += tn Signed-off-by: Ding Xiang --- drivers/bluetooth/bt3c_cs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 25b0cf9..8f03774 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -449,7 +449,7 @@ static int bt3c_load_firmware(struct bt3c_info *info, char *ptr = (char *) firmware; char b[9]; unsigned int iobase, tmp; - unsigned long size, addr, fcs; + unsigned long size, addr, fcs, tn; int i, err = 0; iobase = info->p_dev->resource[0]->start; @@ -490,7 +490,9 @@ static int bt3c_load_firmware(struct bt3c_info *info, memset(b, 0, sizeof(b)); for (tmp = 0, i = 0; i < size; i++) { memcpy(b, ptr + (i * 2) + 2, 2); - tmp += simple_strtol(b, NULL, 16); + if (kstrtoul(b, 16, &tn)) + return -EINVAL; + tmp += tn; } if (((tmp + fcs) & 0xff) != 0xff) { @@ -505,7 +507,8 @@ static int bt3c_load_firmware(struct bt3c_info *info, memset(b, 0, sizeof(b)); for (i = 0; i < (size - 4) / 2; i++) { memcpy(b, ptr + (i * 4) + 12, 4); - tmp = simple_strtoul(b, NULL, 16); + if (kstrtoul(b, 16, &tmp)) + return -EINVAL; bt3c_put(iobase, tmp); } } -- 1.8.3.1