All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
To: <mathieu.poirier@linaro.org>
Cc: <bjorn.andersson@linaro.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-remoteproc@vger.kernel.org>, <mark-pk.tsai@mediatek.com>,
	<matthias.bgg@gmail.com>, <ohad@wizery.com>,
	<yj.chiang@mediatek.com>
Subject: Re: [PATCH v2] remoteproc: use %pe format string to print return error code
Date: Tue, 16 Nov 2021 21:57:03 +0800	[thread overview]
Message-ID: <20211116135703.19432-1-mark-pk.tsai@mediatek.com> (raw)
In-Reply-To: <CANLsYkzsoXw8vCC-OBqHyQv216Rbjf9ZR7FuFK-zxC7gMzt9Kg@mail.gmail.com>

> > > > Use %pe format string to print return error code which
> > > > make the error message easier to understand.
> > > >
> > > > Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
> > > > ---
> > > >  drivers/remoteproc/remoteproc_core.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> > > > index 502b6604b757..2242da320368 100644
> > > > --- a/drivers/remoteproc/remoteproc_core.c
> > > > +++ b/drivers/remoteproc/remoteproc_core.c
> > > > @@ -575,8 +575,8 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
> > > >                                            dma_get_mask(rproc->dev.parent));
> > > >         if (ret) {
> > > >                 dev_warn(dev,
> > > > -                        "Failed to set DMA mask %llx. Trying to continue... %x\n",
> > > > -                        dma_get_mask(rproc->dev.parent), ret);
> > > > +                        "Failed to set DMA mask %llx. Trying to continue... (%pe)\n",
> > > > +                        dma_get_mask(rproc->dev.parent), ERR_PTR(ret));
> > >
> > > Macro ERR_PTR() is used to convert error codes to pointer type when
> > > returning from a function - I fail to see how doing so in a dev_warn()
> > > context can make the message easier to understand.  Can you provide an
> > > example?
> >
> > Hi,
> >
> > When dma_coerce_mask_and_coherent() fail, the output log will be as following.
> >
> > format          log
> > %x              Trying to continue... fffffffb
> > %d              Trying to continue... -5
> > %pe             Trying to continue... -5        (if CONFIG_SYMBOLIC_ERRNAME is not set)
> > %pe             Trying to continue... -EIO      (if CONFIG_SYMBOLIC_ERRNAME=y)
>
> When failing, functions dma_coerce_mask_and_coherent() returns -EIO.
> Casting that to a (void *) with ERR_PTR() does not change that value.
> Since variable @ret is already declared as "int" the real fix is to
> change "%x" to "%d".

There're some other drivers do the same thing in the recent kernel, so I think
it's fine to casting the `ret` to a (void *) for more user friendly.
But I suppose it would depend on the maintainer's opinion.

So how about previous patch I sent, which also fix this issue by using %d.

https://lore.kernel.org/lkml/20211102120805.27137-1-mark-pk.tsai@mediatek.com/


WARNING: multiple messages have this Message-ID (diff)
From: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
To: <mathieu.poirier@linaro.org>
Cc: <bjorn.andersson@linaro.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-remoteproc@vger.kernel.org>, <mark-pk.tsai@mediatek.com>,
	<matthias.bgg@gmail.com>, <ohad@wizery.com>,
	<yj.chiang@mediatek.com>
Subject: Re: [PATCH v2] remoteproc: use %pe format string to print return error code
Date: Tue, 16 Nov 2021 21:57:03 +0800	[thread overview]
Message-ID: <20211116135703.19432-1-mark-pk.tsai@mediatek.com> (raw)
In-Reply-To: <CANLsYkzsoXw8vCC-OBqHyQv216Rbjf9ZR7FuFK-zxC7gMzt9Kg@mail.gmail.com>

> > > > Use %pe format string to print return error code which
> > > > make the error message easier to understand.
> > > >
> > > > Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
> > > > ---
> > > >  drivers/remoteproc/remoteproc_core.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> > > > index 502b6604b757..2242da320368 100644
> > > > --- a/drivers/remoteproc/remoteproc_core.c
> > > > +++ b/drivers/remoteproc/remoteproc_core.c
> > > > @@ -575,8 +575,8 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
> > > >                                            dma_get_mask(rproc->dev.parent));
> > > >         if (ret) {
> > > >                 dev_warn(dev,
> > > > -                        "Failed to set DMA mask %llx. Trying to continue... %x\n",
> > > > -                        dma_get_mask(rproc->dev.parent), ret);
> > > > +                        "Failed to set DMA mask %llx. Trying to continue... (%pe)\n",
> > > > +                        dma_get_mask(rproc->dev.parent), ERR_PTR(ret));
> > >
> > > Macro ERR_PTR() is used to convert error codes to pointer type when
> > > returning from a function - I fail to see how doing so in a dev_warn()
> > > context can make the message easier to understand.  Can you provide an
> > > example?
> >
> > Hi,
> >
> > When dma_coerce_mask_and_coherent() fail, the output log will be as following.
> >
> > format          log
> > %x              Trying to continue... fffffffb
> > %d              Trying to continue... -5
> > %pe             Trying to continue... -5        (if CONFIG_SYMBOLIC_ERRNAME is not set)
> > %pe             Trying to continue... -EIO      (if CONFIG_SYMBOLIC_ERRNAME=y)
>
> When failing, functions dma_coerce_mask_and_coherent() returns -EIO.
> Casting that to a (void *) with ERR_PTR() does not change that value.
> Since variable @ret is already declared as "int" the real fix is to
> change "%x" to "%d".

There're some other drivers do the same thing in the recent kernel, so I think
it's fine to casting the `ret` to a (void *) for more user friendly.
But I suppose it would depend on the maintainer's opinion.

So how about previous patch I sent, which also fix this issue by using %d.

https://lore.kernel.org/lkml/20211102120805.27137-1-mark-pk.tsai@mediatek.com/


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
To: <mathieu.poirier@linaro.org>
Cc: <bjorn.andersson@linaro.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-remoteproc@vger.kernel.org>, <mark-pk.tsai@mediatek.com>,
	<matthias.bgg@gmail.com>, <ohad@wizery.com>,
	<yj.chiang@mediatek.com>
Subject: Re: [PATCH v2] remoteproc: use %pe format string to print return error code
Date: Tue, 16 Nov 2021 21:57:03 +0800	[thread overview]
Message-ID: <20211116135703.19432-1-mark-pk.tsai@mediatek.com> (raw)
In-Reply-To: <CANLsYkzsoXw8vCC-OBqHyQv216Rbjf9ZR7FuFK-zxC7gMzt9Kg@mail.gmail.com>

> > > > Use %pe format string to print return error code which
> > > > make the error message easier to understand.
> > > >
> > > > Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
> > > > ---
> > > >  drivers/remoteproc/remoteproc_core.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> > > > index 502b6604b757..2242da320368 100644
> > > > --- a/drivers/remoteproc/remoteproc_core.c
> > > > +++ b/drivers/remoteproc/remoteproc_core.c
> > > > @@ -575,8 +575,8 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
> > > >                                            dma_get_mask(rproc->dev.parent));
> > > >         if (ret) {
> > > >                 dev_warn(dev,
> > > > -                        "Failed to set DMA mask %llx. Trying to continue... %x\n",
> > > > -                        dma_get_mask(rproc->dev.parent), ret);
> > > > +                        "Failed to set DMA mask %llx. Trying to continue... (%pe)\n",
> > > > +                        dma_get_mask(rproc->dev.parent), ERR_PTR(ret));
> > >
> > > Macro ERR_PTR() is used to convert error codes to pointer type when
> > > returning from a function - I fail to see how doing so in a dev_warn()
> > > context can make the message easier to understand.  Can you provide an
> > > example?
> >
> > Hi,
> >
> > When dma_coerce_mask_and_coherent() fail, the output log will be as following.
> >
> > format          log
> > %x              Trying to continue... fffffffb
> > %d              Trying to continue... -5
> > %pe             Trying to continue... -5        (if CONFIG_SYMBOLIC_ERRNAME is not set)
> > %pe             Trying to continue... -EIO      (if CONFIG_SYMBOLIC_ERRNAME=y)
>
> When failing, functions dma_coerce_mask_and_coherent() returns -EIO.
> Casting that to a (void *) with ERR_PTR() does not change that value.
> Since variable @ret is already declared as "int" the real fix is to
> change "%x" to "%d".

There're some other drivers do the same thing in the recent kernel, so I think
it's fine to casting the `ret` to a (void *) for more user friendly.
But I suppose it would depend on the maintainer's opinion.

So how about previous patch I sent, which also fix this issue by using %d.

https://lore.kernel.org/lkml/20211102120805.27137-1-mark-pk.tsai@mediatek.com/


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-11-16 13:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 14:15 [PATCH v2] remoteproc: use %pe format string to print return error code Mark-PK Tsai
2021-11-02 14:15 ` Mark-PK Tsai
2021-11-02 14:15 ` Mark-PK Tsai
2021-11-11 18:18 ` Mathieu Poirier
2021-11-11 18:18   ` Mathieu Poirier
2021-11-11 18:18   ` Mathieu Poirier
2021-11-12  2:13   ` Mark-PK Tsai
2021-11-12  2:13     ` Mark-PK Tsai
2021-11-12  2:13     ` Mark-PK Tsai
2021-11-12 16:25     ` Mathieu Poirier
2021-11-12 16:25       ` Mathieu Poirier
2021-11-12 16:25       ` Mathieu Poirier
2021-11-16 13:57       ` Mark-PK Tsai [this message]
2021-11-16 13:57         ` Mark-PK Tsai
2021-11-16 13:57         ` Mark-PK Tsai
2021-11-16 16:29         ` Mathieu Poirier
2021-11-16 16:29           ` Mathieu Poirier
2021-11-16 16:29           ` Mathieu Poirier
2021-12-13  7:20           ` Mark-PK Tsai
2021-12-13  7:20             ` Mark-PK Tsai
2021-12-13  7:20             ` Mark-PK Tsai
2021-12-13 16:55             ` Mathieu Poirier
2021-12-13 16:55               ` Mathieu Poirier
2021-12-13 16:55               ` Mathieu Poirier
2021-12-14  1:31               ` Mark-PK Tsai
2021-12-14  1:31                 ` Mark-PK Tsai
2021-12-14  1:31                 ` Mark-PK Tsai
2021-11-17 14:59 ` Bjorn Andersson
2021-11-17 14:59   ` Bjorn Andersson
2021-11-17 14:59   ` Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211116135703.19432-1-mark-pk.tsai@mediatek.com \
    --to=mark-pk.tsai@mediatek.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=matthias.bgg@gmail.com \
    --cc=ohad@wizery.com \
    --cc=yj.chiang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.