mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use
@ 2023-06-05 11:20 Uwe Kleine-König
  2023-06-05 11:20 ` [PATCH 2/2] bus: fsl-mc: fsl-mc-allocator: Drop a write-only variable Uwe Kleine-König
  2023-06-05 15:39 ` [PATCH 1/2] bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use Nathan Chancellor
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2023-06-05 11:20 UTC (permalink / raw)
  To: Stuart Yoder, Laurentiu Tudor
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, Li Yang,
	Ioana Ciornei, linux-kernel, llvm, kernel, kernel test robot

Fixes a clang compiler warning:

>> drivers/bus/fsl-mc/fsl-mc-allocator.c:108:12: warning: variable 'mc_bus_dev' is uninitialized when used here [-Wuninitialized]
                   dev_err(&mc_bus_dev->dev, "resource mismatch\n");

Fixes: b3134039c5b3 ("bus: fsl-mc: fsl-mc-allocator: Improve error reporting")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306021936.OktTcMAT-lkp@intel.com/
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/bus/fsl-mc/fsl-mc-allocator.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c
index 0ad68099684e..991273f956ce 100644
--- a/drivers/bus/fsl-mc/fsl-mc-allocator.c
+++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c
@@ -103,14 +103,15 @@ static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device
 	struct fsl_mc_resource *resource;
 	int error = -EINVAL;
 
+	mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
+	mc_bus = to_fsl_mc_bus(mc_bus_dev);
+
 	resource = mc_dev->resource;
 	if (!resource || resource->data != mc_dev) {
 		dev_err(&mc_bus_dev->dev, "resource mismatch\n");
 		goto out;
 	}
 
-	mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
-	mc_bus = to_fsl_mc_bus(mc_bus_dev);
 	res_pool = resource->parent_pool;
 	if (res_pool != &mc_bus->resource_pools[resource->type]) {
 		dev_err(&mc_bus_dev->dev, "pool mismatch\n");

base-commit: 59272ad8d9e8ea6398a96f8c6d62da284bf2ae6e
-- 
2.39.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] bus: fsl-mc: fsl-mc-allocator: Drop a write-only variable
  2023-06-05 11:20 [PATCH 1/2] bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use Uwe Kleine-König
@ 2023-06-05 11:20 ` Uwe Kleine-König
  2023-06-05 15:41   ` Nathan Chancellor
  2023-06-05 15:39 ` [PATCH 1/2] bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use Nathan Chancellor
  1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2023-06-05 11:20 UTC (permalink / raw)
  To: Stuart Yoder, Laurentiu Tudor
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, Li Yang,
	Ioana Ciornei, linux-kernel, llvm, kernel, kernel test robot

Fixes a clang compiler warning:

   drivers/bus/fsl-mc/fsl-mc-allocator.c:565:6: warning: variable 'free_count' set but not used [-Wunused-but-set-variable]
           int free_count = 0;

Fixes: d8e026a44919 ("staging: fsl-mc: remove some superfluous WARN_ONs")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/bus/fsl-mc/fsl-mc-allocator.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c
index 991273f956ce..b5e8c021fa1f 100644
--- a/drivers/bus/fsl-mc/fsl-mc-allocator.c
+++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c
@@ -563,12 +563,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.39.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use
  2023-06-05 11:20 [PATCH 1/2] bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use Uwe Kleine-König
  2023-06-05 11:20 ` [PATCH 2/2] bus: fsl-mc: fsl-mc-allocator: Drop a write-only variable Uwe Kleine-König
@ 2023-06-05 15:39 ` Nathan Chancellor
  1 sibling, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2023-06-05 15:39 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Stuart Yoder, Laurentiu Tudor, Nick Desaulniers, Tom Rix,
	Li Yang, Ioana Ciornei, linux-kernel, llvm, kernel,
	kernel test robot

On Mon, Jun 05, 2023 at 01:20:24PM +0200, Uwe Kleine-König wrote:
> Fixes a clang compiler warning:
> 
> >> drivers/bus/fsl-mc/fsl-mc-allocator.c:108:12: warning: variable 'mc_bus_dev' is uninitialized when used here [-Wuninitialized]
>                    dev_err(&mc_bus_dev->dev, "resource mismatch\n");
> 
> Fixes: b3134039c5b3 ("bus: fsl-mc: fsl-mc-allocator: Improve error reporting")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202306021936.OktTcMAT-lkp@intel.com/
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  drivers/bus/fsl-mc/fsl-mc-allocator.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c
> index 0ad68099684e..991273f956ce 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-allocator.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c
> @@ -103,14 +103,15 @@ static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device
>  	struct fsl_mc_resource *resource;
>  	int error = -EINVAL;
>  
> +	mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
> +	mc_bus = to_fsl_mc_bus(mc_bus_dev);
> +
>  	resource = mc_dev->resource;
>  	if (!resource || resource->data != mc_dev) {
>  		dev_err(&mc_bus_dev->dev, "resource mismatch\n");
>  		goto out;
>  	}
>  
> -	mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
> -	mc_bus = to_fsl_mc_bus(mc_bus_dev);
>  	res_pool = resource->parent_pool;
>  	if (res_pool != &mc_bus->resource_pools[resource->type]) {
>  		dev_err(&mc_bus_dev->dev, "pool mismatch\n");
> 
> base-commit: 59272ad8d9e8ea6398a96f8c6d62da284bf2ae6e
> -- 
> 2.39.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] bus: fsl-mc: fsl-mc-allocator: Drop a write-only variable
  2023-06-05 11:20 ` [PATCH 2/2] bus: fsl-mc: fsl-mc-allocator: Drop a write-only variable Uwe Kleine-König
@ 2023-06-05 15:41   ` Nathan Chancellor
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2023-06-05 15:41 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Stuart Yoder, Laurentiu Tudor, Nick Desaulniers, Tom Rix,
	Li Yang, Ioana Ciornei, linux-kernel, llvm, kernel,
	kernel test robot

On Mon, Jun 05, 2023 at 01:20:25PM +0200, Uwe Kleine-König wrote:
> Fixes a clang compiler warning:
> 
>    drivers/bus/fsl-mc/fsl-mc-allocator.c:565:6: warning: variable 'free_count' set but not used [-Wunused-but-set-variable]
>            int free_count = 0;
> 
> Fixes: d8e026a44919 ("staging: fsl-mc: remove some superfluous WARN_ONs")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  drivers/bus/fsl-mc/fsl-mc-allocator.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c
> index 991273f956ce..b5e8c021fa1f 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-allocator.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c
> @@ -563,12 +563,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.39.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-05 15:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05 11:20 [PATCH 1/2] bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use Uwe Kleine-König
2023-06-05 11:20 ` [PATCH 2/2] bus: fsl-mc: fsl-mc-allocator: Drop a write-only variable Uwe Kleine-König
2023-06-05 15:41   ` Nathan Chancellor
2023-06-05 15:39 ` [PATCH 1/2] bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®