]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
coresight: Avoid casting void pointers
authorStephen Boyd <swboyd@chromium.org>
Mon, 18 May 2020 18:02:39 +0000 (12:02 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 May 2020 14:31:18 +0000 (16:31 +0200)
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>
Reviewed-by: Joe Perches <joe@perches.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20200518180242.7916-21-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/coresight/coresight-priv.h

index 5a36f0f50899c933255e10b41f2752c5d7cc9388..36c943ae94d526a6d6426a3e64b260f3d8430d61 100644 (file)
@@ -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,