[PATCH] powerpc : dma-mapping : Check null condition for dev->archdata.dma_ops
Nikhil Badola
nikhil.badola at freescale.com
Fri Jul 18 20:04:52 EST 2014
Modifies get_dma_ops() implementation on ppc arch to check null condition
for dev->archdata.dma_ops; returns common dma_direct_ops structure in
case its NULL
Signed-off-by: Nikhil Badola <nikhil.badola at freescale.com>
---
arch/powerpc/include/asm/dma-mapping.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 150866b..d73bae8 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -86,10 +86,12 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
*/
if (unlikely(dev == NULL))
return NULL;
-
- return dev->archdata.dma_ops;
+ if (dev->archdata.dma_ops)
+ return dev->archdata.dma_ops;
+ return &dma_direct_ops;
}
+
static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
{
dev->archdata.dma_ops = ops;
--
1.7.11.7
More information about the Linuxppc-dev
mailing list