DMA Engine development
 help / color / mirror / Atom feed
* [PATCH v1] dmaengine: dmatest: Print error codes as signed value
@ 2020-09-07 10:13 Andy Shevchenko
  2020-09-11 12:14 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2020-09-07 10:13 UTC (permalink / raw)
  To: Vinod Koul, dmaengine, Dan Williams; +Cc: Andy Shevchenko

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: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dmatest.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 45d4d92e91db..8bd1a25ad3e3 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -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,8 +453,13 @@ 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)
 {
-	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);
+	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,
-- 
2.28.0


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

* Re: [PATCH v1] dmaengine: dmatest: Print error codes as signed value
  2020-09-07 10:13 [PATCH v1] dmaengine: dmatest: Print error codes as signed value Andy Shevchenko
@ 2020-09-11 12:14 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2020-09-11 12:14 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: dmaengine, Dan Williams

On 07-09-20, 13:13, Andy Shevchenko wrote:
> 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.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2020-09-11 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-07 10:13 [PATCH v1] dmaengine: dmatest: Print error codes as signed value Andy Shevchenko
2020-09-11 12:14 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox