kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: ohad@wizery.com, bjorn.andersson@linaro.org,
	mathieu.poirier@linaro.org, s-anna@ti.com,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] remoteproc: k3-r5: Fix an error message
Date: Fri, 7 May 2021 07:58:39 +0200	[thread overview]
Message-ID: <5cdff9cf-945a-fe47-b117-3c9d9f11e987@wanadoo.fr> (raw)
In-Reply-To: <20210507052647.GF1955@kadam>

Le 07/05/2021 à 07:26, Dan Carpenter a écrit :
> On Thu, May 06, 2021 at 10:46:01PM +0200, Christophe JAILLET wrote:
>> 'ret' is known to be 0 here.
>> Reorder the code so that the expected error code is printed.
>>
>> Fixes: 6dedbd1d5443 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>>   drivers/remoteproc/ti_k3_r5_remoteproc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c
>> index 5cf8d030a1f0..4104e4846dbf 100644
>> --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
>> +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
>> @@ -1272,9 +1272,9 @@ static int k3_r5_core_of_init(struct platform_device *pdev)
>>   
>>   	core->tsp = k3_r5_core_of_get_tsp(dev, core->ti_sci);
>>   	if (IS_ERR(core->tsp)) {
>> +		ret = PTR_ERR(core->tsp);
>>   		dev_err(dev, "failed to construct ti-sci proc control, ret = %d\n",
>>   			ret);
> 
> I recently learned about the %pe format specifier, which prints "-ENOMEM"
> instead of -12.

Hi Dan,

I see that we are reading the same ML  :)


Well, I'm a bit puzzled by it.
On one hand, it is more user-friendly. On the other hand it is not 
widely used up to now.

So is it better to keep the legacy way of reporting error code?

Do you know if there is preferred way?

Using it after a IS_ERR is straightforward, but should we also do things 
like (kmalloc usually don't need error message, just given as an example):
     x = kmalloc(...);
     if (!x)
         dev_err(dev, "Memory allocation failure (%pe)\n",
                 ERR_PTR(-ENOMEM));

When changing a message and make use of %pe, should all the messages in 
the neighborhood be changed as well to keep some kind of consistancy?

CJ

> 
> 		dev_err(dev, "failed to construct ti-sci proc control, ret = %pe\n",
> 			core->tsp);
> regards,
> dan carpenter
> 
> 
> 


  reply	other threads:[~2021-05-07  5:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06 20:46 [PATCH] remoteproc: k3-r5: Fix an error message Christophe JAILLET
2021-05-06 23:51 ` Suman Anna
2021-05-07  5:26 ` Dan Carpenter
2021-05-07  5:58   ` Christophe JAILLET [this message]
2021-05-07  6:59     ` Dan Carpenter

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=5cdff9cf-945a-fe47-b117-3c9d9f11e987@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=bjorn.andersson@linaro.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=ohad@wizery.com \
    --cc=s-anna@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).