Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4044033pxb; Wed, 13 Oct 2021 19:21:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN2kFym2YdXvadQOQloVyB+em4XC9UpfVBLPPrQivxmH3bOv0h5UDkpQ7J22XMM4O+Fp69 X-Received: by 2002:a50:9d42:: with SMTP id j2mr4771210edk.7.1634178086937; Wed, 13 Oct 2021 19:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634178086; cv=none; d=google.com; s=arc-20160816; b=MlimgzCMlQ0AzR+xxuw/MfN3Xj+4JsYUQeW8n7dLDxhDtiEOOEIzuZVzJflAzTx4ru c1I5FR2B+XRIRDUTMHCn2hMFLU2of+tXrqB/yXf7a3R5uv/J6X2TZN4gb9VpGJyJA9id j0s46gCR6Vn9/BM3ut/g3eql1joCngphCTGBGaFc4uZpZqiPvPTIyxIo01n0LAPPaLCY k0LL6e83XAFNt5Qb1Mm/FZcIwagWvAVsPvFxP/CrzIax8Ie8QBQ9K7jGEeMI/esn4WUZ MIsr0vTiSNaMsQWZMtGViiR2X0vY4/7mO6tvTPF3xhi7HBDiXCoWhJYc+msQTI02dRmi hjPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:dmarc-filter:sender:dkim-signature; bh=XSbXa21D/SkXtwXPfvMkrPRiyfn9xefybQEGW6SCGhw=; b=tVENd6Rf5LhLdEZfNKEjpndSiks7HMNcZ5iXTp95lTrX55crv8wv+HpYw4UF8Fqvve jnWeeS0gymfw+o3YmvfWlC+olTpEymXDkYAfvlgciC85ujWH8CPfMtBxhWRG1X7/cqr7 Kcf0+OksQhhLKgVYQuQT6K2Td/u9qwRLQmw5cXhqSE1yqP4P/yRCBoEjt4jXzwnIJm78 3H87xLld9iqlP+lQMEFAR8lJrbyO3n/CA78qtl85TouU8BQMjD+lwWf84MNuoZ0Ux1o3 f3iPP0qBw+RPWoVpyHKJSWpovLhSOfBCgMDahIXnCIbz06aSL7+TPw7p5c0MemVxdHJA cYog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=qCviduSE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sc23si2555565ejc.407.2021.10.13.19.21.02; Wed, 13 Oct 2021 19:21:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=qCviduSE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbhJNCRU (ORCPT + 99 others); Wed, 13 Oct 2021 22:17:20 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:21341 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbhJNCRQ (ORCPT ); Wed, 13 Oct 2021 22:17:16 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1634177712; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: To: Subject: Sender; bh=XSbXa21D/SkXtwXPfvMkrPRiyfn9xefybQEGW6SCGhw=; b=qCviduSE5rFqATlqn7CX7XcSNrWsxXeM1ds0ibe8Qjxx79hVk4Ib3xlRmt9G3LEet9vDd3Do 8UtBrwJmu2I4wUA+5Va7pzogzAFSOYPsSGKyzUC1+Fr8bXZj/jJgMmmtTLSjFwycUvVeyixk SUsNlZuIoSyDvlXo3biLvKd1tbQ= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-west-2.postgun.com with SMTP id 6167929830ce13d2b4b6ce44 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 14 Oct 2021 02:14:48 GMT Sender: hemantk=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 71FA2C43616; Thu, 14 Oct 2021 02:14:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from [10.110.17.128] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: hemantk) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9F549C4338F; Thu, 14 Oct 2021 02:14:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 9F549C4338F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org Subject: Re: [PATCH] bus: mhi: replace snprintf in show functions with sysfs_emit To: Qing Wang , Manivannan Sadhasivam , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <1634095550-3978-1-git-send-email-wangqing@vivo.com> From: Hemant Kumar Message-ID: <28c9d7d7-ab45-cf7a-18c7-2940952d3e10@codeaurora.org> Date: Wed, 13 Oct 2021 19:14:46 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <1634095550-3978-1-git-send-email-wangqing@vivo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/12/2021 8:25 PM, Qing Wang wrote: > coccicheck complains about the use of snprintf() in sysfs show functions. > > Fix the following coccicheck warning: > drivers/bus/mhi/core/init.c:97:8-16: WARNING: use scnprintf or sprintf. > > Use sysfs_emit instead of scnprintf or sprintf makes more sense. > > Signed-off-by: Qing Wang > --- > drivers/bus/mhi/core/init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c > index c81b377..f3ddefe 100644 > --- a/drivers/bus/mhi/core/init.c > +++ b/drivers/bus/mhi/core/init.c > @@ -94,7 +94,7 @@ static ssize_t serial_number_show(struct device *dev, > struct mhi_device *mhi_dev = to_mhi_device(dev); > struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl; > > - return snprintf(buf, PAGE_SIZE, "Serial Number: %u\n", > + return sysfs_emit(buf, "Serial Number: %u\n", > mhi_cntrl->serial_number); > } > static DEVICE_ATTR_RO(serial_number); > Reviewed-by: Hemant Kumar -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project