All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma-mapping: add unlikely hint to error path in dma_mapping_error
@ 2021-03-26 21:03 Heiner Kallweit
  2021-03-30 10:21 ` Robin Murphy
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Heiner Kallweit @ 2021-03-26 21:03 UTC (permalink / raw)
  To: Christoph Hellwig, Marek Szyprowski, Robin Murphy
  Cc: open list:AMD IOMMU (AMD-VI)

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.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
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(-)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index e9d19b974..183e7103a 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -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;
 }
-- 
2.31.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-02 14:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 21:03 [PATCH] dma-mapping: add unlikely hint to error path in dma_mapping_error Heiner Kallweit
2021-03-30 10:21 ` Robin Murphy
2021-03-30 10:54   ` Heiner Kallweit
2021-03-30 10:59 ` Heiner Kallweit
2021-04-02 14:41 ` Christoph Hellwig

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.