Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5387551imm; Sun, 26 Aug 2018 18:45:14 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbo5kOWoJnXyIYL3w21G4KlKMAmp+S0DCkulVMZTxcStBIPM8H6PP9lsyzuQ8+3r3Z4+48u X-Received: by 2002:a63:3245:: with SMTP id y66-v6mr10300777pgy.101.1535334314078; Sun, 26 Aug 2018 18:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535334314; cv=none; d=google.com; s=arc-20160816; b=EwSofr/ACIiPd6PYCeYCHluGf9XX0xcjwpJDG0J6IhJKVBsf55YhYDvN+Mao6obEa7 VZXU23WyYM8t7RUWhzFNHeHI17uZyNzFY6LDkFU3HmipbwVyDsFgDC8itun/y9fWKcsM oonwM4B6YTi5OdxuNP2UQlPJY7TvtCdNcnliHlmPsZmzJvQZa4cj8pVr+jFV/YLZdP56 mPUiBUG6f4dLqyJkAcUNaMcFQ4/VeGSKAW063q3s0NDp4AJ8JEyW95YD6VI16QM8g+Em CLEIcyyCz3FB1QzlHi72k7rqAkzCigHF3oVKmuAusZAthXRb/MROVxlCStouPmuzO2FR oPVw== 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=XIHnwkDLdjSuKFLfr9R/Y4+Wn1D2bHhFM6HUDimKAkg=; b=yMr0yBNWJ+bdwBx/nBJO7am5uPyw2JDxcQQ2+3dTjexm5IqX1y6FpvQX9mne49JYc7 nSkWkTLcQwVHcxPTF3u9DyBPnVjGqjJwd3E7p6F5PO2/1tZ5DHUnW+4i9wvtHYE02/v9 KW+w7GDz3fqcjSmVl3k9eOhJd1bHOQ2nvp8zj0J52I0VquoQqwxR3HCZV4+3CuS9oeHU ZVv+05+A9mAAQy1LncdZc04L8RJPVPvqTiUljzDSjIsYWcaouqUs5X4wrJo4oeqldllV 6CwJP+ZCcXbQ9STQR65CMBTJVuyzIJvgQijKhyBXYwBmBXToKyQzQJFdR/IY4VfJL08O hZ8w== 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 184-v6si12984738pgb.587.2018.08.26.18.44.58; Sun, 26 Aug 2018 18:45:14 -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 S1727027AbeH0F2U (ORCPT + 99 others); Mon, 27 Aug 2018 01:28:20 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:34653 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbeH0F2T (ORCPT ); Mon, 27 Aug 2018 01:28:19 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.9]) by rmmx-syy-dmz-app07-12007 (RichMail) with SMTP id 2ee75b835755c7d-00741; Mon, 27 Aug 2018 09:43:49 +0800 (CST) X-RM-TRANSID: 2ee75b835755c7d-00741 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from bclinux72.localdomain (unknown[223.105.0.243]) by rmsmtp-syy-appsvr05-12005 (RichMail) with SMTP id 2ee55b835753896-e26b6; Mon, 27 Aug 2018 09:43:49 +0800 (CST) X-RM-TRANSID: 2ee55b835753896-e26b6 From: Ding Xiang To: marcel@holtmann.org, johan.hedberg@gmail.com, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V3] Bluetooth: bt3c_cs: Fix obsolete function Date: Sun, 26 Aug 2018 22:55:00 -0400 Message-Id: <1535338500-7682-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 kstrtouint instead. V2: fix error tmp += tn V3: fix compile error 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..5471383 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -448,7 +448,7 @@ static int bt3c_load_firmware(struct bt3c_info *info, { char *ptr = (char *) firmware; char b[9]; - unsigned int iobase, tmp; + unsigned int iobase, tmp, tn; unsigned long size, addr, fcs; int i, err = 0; @@ -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 (kstrtouint(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 (kstrtouint(b, 16, &tmp)) + return -EINVAL; bt3c_put(iobase, tmp); } } -- 1.8.3.1