2024-03-26 18:05:26

by Miguel Ojeda

[permalink] [raw]
Subject: drivers/gpu/drm/qxl/qxl_cmd.c:424:6: error: variable 'count' set but not used

Hi,

In today's next, I got:

drivers/gpu/drm/qxl/qxl_cmd.c:424:6: error: variable 'count' set
but not used [-Werror,-Wunused-but-set-variable]

`count` seems to be there since commit f64122c1f6ad ("drm: add new QXL
driver. (v1.4)").

Untested diff below -- if you want a formal patch, please let me know.

Cheers,
Miguel

diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
index 281edab518cd..d6ea01f3797b 100644
--- a/drivers/gpu/drm/qxl/qxl_cmd.c
+++ b/drivers/gpu/drm/qxl/qxl_cmd.c
@@ -421,7 +421,6 @@ int qxl_surface_id_alloc(struct qxl_device *qdev,
{
uint32_t handle;
int idr_ret;
- int count = 0;
again:
idr_preload(GFP_ATOMIC);
spin_lock(&qdev->surf_id_idr_lock);
@@ -433,7 +432,6 @@ int qxl_surface_id_alloc(struct qxl_device *qdev,
handle = idr_ret;

if (handle >= qdev->rom->n_surfaces) {
- count++;
spin_lock(&qdev->surf_id_idr_lock);
idr_remove(&qdev->surf_id_idr, handle);
spin_unlock(&qdev->surf_id_idr_lock);


2024-03-27 08:01:49

by Maxime Ripard

[permalink] [raw]
Subject: Re: drivers/gpu/drm/qxl/qxl_cmd.c:424:6: error: variable 'count' set but not used

Hi Miguel,

On Tue, Mar 26, 2024 at 07:04:34PM +0100, Miguel Ojeda wrote:
> Hi,
>
> In today's next, I got:
>
> drivers/gpu/drm/qxl/qxl_cmd.c:424:6: error: variable 'count' set
> but not used [-Werror,-Wunused-but-set-variable]
>
> `count` seems to be there since commit f64122c1f6ad ("drm: add new QXL
> driver. (v1.4)").
>
> Untested diff below -- if you want a formal patch, please let me know.
>
> Cheers,
> Miguel
>
> diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
> index 281edab518cd..d6ea01f3797b 100644
> --- a/drivers/gpu/drm/qxl/qxl_cmd.c
> +++ b/drivers/gpu/drm/qxl/qxl_cmd.c
> @@ -421,7 +421,6 @@ int qxl_surface_id_alloc(struct qxl_device *qdev,
> {
> uint32_t handle;
> int idr_ret;
> - int count = 0;
> again:
> idr_preload(GFP_ATOMIC);
> spin_lock(&qdev->surf_id_idr_lock);
> @@ -433,7 +432,6 @@ int qxl_surface_id_alloc(struct qxl_device *qdev,
> handle = idr_ret;
>
> if (handle >= qdev->rom->n_surfaces) {
> - count++;
> spin_lock(&qdev->surf_id_idr_lock);
> idr_remove(&qdev->surf_id_idr, handle);
> spin_unlock(&qdev->surf_id_idr_lock);
>

It looks reasonable to me, can you send a formal patch?

Thanks!
Maxime


Attachments:
(No filename) (1.30 kB)
signature.asc (281.00 B)
Download all attachments

2024-03-27 15:13:13

by Miguel Ojeda

[permalink] [raw]
Subject: Re: drivers/gpu/drm/qxl/qxl_cmd.c:424:6: error: variable 'count' set but not used

On Wed, Mar 27, 2024 at 8:59 AM Maxime Ripard <[email protected]> wrote:
>
> It looks reasonable to me, can you send a formal patch?

Will do -- I found another one when running the CI with the above one fixed:

drivers/gpu/drm/qxl/qxl_ioctl.c:148:14: error: variable
'num_relocs' set but not used [-Werror,-Wunused-but-set-variable]

I will send you one for that too then.

Thanks!

Cheers,
Miguel

2024-03-27 18:16:13

by Miguel Ojeda

[permalink] [raw]
Subject: Re: drivers/gpu/drm/qxl/qxl_cmd.c:424:6: error: variable 'count' set but not used

On Wed, Mar 27, 2024 at 3:43 PM Miguel Ojeda
<[email protected]> wrote:
>
> Will do -- I found another one when running the CI with the above one fixed:
>
> drivers/gpu/drm/qxl/qxl_ioctl.c:148:14: error: variable
> 'num_relocs' set but not used [-Werror,-Wunused-but-set-variable]
>
> I will send you one for that too then.

Done: https://lore.kernel.org/lkml/[email protected]/

Cheers,
Miguel