[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_N3JiRShWTa7N+C+b_-cBxOiyAo_XiDSn0W-J3LaUfqgA@mail.gmail.com>
Date: Thu, 8 Jan 2026 13:08:12 -0500
From: Alex Deucher <alexdeucher@...il.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org, amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: Slightly simplify base_addr_show()
On Sun, Dec 21, 2025 at 10:31 AM Christophe JAILLET
<christophe.jaillet@...adoo.fr> wrote:
>
> sysfs_emit_at() never returns a negative error code. It returns 0 or the
> number of characters written in the buffer.
>
> Remove the useless tests. This simplifies the logic and saves a few lines
> of code.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Applied. Thanks!
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index 20d05a3e4516..b44f0710b00e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -888,22 +888,19 @@ static ssize_t num_base_addresses_show(struct ip_hw_instance *ip_hw_instance, ch
>
> static ssize_t base_addr_show(struct ip_hw_instance *ip_hw_instance, char *buf)
> {
> - ssize_t res, at;
> + ssize_t at;
> int ii;
>
> - for (res = at = ii = 0; ii < ip_hw_instance->num_base_addresses; ii++) {
> + for (at = ii = 0; ii < ip_hw_instance->num_base_addresses; ii++) {
> /* Here we satisfy the condition that, at + size <= PAGE_SIZE.
> */
> if (at + 12 > PAGE_SIZE)
> break;
> - res = sysfs_emit_at(buf, at, "0x%08X\n",
> + at += sysfs_emit_at(buf, at, "0x%08X\n",
> ip_hw_instance->base_addr[ii]);
> - if (res <= 0)
> - break;
> - at += res;
> }
>
> - return res < 0 ? res : at;
> + return at;
> }
>
> static struct ip_hw_instance_attr ip_hw_attr[] = {
> --
> 2.52.0
>
Powered by blists - more mailing lists