[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ9a7VjJpZWMJFkwxwnc=w8p1cemx-vM7yrWWWEHp_ThjkJoSA@mail.gmail.com>
Date: Tue, 28 Apr 2020 21:58:24 +0100
From: Mike Leach <mike.leach@...aro.org>
To: Stephen Boyd <swboyd@...omium.org>
Cc: Mathieu Poirier <mathieu.poirier@...aro.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Joe Perches <joe@...ches.com>
Subject: Re: [PATCH v2 2/2] coresight: Avoid casting void pointers
Reviewed-by mike.leach@...aro.org
On Tue, 28 Apr 2020 at 19:10, Stephen Boyd <swboyd@...omium.org> wrote:
>
> We don't need to cast void pointers, such as the amba_id data. Assign to
> a local variable to make the code prettier and also return NULL instead
> of 0 to make sparse happy.
>
> Cc: Suzuki K Poulose <suzuki.poulose@....com>
> Cc: Mike Leach <mike.leach@...aro.org>
> Reviewed-by: Joe Perches <joe@...ches.com>
> Signed-off-by: Stephen Boyd <swboyd@...omium.org>
> ---
>
> Thanks Joe for finding my thinko!
>
> drivers/hwtracing/coresight/coresight-priv.h | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
> index 5a36f0f50899..36c943ae94d5 100644
> --- a/drivers/hwtracing/coresight/coresight-priv.h
> +++ b/drivers/hwtracing/coresight/coresight-priv.h
> @@ -215,9 +215,12 @@ cti_remove_assoc_from_csdev(struct coresight_device *csdev) {}
> /* extract the data value from a UCI structure given amba_id pointer. */
> static inline void *coresight_get_uci_data(const struct amba_id *id)
> {
> - if (id->data)
> - return ((struct amba_cs_uci_id *)(id->data))->data;
> - return 0;
> + struct amba_cs_uci_id *uci_id = id->data;
> +
> + if (!uci_id)
> + return NULL;
> +
> + return uci_id->data;
> }
>
> void coresight_release_platform_data(struct coresight_device *csdev,
> --
> Sent by a computer, using git, on the internet
>
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
Powered by blists - more mailing lists