Skip to contentSkip to conversation

bus: fsl-mc: remove unused free_count variable

PATCH In review Tom Rix 2 participants 2 messages Mar 31, 2023 – Apr 7, 2023 QorIQ DPAA2 fsl-mc bus driver

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 bus: fsl-mc: remove unused free_count variable

clang with W=1 reports drivers/bus/fsl-mc/fsl-mc-allocator.c:560:6: error: variable
'free_count' set but not used [-Werror,-Wunused-but-set-variable]

        int free_count = 0;
            ^

This variable is not used so remove it.

---
 drivers/bus/fsl-mc/fsl-mc-allocator.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/bus/fsl-mc/fsl-mc-allocator.c +1 -4
index dced427ca8ba..f1351237a9d5 100644
@@ -557,12 +557,9 @@ static void fsl_mc_cleanup_resource_pool(struct fsl_mc_device *mc_bus_dev,
 	struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
 	struct fsl_mc_resource_pool *res_pool =
 					&mc_bus->resource_pools[pool_type];
-	int free_count = 0;
 
-	list_for_each_entry_safe(resource, next, &res_pool->free_list, node) {
-		free_count++;
+	list_for_each_entry_safe(resource, next, &res_pool->free_list, node)
 		devm_kfree(&mc_bus_dev->dev, resource);
-	}
 }
 
 void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev)
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Tom Rix

clang with W=1 reports drivers/bus/fsl-mc/fsl-mc-allocator.c:560:6: error: variable
'free_count' set but not used [-Werror,-Wunused-but-set-variable]

        int free_count = 0;
            ^

This variable is not used so remove it.

Thanks for the patch!

Fixes commit d8e026a44919 ("staging: fsl-mc: remove some superfluous WARN_ONs")

Check out
commit 364069556901 ("staging: fsl-mc: move resource pool init/cleanup into allocator")
to see the original logic.

Quoted 25 lines
---
 drivers/bus/fsl-mc/fsl-mc-allocator.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/bus/fsl-mc/fsl-mc-allocator.c +1 -5
index dced427ca8ba..f1351237a9d5 100644
@@ -557,12 +557,9 @@ static void fsl_mc_cleanup_resource_pool(struct fsl_mc_device *mc_bus_dev,
        struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
        struct fsl_mc_resource_pool *res_pool =
                                        &mc_bus->resource_pools[pool_type];
-       int free_count = 0;
 
-       list_for_each_entry_safe(resource, next, &res_pool->free_list, node) {
-               free_count++;
+       list_for_each_entry_safe(resource, next, &res_pool->free_list, node)
                devm_kfree(&mc_bus_dev->dev, resource);
-       }
 }
 
 void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev)
--

2.27.0

Signature · 2 lines
Thanks,
~Nick Desaulniers