Skip to contentSkip to conversation

iommu/omap: Remove casting the return value which is a void pointer

PATCH In review Jingoo Han 2 participants 2 messages Aug 29, 2014 1 message not in the archive IOMMU

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/1 iommu/omap: Remove casting the return value which is a void pointer

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

---
 drivers/iommu/omap-iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/omap-iommu.c +1 -2
index e202b0c24120..02ef0ace7386 100644
@@ -34,8 +34,7 @@
 #include "omap-iopgtable.h"
 #include "omap-iommu.h"
 
-#define to_iommu(dev)							\
-	((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))
+#define to_iommu(dev)	platform_get_drvdata(to_platform_device(dev))
 
 #define for_each_iotlb_cr(obj, n, __i, cr)				\
 	for (__i = 0;							\
Signature · 1 line
2.0.0

A message that is not in the archive (sent off-list or not yet received): 004e01cfc33c$03b26230$0b172690$%[email protected]

#2 lore raw

Hi Jingoo,

Thank you for the patch.

Quoted 3 lines · On Friday 29 August 2014 12:47:54 Jingoo Han wrote:

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

I agree with that, but the explicit cast helps making sure we don't assign the value of to_iommu(dev) to a non struct omap_iommu pointer by mistake.

Quoted 19 lines
---
 drivers/iommu/omap-iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/omap-iommu.c +1 -2
index e202b0c24120..02ef0ace7386 100644
@@ -34,8 +34,7 @@
 #include "omap-iopgtable.h"
 #include "omap-iommu.h"
 
-#define to_iommu(dev)							\
-	((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))
+#define to_iommu(dev)	platform_get_drvdata(to_platform_device(dev))
 
 #define for_each_iotlb_cr(obj, n, __i, cr)				\
 	for (__i = 0;							\
Signature · 3 lines
Regards,

Laurent Pinchart