2023-06-05 11:34:50

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 1/2] bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use

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 <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Uwe Kleine-König <[email protected]>
---
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



2023-06-05 11:36:06

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 2/2] bus: fsl-mc: fsl-mc-allocator: Drop a write-only variable

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 <[email protected]>
Signed-off-by: Uwe Kleine-König <[email protected]>
---
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


2023-06-05 15:48:25

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 1/2] bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use

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 <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Signed-off-by: Uwe Kleine-K?nig <[email protected]>

Reviewed-by: Nathan Chancellor <[email protected]>

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

2023-06-05 16:14:13

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 2/2] bus: fsl-mc: fsl-mc-allocator: Drop a write-only variable

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 <[email protected]>
> Signed-off-by: Uwe Kleine-K?nig <[email protected]>

Reviewed-by: Nathan Chancellor <[email protected]>

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