[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y6XqSnPb/y/GMTiX@qemulion>
Date: Fri, 23 Dec 2022 23:20:02 +0530
From: Deepak R Varma <drv@...lo.com>
To: "James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Saurabh Singh Sengar <ssengar@...rosoft.com>,
Praveen Kumar <kumarpraveen@...ux.microsoft.com>, drv@...lo.com
Subject: [PATCH] scsi: aic94xx: Use sysfs_emit in show function callsbacks
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 <drv@...lo.com>
---
drivers/scsi/aic94xx/aic94xx_init.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
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);
}
--
2.34.1
Powered by blists - more mailing lists