drm/qxl: remove unused `count` variable from `qxl_surface_id_alloc()`
Subsystems (4)
PATCH 1/2 drm/qxl: remove unused `count` variable from `qxl_surface_id_alloc()`
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.
---
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(-)
drivers/gpu/drm/qxl/qxl_cmd.c +0 -2
@@ -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);
base-commit: 26074e1be23143b2388cacb36166766c235feb7c --
2.44.0
PATCH 2/2 drm/qxl: remove unused variable from `qxl_process_single_command()`
Clang 14 in an (essentially) defconfig loongarch64 build for next-20240327 reports [1]:
drivers/gpu/drm/qxl/qxl_ioctl.c:148:14: error: variable 'num_relocs' set but not used [-Werror,-Wunused-but-set-variable]
The variable was originally used in the out_free_bos label, but commit 74d9a6335dce ("drm/qxl: Simplify cleaning qxl processing command") removed the use that happened in that label.
Thus remove the unused variable.
--- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/qxl/qxl_ioctl.c +1 -3
@@ -145,7 +145,7 @@ static int qxl_process_single_command(struct qxl_device *qdev,struct qxl_release *release;struct qxl_bo *cmd_bo;void *fb_cmd; -int i, ret, num_relocs; +int i, ret;int unwritten;switch (cmd->type) {
@@ -200,7 +200,6 @@ static int qxl_process_single_command(struct qxl_device *qdev, }/* fill out reloc info structs */ - num_relocs =0 ;for (i =0 ; i < cmd->relocs_num; ++i) {struct drm_qxl_reloc reloc;struct drm_qxl_reloc __user *u =u64_to_user_ptr (cmd->relocs);
@@ -230,7 +229,6 @@ static int qxl_process_single_command(struct qxl_device *qdev, reloc_info[i].dst_bo = cmd_bo; reloc_info[i].dst_offset = reloc.dst_offset + release->release_offset; } - num_relocs++;/* reserve and validate the reloc dst bo */ if (reloc.reloc_type ==QXL_RELOC_TYPE_BO || reloc.src_handle) {
Signature · 1 line
2.44.0
Quoted 2 lines · Miguel Ojeda
Should have a [1] at the end.
Quoted 5 lines
Signed-off-by Miguel Ojeda <[email protected]>---
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/[email protected]/
[2] https://lore.kernel.org/lkml/CANiq72mjc5t4n25SQvYSrOEhxxpXYPZ4pPzneSJHEnc3qApu2Q@mail.gmail.com/
Quoted 5 lines · Miguel Ojeda
Quoted 2 lines · Miguel Ojeda
Should have a [1] at the end.
I added it while committing
Quoted 8 lines
Quoted 5 lines
Signed-off-by Miguel Ojeda <[email protected]>---
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
Quoted 2 lines · Maxime Ripard
"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 :)
Quoted 3 lines
I've added a Closes tag for that report too.
I've applied both patches to drm-misc-fixes, thanks!
My pleasure!
Cheers,
Miguel