Commit ef759e4a authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Vinod Koul
Browse files

dmaengine: dmatest: Print error codes as signed value



When we got an error from DMA mapping API we convert a negative value
to unsigned long type and hence make user confused:

  result #1: 'src mapping error' with src_off=0x19a72 dst_off=0xea len=0xccf4 (18446744073709551604)

Change this to print error codes as signed values.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200907101306.61824-1-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 2fc3cad2
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
 */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/err.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
@@ -452,9 +453,14 @@ static unsigned int min_odd(unsigned int x, unsigned int y)
static void result(const char *err, unsigned int n, unsigned int src_off,
		   unsigned int dst_off, unsigned int len, unsigned long data)
{
	if (IS_ERR_VALUE(data)) {
		pr_info("%s: result #%u: '%s' with src_off=0x%x dst_off=0x%x len=0x%x (%ld)\n",
			current->comm, n, err, src_off, dst_off, len, data);
	} else {
		pr_info("%s: result #%u: '%s' with src_off=0x%x dst_off=0x%x len=0x%x (%lu)\n",
			current->comm, n, err, src_off, dst_off, len, data);
	}
}

static void dbg_result(const char *err, unsigned int n, unsigned int src_off,
		       unsigned int dst_off, unsigned int len,