Skip to content

Commit 2328fe7

Browse files
Jiapeng Chongtiwai
authored andcommitted
firewire: convert sysfs sprintf/snprintf family to sysfs_emit
Fix the following coccicheck warning: ./drivers/firewire/core-device.c:375:8-16: WARNING: use scnprintf or sprintf. Reported-by: Abaci Robot<[email protected]> Signed-off-by: Jiapeng Chong <[email protected]> Signed-off-by: Takashi Sakamoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent dda8ad0 commit 2328fe7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/firewire/core-device.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,7 @@ static ssize_t rom_index_show(struct device *dev,
372372
struct fw_device *device = fw_device(dev->parent);
373373
struct fw_unit *unit = fw_unit(dev);
374374

375-
return snprintf(buf, PAGE_SIZE, "%d\n",
376-
(int)(unit->directory - device->config_rom));
375+
return sysfs_emit(buf, "%td\n", unit->directory - device->config_rom);
377376
}
378377

379378
static struct device_attribute fw_unit_attributes[] = {
@@ -403,8 +402,7 @@ static ssize_t guid_show(struct device *dev,
403402
int ret;
404403

405404
down_read(&fw_device_rwsem);
406-
ret = snprintf(buf, PAGE_SIZE, "0x%08x%08x\n",
407-
device->config_rom[3], device->config_rom[4]);
405+
ret = sysfs_emit(buf, "0x%08x%08x\n", device->config_rom[3], device->config_rom[4]);
408406
up_read(&fw_device_rwsem);
409407

410408
return ret;

0 commit comments

Comments
 (0)