Re: [PATCH v6 1/8] spmi: Print error status with %pe format
From: AngeloGioacchino Del Regno
Date: Tue Oct 21 2025 - 04:07:05 EST
Il 18/10/25 21:12, Andy Shevchenko ha scritto:
On Thu, Oct 16, 2025 at 12:43:55PM +0200, AngeloGioacchino Del Regno wrote:
Instead of printing just a number, use the %pe format for error
status, increasing readability of error prints.
...
err = device_add(&sdev->dev);
if (err < 0) {
- dev_err(&sdev->dev, "Can't add %s, status %d\n",
- dev_name(&sdev->dev), err);
+ dev_err(&sdev->dev, "Can't add %s, status %pe\n",
+ dev_name(&sdev->dev), ERR_PTR(err));
LOL, I only now noticed that the parameter to dev_err() and dev_name() is the
same. For christ's sake, why do we need dev_name()?
Just only for consistency and having the exact same message as function
spmi_device_add() and nothing else.
I agree that it's not really needed; if you want I can just change the
error message in both spmi_device_add() and in the new function that I
am introducing here.
Cheers,
Angelo
goto err_device_add;
}