Re: [PATCH] coresight: etm4x: Fix BMVAL misuse

Mathieu Poirier
2019-10-30T15:19:49Z

On Sat, 26 Oct 2019 at 14:26, Rikard Falkeborn
<rikard.falkeborn@gmail.com> wrote:
>
> The second argument should be the lsb and the third argument should be
> the msb.
>
> Fixes: 62ab9bce3bc7 ("coresight: etm4x: Add missing API to set EL match on address filters")
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
> ---
> Spotted while trying to get compile time checking that the order of the
> arguments to GENMASK macro is correct (BMVAL uses GENMASK).
>
> I have only compile tested the patch.
>
> drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> index 3fc12ac44270..ce41482431f9 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> @@ -1246,7 +1246,7 @@ static ssize_t addr_exlevel_s_ns_show(struct device *dev,
>
> spin_lock(&drvdata->spinlock);
> idx = config->addr_idx;
> - val = BMVAL(config->addr_acc[idx], 14, 8);
> + val = BMVAL(config->addr_acc[idx], 8, 14);

Good catch - thank you for that,
Mathieu

> spin_unlock(&drvdata->spinlock);
> return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
> }
> --
> 2.23.0