Skip to content

Commit 25c1772

Browse files
christian-heuselaxboe
authored andcommitted
block: print symbolic error name instead of error code
Utilize the %pe print specifier to get the symbolic error name as a string (i.e "-ENOMEM") in the log message instead of the error code to increase its readablility. This change was suggested in https://lore.kernel.org/all/92972476-0b1f-4d0a-9951-af3fc8bc6e65@suswa.mountain/ Signed-off-by: Christian Heusel <christian@heusel.eu> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20240111231521.1596838-1-christian@heusel.eu Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 5266caa commit 25c1772

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

block/partitions/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,8 @@ static bool blk_add_partition(struct gendisk *disk,
562562
part = add_partition(disk, p, from, size, state->parts[p].flags,
563563
&state->parts[p].info);
564564
if (IS_ERR(part) && PTR_ERR(part) != -ENXIO) {
565-
printk(KERN_ERR " %s: p%d could not be added: %ld\n",
566-
disk->disk_name, p, -PTR_ERR(part));
565+
printk(KERN_ERR " %s: p%d could not be added: %pe\n",
566+
disk->disk_name, p, part);
567567
return true;
568568
}
569569

0 commit comments

Comments
 (0)