From patchwork Fri Dec 23 17:50:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 36314 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp441412wrn; Fri, 23 Dec 2022 09:55:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXsjq2EXqUecvnZlgQnQfnOHZYYi7S5swESJ4gKoOZHHNUDWfGmqz2pFoD62D6DFK8HMeKcE X-Received: by 2002:aa7:c053:0:b0:482:e3b9:f46e with SMTP id k19-20020aa7c053000000b00482e3b9f46emr566193edo.39.1671818121543; Fri, 23 Dec 2022 09:55:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671818121; cv=none; d=google.com; s=arc-20160816; b=fzGqNdB9/nZLc5oKdOWgVzXhf2HIMEK0QRovRVRi6B35PH13oQg0/jczF+7dinmTBD lQjt89/Lv8JyP2R9erDRX8zIcIaVlBjTG276QF5BQ7jqqM2tbiOzqQ9v3Ht5p1FZH1wR 2BMJFBuB1lc5ozALdwUouxKpQhOvuPnJKg0uRt5tn/KupWwG29pTK3GlByFFdvma62ka IWxPHCt2UxkNZ3GHaeVKT5AP0CdrlFdASkr3hjrT07tLBfXBS0S3YEHIzfgVLf+8GcEk EHQImHR5jOVxNjJhJeu5SHijrBhx7QhNpiMgcSWpvs+VAgW0BzLTwBPGDzOs8T2s+Tlw fmvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=KKZS9sW8/+wDR/fbOofEvnkIQKLl9wpBCg48OaABRYE=; b=BtYCfSPNvJfq3aeyKIiV8oRYgdoPcXiT3YAlZotEX+VlaUlAGA+3kHLyfzIpXkfMmO x0LD8y58UozdYodDN2LmFrPwAv2CGJ+bncJFSWeKBFwOat8PFmY5sBpD/u+Z/y4OY5Ty MpsPkdXIFszVoG0QkjAEubMS8z0Ua/e8vf0iZem0OrmeBsxBRArcwZ/+EvBcrSmfb2d0 u+sU6zLQ134THb9K0AffLS0CSo8/bEwaDhByhzOI4iIfuXGXUJ2zGeHlFSaP6Ylv+qOn tC3BNozBmLvT5cKiMyxYChTuDU6XdsxfQ2ZurYM24lb+0hea9V74xFvqRYzM4GNKGr4i 5+1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=d96PIxz9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr6-20020a170907720600b007c0bc4924cbsi2987195ejc.963.2022.12.23.09.54.58; Fri, 23 Dec 2022 09:55:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=d96PIxz9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231228AbiLWRuR (ORCPT + 99 others); Fri, 23 Dec 2022 12:50:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230436AbiLWRuP (ORCPT ); Fri, 23 Dec 2022 12:50:15 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 865761B788 for ; Fri, 23 Dec 2022 09:50:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1671817806; bh=8XfoPlzImUAHKNdpkCBbzwpmjauMz1KWndmkX7b/pJc=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=d96PIxz9JWzFR/ua84Jnoe2EOAZwcmDCLXZFMBg9+78FbtPxczhubBLd7/dctKmVD MhHXntjbXqK946ZhBlTsDzpUirvXaNnEdVPubxO+gVNFauyGIHDj+HDgNhtqyghCBf 1OvKo8WFSG34fgwppF5speuQt2Frk98crO3iOg4U= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Fri, 23 Dec 2022 18:50:06 +0100 (CET) X-EA-Auth: DVajdD7weMqrqtua+2G6c4mEPQI9VnPTajIFbsEaPZCRlRQBoT8UVBWWhMtSxD2kyRHas2vjEUwD0jRM8pDqfWFm3IIxpU5D Date: Fri, 23 Dec 2022 23:20:02 +0530 From: Deepak R Varma To: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , drv@mailo.com Subject: [PATCH] scsi: aic94xx: Use sysfs_emit in show function callsbacks Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753028358571552784?= X-GMAIL-MSGID: =?utf-8?q?1753028358571552784?= According to Documentation/filesystems/sysfs.rst, the show() callback function of kobject attributes should strictly use sysfs_emit instead of sprintf family functions. Issue identified using the coccinelle device_attr_show.cocci script. Signed-off-by: Deepak R Varma --- drivers/scsi/aic94xx/aic94xx_init.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.34.1 diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index 954d0c5ae2e2..35ac5b91cb1c 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c @@ -264,8 +264,7 @@ static ssize_t asd_show_dev_rev(struct device *dev, struct device_attribute *attr, char *buf) { struct asd_ha_struct *asd_ha = dev_to_asd_ha(dev); - return snprintf(buf, PAGE_SIZE, "%s\n", - asd_dev_rev[asd_ha->revision_id]); + return sysfs_emit(buf, "%s\n", asd_dev_rev[asd_ha->revision_id]); } static DEVICE_ATTR(aic_revision, S_IRUGO, asd_show_dev_rev, NULL); @@ -273,7 +272,7 @@ static ssize_t asd_show_dev_bios_build(struct device *dev, struct device_attribute *attr,char *buf) { struct asd_ha_struct *asd_ha = dev_to_asd_ha(dev); - return snprintf(buf, PAGE_SIZE, "%d\n", asd_ha->hw_prof.bios.bld); + return sysfs_emit(buf, "%d\n", asd_ha->hw_prof.bios.bld); } static DEVICE_ATTR(bios_build, S_IRUGO, asd_show_dev_bios_build, NULL); @@ -281,7 +280,7 @@ static ssize_t asd_show_dev_pcba_sn(struct device *dev, struct device_attribute *attr, char *buf) { struct asd_ha_struct *asd_ha = dev_to_asd_ha(dev); - return snprintf(buf, PAGE_SIZE, "%s\n", asd_ha->hw_prof.pcba_sn); + return sysfs_emit(buf, "%s\n", asd_ha->hw_prof.pcba_sn); } static DEVICE_ATTR(pcba_sn, S_IRUGO, asd_show_dev_pcba_sn, NULL); @@ -452,7 +451,7 @@ static ssize_t asd_show_update_bios(struct device *dev, if (asd_ha->bios_status != FLASH_IN_PROGRESS) asd_ha->bios_status = FLASH_OK; - return snprintf(buf, PAGE_SIZE, "status=%x %s\n", + return sysfs_emit(buf, "status=%x %s\n", flash_error_table[i].err_code, flash_error_table[i].reason); }