2018-12-01 08:32:21

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next] coresight: stm: remove set but not used variable 'res_size'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/hwtracing/coresight/coresight-stm.c: In function 'stm_probe':
drivers/hwtracing/coresight/coresight-stm.c:796:9: warning:
variable 'res_size' set but not used [-Wunused-but-set-variable]

It never used since introduction in commit
237483aa5cf4 ("coresight: stm: adding driver for CoreSight STM component")

Signed-off-by: YueHaibing <[email protected]>
---
drivers/hwtracing/coresight/coresight-stm.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
index ef339ff..f07825d 100644
--- a/drivers/hwtracing/coresight/coresight-stm.c
+++ b/drivers/hwtracing/coresight/coresight-stm.c
@@ -793,7 +793,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
struct stm_drvdata *drvdata;
struct resource *res = &adev->res;
struct resource ch_res;
- size_t res_size, bitmap_size;
+ size_t bitmap_size;
struct coresight_desc desc = { 0 };
struct device_node *np = adev->dev.of_node;

@@ -833,15 +833,11 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)

drvdata->write_bytes = stm_fundamental_data_size(drvdata);

- if (boot_nr_channel) {
+ if (boot_nr_channel)
drvdata->numsp = boot_nr_channel;
- res_size = min((resource_size_t)(boot_nr_channel *
- BYTES_PER_CHANNEL), resource_size(res));
- } else {
+ else
drvdata->numsp = stm_num_stimulus_port(drvdata);
- res_size = min((resource_size_t)(drvdata->numsp *
- BYTES_PER_CHANNEL), resource_size(res));
- }
+
bitmap_size = BITS_TO_LONGS(drvdata->numsp) * sizeof(long);

guaranteed = devm_kzalloc(dev, bitmap_size, GFP_KERNEL);





2018-12-05 00:40:30

by Leo Yan

[permalink] [raw]
Subject: Re: [PATCH -next] coresight: stm: remove set but not used variable 'res_size'

On Sat, Dec 01, 2018 at 08:39:45AM +0000, YueHaibing wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/hwtracing/coresight/coresight-stm.c: In function 'stm_probe':
> drivers/hwtracing/coresight/coresight-stm.c:796:9: warning:
> variable 'res_size' set but not used [-Wunused-but-set-variable]
>
> It never used since introduction in commit
> 237483aa5cf4 ("coresight: stm: adding driver for CoreSight STM component")
>
> Signed-off-by: YueHaibing <[email protected]>

FWIW, Tested-by: Leo Yan <[email protected]>

> ---
> drivers/hwtracing/coresight/coresight-stm.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
> index ef339ff..f07825d 100644
> --- a/drivers/hwtracing/coresight/coresight-stm.c
> +++ b/drivers/hwtracing/coresight/coresight-stm.c
> @@ -793,7 +793,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
> struct stm_drvdata *drvdata;
> struct resource *res = &adev->res;
> struct resource ch_res;
> - size_t res_size, bitmap_size;
> + size_t bitmap_size;
> struct coresight_desc desc = { 0 };
> struct device_node *np = adev->dev.of_node;
>
> @@ -833,15 +833,11 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
>
> drvdata->write_bytes = stm_fundamental_data_size(drvdata);
>
> - if (boot_nr_channel) {
> + if (boot_nr_channel)
> drvdata->numsp = boot_nr_channel;
> - res_size = min((resource_size_t)(boot_nr_channel *
> - BYTES_PER_CHANNEL), resource_size(res));
> - } else {
> + else
> drvdata->numsp = stm_num_stimulus_port(drvdata);
> - res_size = min((resource_size_t)(drvdata->numsp *
> - BYTES_PER_CHANNEL), resource_size(res));
> - }
> +
> bitmap_size = BITS_TO_LONGS(drvdata->numsp) * sizeof(long);
>
> guaranteed = devm_kzalloc(dev, bitmap_size, GFP_KERNEL);
>
>
>

2018-12-05 17:25:34

by Mathieu Poirier

[permalink] [raw]
Subject: Re: [PATCH -next] coresight: stm: remove set but not used variable 'res_size'

On Sat, 1 Dec 2018 at 01:31, YueHaibing <[email protected]> wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/hwtracing/coresight/coresight-stm.c: In function 'stm_probe':
> drivers/hwtracing/coresight/coresight-stm.c:796:9: warning:
> variable 'res_size' set but not used [-Wunused-but-set-variable]
>
> It never used since introduction in commit
> 237483aa5cf4 ("coresight: stm: adding driver for CoreSight STM component")
>
> Signed-off-by: YueHaibing <[email protected]>

Applied - thanks,
Mathieu

> ---
> drivers/hwtracing/coresight/coresight-stm.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
> index ef339ff..f07825d 100644
> --- a/drivers/hwtracing/coresight/coresight-stm.c
> +++ b/drivers/hwtracing/coresight/coresight-stm.c
> @@ -793,7 +793,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
> struct stm_drvdata *drvdata;
> struct resource *res = &adev->res;
> struct resource ch_res;
> - size_t res_size, bitmap_size;
> + size_t bitmap_size;
> struct coresight_desc desc = { 0 };
> struct device_node *np = adev->dev.of_node;
>
> @@ -833,15 +833,11 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
>
> drvdata->write_bytes = stm_fundamental_data_size(drvdata);
>
> - if (boot_nr_channel) {
> + if (boot_nr_channel)
> drvdata->numsp = boot_nr_channel;
> - res_size = min((resource_size_t)(boot_nr_channel *
> - BYTES_PER_CHANNEL), resource_size(res));
> - } else {
> + else
> drvdata->numsp = stm_num_stimulus_port(drvdata);
> - res_size = min((resource_size_t)(drvdata->numsp *
> - BYTES_PER_CHANNEL), resource_size(res));
> - }
> +
> bitmap_size = BITS_TO_LONGS(drvdata->numsp) * sizeof(long);
>
> guaranteed = devm_kzalloc(dev, bitmap_size, GFP_KERNEL);
>
>
>