[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <96d2ce59-9662-2f27-1322-8f9efa4ba248@csgroup.eu>
Date: Fri, 13 Oct 2023 13:03:23 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Immad Mir <mirimmad@...look.com>
CC: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
Immad Mir <mirimmad17@...il.com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
"open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)"
<linuxppc-dev@...ts.ozlabs.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] powerpc/powernv: use appropiate error code
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@...look.com a écrit :
>>> [Vous ne recevez pas souvent de courriers de mirimmad@...look.com.
>>> Découvrez pourquoi ceci est important à
>>> https://aka.ms/LearnAboutSenderIdentification ]
>>>
>>> From: Immad Mir <mirimmad17@...il.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
Powered by blists - more mailing lists