diff options
author | Yang Guang <yang.guang5@zte.com.cn> | 2021-11-30 01:04:11 +0100 |
---|---|---|
committer | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2021-12-02 05:13:45 +0100 |
commit | 06d5d558f5a30582546dcbe9327601af867ce1c9 (patch) | |
tree | ffeee240089d71d16fb05c504ed62fb1ec235a48 /drivers/ata/libata-sata.c | |
parent | sata_fsl: fix warning in remove_proc_entry when rmmod sata_fsl (diff) | |
download | linux-06d5d558f5a30582546dcbe9327601af867ce1c9.tar.xz linux-06d5d558f5a30582546dcbe9327601af867ce1c9.zip |
ata: replace snprintf in show functions with sysfs_emit
coccinelle report:
./drivers/ata/libata-sata.c:830:8-16:
WARNING: use scnprintf or sprintf
Use sysfs_emit instead of scnprintf or sprintf makes more sense.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/ata/libata-sata.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 5b78e86e3459..b9c77885b872 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -827,7 +827,7 @@ static ssize_t ata_scsi_lpm_show(struct device *dev, if (ap->target_lpm_policy >= ARRAY_SIZE(ata_lpm_policy_names)) return -EINVAL; - return snprintf(buf, PAGE_SIZE, "%s\n", + return sysfs_emit(buf, "%s\n", ata_lpm_policy_names[ap->target_lpm_policy]); } DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR, |