Re: [PATCH] Input: synaptics-rmi4: Use %pe for error codes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 01, 2023 at 05:40:55PM -0700, Dmitry Torokhov wrote:
> On Sat, Apr 29, 2023 at 08:41:19PM +0200, Michał Mirosław wrote:
> > Make the error messages a bit easier to understand by showing
> > error names where that's enabled.
> > 
> > Signed-off-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
> > ---
> >  drivers/input/rmi4/rmi_driver.c | 66 +++++++++++++++++----------------
> >  1 file changed, 34 insertions(+), 32 deletions(-)
> > 
> > diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
> > index 258d5fe3d395..82d85c02a873 100644
> > --- a/drivers/input/rmi4/rmi_driver.c
> > +++ b/drivers/input/rmi4/rmi_driver.c
> > @@ -69,8 +69,8 @@ static int reset_one_function(struct rmi_function *fn)
> >  	if (fh->reset) {
> >  		retval = fh->reset(fn);
> >  		if (retval < 0)
> > -			dev_err(&fn->dev, "Reset failed with code %d.\n",
> > -				retval);
> > +			dev_err(&fn->dev, "Reset failed: %pe\n",
> > +				ERR_PTR(retval));
> 
> If this is desired we should have a format option for
> non-err-ptr-encoded errors.

This is a common case in the kernel source to use "%pe" with ERR_PTR().

The code in `lib/vsprintf.c` has only '%p' with extended treatment and
I'm not sure how much work would be needed to extend other format
specifier (I would consider confusing if "%p" would possibly take
something that's not a pointer).

Best Regards
Michał Mirosław



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux