From patchwork Mon Jun 13 02:35:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xuezhi Zhang X-Patchwork-Id: 12878916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 880F3C433EF for ; Mon, 13 Jun 2022 02:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236205AbiFMCg5 (ORCPT ); Sun, 12 Jun 2022 22:36:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234610AbiFMCgx (ORCPT ); Sun, 12 Jun 2022 22:36:53 -0400 Received: from m12-13.163.com (m12-13.163.com [220.181.12.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D83C13193A; Sun, 12 Jun 2022 19:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=tPJq6 gucZx+Wp1lUC5ETt48nGtlt3Xy3NEt/XUEDBHI=; b=QmFJDv4PPFAL1b4vdRuRg ubprrklRX44kwkPMTJHmgvFJ5GX5OgHEyfScb//kEUWkY+emcK9gLGKxMYQRY6qS yfQXtWtKV+xuBf7WIiGwtqpneQMdfHlxN1alCF56jDnSMDOvUbjYR52dAapNJG+j 9mEXJuNhQKxqJLksThTe98= Received: from carlis-virtual-machine (unknown [218.17.89.92]) by smtp9 (Coremail) with SMTP id DcCowABn0SOWoqZifKK3Ig--.39550S2; Mon, 13 Jun 2022 10:36:06 +0800 (CST) From: Xuezhi Zhang To: gregkh@linuxfoundation.org, zhangxuezhi1@coolpad.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] usb: core: sysfs: convert sysfs snprintf to sysfs_emit Date: Mon, 13 Jun 2022 10:35:53 +0800 Message-Id: <20220613023553.103441-1-zhangxuezhi1@coolpad.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CM-TRANSID: DcCowABn0SOWoqZifKK3Ig--.39550S2 X-Coremail-Antispam: 1Uf129KBjvJXoWrZrWxCrWrWw43JF48XFW8Zwb_yoW8Jr1xpF 4rGayUArWUGw1xu3W5CFsFva4Fgas2ya47W3yxJw15u3srA3yDKFyDAFW5Gr18XrWxCFyS yF17KFW5WayxKFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jv89NUUUUU= X-Originating-IP: [218.17.89.92] Sender: llyz108@163.com X-CM-SenderInfo: xoo16iiqy6il2tof0z/1tbiFRkfhV5mLNpnpgAAsZ Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Fix the following coccicheck warnings: drivers/usb/core/sysfs.c:921:8-16: WARNING: use scnprintf or sprintf drivers/usb/core/sysfs.c:730:8-16: WARNING: use scnprintf or sprintf Signed-off-by: Xuezhi Zhang --- v2: add correct public mailing list --- drivers/usb/core/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index fa2e49d432ff..6387c0dfe30e 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -727,7 +727,7 @@ static ssize_t authorized_show(struct device *dev, struct device_attribute *attr, char *buf) { struct usb_device *usb_dev = to_usb_device(dev); - return snprintf(buf, PAGE_SIZE, "%u\n", usb_dev->authorized); + return sysfs_emit(buf, "%u\n", usb_dev->authorized); } /* @@ -918,7 +918,7 @@ static ssize_t authorized_default_show(struct device *dev, struct usb_hcd *hcd; hcd = bus_to_hcd(usb_bus); - return snprintf(buf, PAGE_SIZE, "%u\n", hcd->dev_policy); + return sysfs_emit(buf, "%u\n", hcd->dev_policy); } static ssize_t authorized_default_store(struct device *dev,