diff mbox series

[1/2] drm/qxl: remove unused `count` variable from `qxl_surface_id_alloc()`

Message ID 20240327175556.233126-1-ojeda@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/qxl: remove unused `count` variable from `qxl_surface_id_alloc()` | expand

Commit Message

Miguel Ojeda March 27, 2024, 5:55 p.m. UTC
Clang 14 in an (essentially) defconfig loongarch64 build for next-20240326
reports [1]:

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

The variable is already unused in the version that got into the tree.

Thus remove the unused variable.

Fixes: f64122c1f6ad ("drm: add new QXL driver. (v1.4)")
Closes: https://lore.kernel.org/lkml/CANiq72mjc5t4n25SQvYSrOEhxxpXYPZ4pPzneSJHEnc3qApu2Q@mail.gmail.com/
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
Given there is a loop going on here, it would be good to double-check whether
this variable was supposed to be used for something useful or if it was just a
remnant of a version previous to v1.4.

 drivers/gpu/drm/qxl/qxl_cmd.c | 2 --
 1 file changed, 2 deletions(-)


base-commit: 26074e1be23143b2388cacb36166766c235feb7c
--
2.44.0

Comments

Miguel Ojeda March 27, 2024, 6:14 p.m. UTC | #1
On Wed, Mar 27, 2024 at 6:56 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Closes: https://lore.kernel.org/lkml/CANiq72mjc5t4n25SQvYSrOEhxxpXYPZ4pPzneSJHEnc3qApu2Q@mail.gmail.com/

Should have a [1] at the end.

> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> Given there is a loop going on here, it would be good to double-check whether
> this variable was supposed to be used for something useful or if it was just a
> remnant of a version previous to v1.4.

Also, I see Nathan sent meanwhile a message about these two that were
also mentioned/reported a while ago [1].

On my side, I noticed these due to my loongarch64 defconfig
compile-test with Rust enabled yesterday [2], but I don't want to step
on Tom/Colin/Nathan/ClangBuiltLinux's work, so please feel free to do
with these patches as you will!

Thanks!

Cheers,
Miguel

[1] https://lore.kernel.org/all/20240327163331.GB1153323@dev-arch.thelio-3990X/
[2] https://lore.kernel.org/lkml/CANiq72mjc5t4n25SQvYSrOEhxxpXYPZ4pPzneSJHEnc3qApu2Q@mail.gmail.com/
Maxime Ripard March 28, 2024, 10:18 a.m. UTC | #2
On Wed, Mar 27, 2024 at 07:14:12PM +0100, Miguel Ojeda wrote:
> On Wed, Mar 27, 2024 at 6:56 PM Miguel Ojeda <ojeda@kernel.org> wrote:
> >
> > Closes: https://lore.kernel.org/lkml/CANiq72mjc5t4n25SQvYSrOEhxxpXYPZ4pPzneSJHEnc3qApu2Q@mail.gmail.com/
> 
> Should have a [1] at the end.

I added it while committing

> > Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> > ---
> > Given there is a loop going on here, it would be good to double-check whether
> > this variable was supposed to be used for something useful or if it was just a
> > remnant of a version previous to v1.4.
> 
> Also, I see Nathan sent meanwhile a message about these two that were
> also mentioned/reported a while ago [1].

"a while ago" here being 2 hours before your message :)

I've added a Closes tag for that report too.

I've applied both patches to drm-misc-fixes, thanks!
Maxime
Miguel Ojeda March 28, 2024, 2:07 p.m. UTC | #3
On Thu, Mar 28, 2024 at 11:18 AM Maxime Ripard <mripard@kernel.org> wrote:
>
> "a while ago" here being 2 hours before your message :)

Ah, I meant the original reports that Nathan mentioned in his message.
Yeah, the message itself from Nathan happened right before :)

> I've added a Closes tag for that report too.
>
> I've applied both patches to drm-misc-fixes, thanks!

My pleasure!

Cheers,
Miguel
diff mbox series

Patch

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);