[PATCH linux-next] dma-debug: Fix coccinelle warnings in device_dma_allocations()

From: Shuah Khan
Date: Tue Nov 26 2013 - 15:51:30 EST


lib/dma-debug.c:740:11-16: ERROR: invalid reference to the index variable of the iterator on line 726

This error is a result of referencing entry->dev in dev_warn() when entry
might not be valid at the time of reference. Change dev_warn() to use input
parameter struct device *dev instead to print warning.

Signed-off-by: Shuah Khan <shuah.kh@xxxxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
lib/dma-debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index e34865e..5f29445 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -737,7 +737,7 @@ static int device_dma_allocations(struct device *dev, struct dma_debug_entry **o
local_irq_restore(flags);

if (map_err_cnt)
- dev_warn(entry->dev,
+ dev_warn(dev,
"DMA-API: device driver failed to check map errors: "
"[count] = %d\n", map_err_cnt);
return count;
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/