Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3483259pxb; Mon, 4 Apr 2022 18:25:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQfH63SU1Vg4FooDW1QeHsbdnZMqlYaraiFh8CNb+RCIL/jpWuv1QnftqSBZNarg+B7ZfN X-Received: by 2002:a17:90b:124c:b0:1bc:369b:7db5 with SMTP id gx12-20020a17090b124c00b001bc369b7db5mr1212600pjb.179.1649121905807; Mon, 04 Apr 2022 18:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649121905; cv=none; d=google.com; s=arc-20160816; b=qFXYAiDBUXBUbzQba8nNl83aAG0eTjXhS+vuat4soyiNtR3TBT9BduTBl+Bo5Deiio lQ8Btj9CtLcJJGTX1b4o67B5cV7TxIfKqGVv3rPpp+xLcSGuMWLB0X6GzKBV5TFHM1CF CXrGxGr6ce4+JYOpZnBXOcTFUDIVnaylMr9Xg0LKfffgR3tTAcXdXeITwN62eNvQ8Rtf UPwgw5VsEgxooiI9Giis12X+OZqHoIJChGO5tnCoQFEO5mXsvbrlTWLqo4hY696Aa7Ls vgvYBXcM4MBmNWUdZitKQVBn85MfbURqER/B96XhgKdTHvuMC0iGwaQhWRBypFVVOKzm /Xfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R/tvg3uRGIE0KrYAUNPFffEwKAn+dQ4a002G6oSnT/U=; b=Ur7U4JhODlMHFapMBa1OG1KsyfwdmejVe9TubZRqmw547Fh7+qyYRsDXVOFBen13ms UwPD8KSQzgq783ySVThFZ1rgeIhE1Rool7UgYHxrsP18N+Luz3HJ9SXO+0Bk6lXwZWoA 8kOrqtEYdZDVjfsJ0RfzBclNcawkQ4mAb8Kixjatl1S/QtiL8gENGUh7sNZSYzXlIUuZ taamqBifCQrpsBZpjM/W8cjVZlyvdmP0TTDMtHoafs1kwqaoAcqpQe3Rn2pd0Q3lKyuW DEt2R0phvD5aKpka+Ye2XMgwyffRgkDTjIiPsE/7ktQtUdEfzcerfuxYdzue+cxpFNwU hXfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nOGggC4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i13-20020a170902eb4d00b00153b2d16431si12010396pli.57.2022.04.04.18.25.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:25:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nOGggC4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4338915283A; Mon, 4 Apr 2022 17:15:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347034AbiDAO3F (ORCPT + 99 others); Fri, 1 Apr 2022 10:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346974AbiDAO23 (ORCPT ); Fri, 1 Apr 2022 10:28:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0917E28256B; Fri, 1 Apr 2022 07:26:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B9E82B8240F; Fri, 1 Apr 2022 14:26:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E9EC340EE; Fri, 1 Apr 2022 14:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648823195; bh=iJAefKwV0vXB8+ooJfoNg3L+br/xXcmwSH/DsOucH7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nOGggC4ga4e+BajblFD6kG9nYBqlPEQc1qlaPq26MtTcJMsPAC1aP7iEt9G7gVR78 mHzxGVxW4vHspPLK4NkSs+d1AohOS2X3lwyykBW88wpuwLRhEXpqrnCHgrHeLn8HEl HELbign2LzxCAULwGWl/qH7EZsSrrTeH6l9blHzlnEgolWx7LjcV0VqBIU9rFie0f0 Phw71kW4xIh6H8eiHIdMe9Br9UqzPE+iPIqp8Bsw6e6fE/OTrfGujEKtbnaKVXFhVX eZrd1XxaM5aq9K/gjdMr9n9IdsJSZj77Pql0MnGY0Av/MqpORBJxDntCagBgNeK9E1 q0nmplwTeKXwA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Guang , Zeal Robot , David Yang , Richard Cochran , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.17 017/149] ptp: replace snprintf with sysfs_emit Date: Fri, 1 Apr 2022 10:23:24 -0400 Message-Id: <20220401142536.1948161-17-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220401142536.1948161-1-sashal@kernel.org> References: <20220401142536.1948161-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Guang [ Upstream commit e2cf07654efb0fd7bbcb475c6f74be7b5755a8fd ] coccinelle report: ./drivers/ptp/ptp_sysfs.c:17:8-16: WARNING: use scnprintf or sprintf ./drivers/ptp/ptp_sysfs.c:390:8-16: WARNING: use scnprintf or sprintf Use sysfs_emit instead of scnprintf or sprintf makes more sense. Reported-by: Zeal Robot Signed-off-by: Yang Guang Signed-off-by: David Yang Acked-by: Richard Cochran Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/ptp/ptp_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c index 41b92dc2f011..9233bfedeb17 100644 --- a/drivers/ptp/ptp_sysfs.c +++ b/drivers/ptp/ptp_sysfs.c @@ -14,7 +14,7 @@ static ssize_t clock_name_show(struct device *dev, struct device_attribute *attr, char *page) { struct ptp_clock *ptp = dev_get_drvdata(dev); - return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name); + return sysfs_emit(page, "%s\n", ptp->info->name); } static DEVICE_ATTR_RO(clock_name); @@ -387,7 +387,7 @@ static ssize_t ptp_pin_show(struct device *dev, struct device_attribute *attr, mutex_unlock(&ptp->pincfg_mux); - return snprintf(page, PAGE_SIZE, "%u %u\n", func, chan); + return sysfs_emit(page, "%u %u\n", func, chan); } static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr, -- 2.34.1