dma-mapping: add unlikely hint to error path in dma_mapping_error
PATCH 1/1 dma-mapping: add unlikely hint to error path in dma_mapping_error
Zillions of drivers use the unlikely() hint when checking the result of dma_mapping_error(). This is an inline function anyway, so we can move the hint into the function and remove it from drivers over time.
---
This is a resend of a patch from Dec 2020 when I tried to do it tree-wide. Now start with the actual change, drivers can be changed afterwards, maybe per subsystem.
--- include/linux/dma-mapping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/dma-mapping.h +1 -1
@@ -95,7 +95,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) {debug_dma_mapping_error (dev, dma_addr); -if (dma_addr ==DMA_MAPPING_ERROR ) +if (unlikely (dma_addr ==DMA_MAPPING_ERROR ))return -ENOMEM ;return 0 ; }
Signature · 6 lines
2.31.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Robin Murphy
reviewerQuoted 3 lines · Heiner Kallweit
Zillions of drivers use the
unlikely()hint when checking the result ofdma_mapping_error(). This is an inline function anyway, so we can move the hint into the function and remove it from drivers over time.
I'm pretty sure I reviewed this last time - please remember to pick up tags from previous versions when reposting.
Thanks,
Robin.
Quoted 15 lines
Signed-off-by Heiner Kallweit <[email protected]>---
This is a resend of a patch from Dec 2020 when I tried to do it tree-wide. Now start with the actual change, drivers can be changed afterwards, maybe per subsystem.--- include/linux/dma-mapping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/dma-mapping.h +0
-0
include/linux/dma-mapping.h static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) · line 101
Quoted 8 lines
include/linux/dma-mapping.h +1
-1@@ -95,7 +95,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) {debug_dma_mapping_error (dev, dma_addr); -if (dma_addr ==DMA_MAPPING_ERROR ) +if (unlikely (dma_addr ==DMA_MAPPING_ERROR ))return -ENOMEM ;return 0 ; }
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 7 lines · Robin Murphy
Quoted 3 lines · Heiner Kallweit
Zillions of drivers use the
unlikely()hint when checking the result ofdma_mapping_error(). This is an inline function anyway, so we can move the hint into the function and remove it from drivers over time.I'm pretty sure I reviewed this last time - please remember to pick up tags from previous versions when reposting.
Right, you did. My bad.
Quoted 12 lines
Thanks,
Robin.Quoted 9 lines
Signed-off-by Heiner Kallweit <[email protected]>---
This is a resend of a patch from Dec 2020 when I tried to do it tree-wide. Now start with the actual change, drivers can be changed afterwards, maybe per subsystem.
---
include/linux/dma-mapping.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
include/linux/dma-mapping.h static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) · line 101
Quoted 13 lines
include/linux/dma-mapping.h +1
-0@@ -95,7 +95,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { debug_dma_mapping_error(dev, dma_addr); - if (dma_addr == DMA_MAPPING_ERROR) + if (unlikely(dma_addr == DMA_MAPPING_ERROR)) return -ENOMEM; return 0; }
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 19 lines · Heiner Kallweit
Zillions of drivers use the
unlikely()hint when checking the result ofdma_mapping_error(). This is an inline function anyway, so we can move the hint into the function and remove it from drivers over time.Signed-off-by Heiner Kallweit <[email protected]>---
This is a resend of a patch from Dec 2020 when I tried to do it tree-wide. Now start with the actual change, drivers can be changed afterwards, maybe per subsystem.--- include/linux/dma-mapping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/dma-mapping.h +0
-0
include/linux/dma-mapping.h static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) · line 101
Quoted 8 lines
include/linux/dma-mapping.h +1
-1@@ -95,7 +95,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) {debug_dma_mapping_error (dev, dma_addr); -if (dma_addr ==DMA_MAPPING_ERROR ) +if (unlikely (dma_addr ==DMA_MAPPING_ERROR ))return -ENOMEM ;return 0 ; }
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Thanks, applied.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu