scsi: aic94xx: Use sysfs_emit in show function callsbacks
PATCH 1/1 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 <[email protected]>
--- drivers/scsi/aic94xx/aic94xx_init.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/scsi/aic94xx/aic94xx_init.c +4 -5
@@ -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
Quoted 7 lines · Deepak R Varma
According to
Documentation/filesystems/sysfs.rst, theshow()callback function of kobject attributes should strictly usesysfs_emitinstead of sprintf family functions.
Issue identified using the coccinelledevice_attr_show.cocciscript.Signed-off-by Deepak R Varma <[email protected]>---
Hello,
Requesting a review and feedback on this patch proposal. There are a few other similar patches for other scsi drivers that also need your comments. Request to also review those.
Thank you,
./drv