[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <eaefefb6-7ced-4c47-8bff-bae83f143b72@vivo.com>
Date: Wed, 27 Aug 2025 10:15:03 +0800
From: Qianfeng Rong <rongqianfeng@...o.com>
To: Lizhi Hou <lizhi.hou@....com>, Min Ma <min.ma@....com>,
Oded Gabbay <ogabbay@...nel.org>, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] accel/amdxdna: Use int instead of u32 to store error
codes
在 2025/8/27 0:31, Lizhi Hou 写道:
>
> On 8/26/25 00:29, Qianfeng Rong wrote:
>> Change the 'ret' variable from u32 to int to store -EINVAL, reducing
>> potential risks such as incorrect results when comparing 'ret' with
>> error codes.
>
> Sounds this fixes code issue. Could you add "Fixes" tag?
>
>
The 'ret' variable stores negative error codes directly. Storing
error codes in u32 (an unsigned type) causes no runtime issues but is
stylistically inconsistent and very ugly.
Logical errors with 'ret' only occur when it is compared against negative
error codes. For example:
u32 ret = -EINVAL; // ret becomes an extremely large unsigned integer
if (ret == -EINVAL) // This condition will never be true
This patch reduces the likelihood of such issues occurring. Since it does
not fix an existing bug, I believe there is no need to add a Fixes tag.
Best regards,
Qianfeng
Powered by blists - more mailing lists