All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <swboyd@chromium.org>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@linaro.org>
Subject: [PATCH 5/5] coresight: Avoid casting void pointers
Date: Sun, 26 Apr 2020 11:58:05 -0700	[thread overview]
Message-ID: <20200426185805.14923-6-swboyd@chromium.org> (raw)
In-Reply-To: <20200426185805.14923-1-swboyd@chromium.org>

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@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 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 890f9a5c97c6..09ca9d824cee 100644
--- a/drivers/hwtracing/coresight/coresight-priv.h
+++ b/drivers/hwtracing/coresight/coresight-priv.h
@@ -206,9 +206,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 id->data;
+
+	return NULL;
 }
 
 void coresight_release_platform_data(struct coresight_platform_data *pdata);
-- 
Sent by a computer, using git, on the internet


WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <swboyd@chromium.org>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: [PATCH 5/5] coresight: Avoid casting void pointers
Date: Sun, 26 Apr 2020 11:58:05 -0700	[thread overview]
Message-ID: <20200426185805.14923-6-swboyd@chromium.org> (raw)
In-Reply-To: <20200426185805.14923-1-swboyd@chromium.org>

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@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 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 890f9a5c97c6..09ca9d824cee 100644
--- a/drivers/hwtracing/coresight/coresight-priv.h
+++ b/drivers/hwtracing/coresight/coresight-priv.h
@@ -206,9 +206,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 id->data;
+
+	return NULL;
 }
 
 void coresight_release_platform_data(struct coresight_platform_data *pdata);
-- 
Sent by a computer, using git, on the internet


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-04-26 18:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26 18:58 [PATCH 0/5] coresight: Minor sparse and style fixes Stephen Boyd
2020-04-26 18:58 ` Stephen Boyd
2020-04-26 18:58 ` [PATCH 1/5] coresight: Include required headers in C files Stephen Boyd
2020-04-26 18:58   ` Stephen Boyd
2020-04-27 16:34   ` Mathieu Poirier
2020-04-27 16:34     ` Mathieu Poirier
2020-04-28 17:34     ` Stephen Boyd
2020-04-28 17:34       ` Stephen Boyd
2020-04-26 18:58 ` [PATCH 2/5] coresight: Mark some functions static Stephen Boyd
2020-04-26 18:58   ` Stephen Boyd
2020-04-26 18:58 ` [PATCH 3/5] coresight: Don't initialize variables unnecessarily Stephen Boyd
2020-04-26 18:58   ` Stephen Boyd
2020-04-26 18:58 ` [PATCH 4/5] coresight: Initialize arg in sparse friendly way Stephen Boyd
2020-04-26 18:58   ` Stephen Boyd
2020-04-26 18:58 ` Stephen Boyd [this message]
2020-04-26 18:58   ` [PATCH 5/5] coresight: Avoid casting void pointers Stephen Boyd
2020-04-26 20:37   ` Joe Perches
2020-04-26 20:37     ` Joe Perches
2020-04-27 17:05 ` [PATCH 0/5] coresight: Minor sparse and style fixes Mathieu Poirier
2020-04-27 17:05   ` Mathieu Poirier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200426185805.14923-6-swboyd@chromium.org \
    --to=swboyd@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.