LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Immad Mir <mirimmad@outlook.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	open list <linux-kernel@vger.kernel.org>,
	Nicholas Piggin <npiggin@gmail.com>,
	"open list:LINUX FOR POWERPC \(32-BIT AND 64-BIT\)"
	<linuxppc-dev@lists.ozlabs.org>, Immad Mir <mirimmad17@gmail.com>
Subject: Re: [PATCH] powerpc/powernv: use appropiate error code
Date: Fri, 13 Oct 2023 13:03:23 +0000	[thread overview]
Message-ID: <96d2ce59-9662-2f27-1322-8f9efa4ba248@csgroup.eu> (raw)
In-Reply-To: <CY5PR12MB64558C413B3D8A60AA5C202DC6E4A@CY5PR12MB6455.namprd12.prod.outlook.com>



Le 01/09/2023 à 20:03, Immad Mir a écrit :
> 
> On 01/09/23 11:10 pm, Christophe Leroy wrote:
>>
>> Le 01/09/2023 à 19:19, mirimmad@outlook.com a écrit :
>>> [Vous ne recevez pas souvent de courriers de mirimmad@outlook.com. 
>>> Découvrez pourquoi ceci est important à 
>>> https://aka.ms/LearnAboutSenderIdentification ]
>>>
>>> From: Immad Mir <mirimmad17@gmail.com>
>>>
>>> -1 is not a valid error code. This patch replaces it with -EPERM.
>> Can you explain how it will work ?
>> In scom_debug_init() rc is built by oring the value returned by
>> scom_debug_init_one().
>> What will be the result when oring some valid values with -EPERM ?
>> It was working well with -1 because when you or -1 with anything you get
>> -1 as result. But with your change I don't think it will work.
> 
> 
> if EPERM is not always necessarily equal to 1, we can put a check in 
> scom_debug_init before returning rc. If it is less than 1 (because AFAIK 
> or-ring with negative number results back into the same negative number) 
> we set rc equal to -1.
> 

The point is that EPERM is 1 by coincidence, the intention here is not 
to return -EPERM but really -1, so by changing this you just make the 
code harded to understand and maintain.

Christophe

      reply	other threads:[~2023-10-13 13:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 17:19 [PATCH] powerpc/powernv: use appropiate error code mirimmad
2023-09-01 17:40 ` Christophe Leroy
2023-09-01 17:57   ` Immad Mir
2023-09-01 18:03   ` Immad Mir
2023-10-13 13:03     ` Christophe Leroy [this message]

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=96d2ce59-9662-2f27-1322-8f9efa4ba248@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mirimmad17@gmail.com \
    --cc=mirimmad@outlook.com \
    --cc=npiggin@gmail.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