2022-07-08 17:24:19

by Ben Dooks

[permalink] [raw]
Subject: [PATCH 2/3] dmaengine: dw-axi-dmac: do not print NULL LLI during error

During debugging we have seen an issue where axi_chan_dump_lli()
is passed a NULL LLI pointer which ends up causing an OOPS due
to trying to get fields from it. Simply print NULL LLI and exit
to avoid this.

Signed-off-by: Ben Dooks <[email protected]>
---
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index 75c537153e92..d6ef5f49f281 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -1008,6 +1008,11 @@ static void axi_chan_dump_regs(struct axi_dma_chan *chan)
static void axi_chan_dump_lli(struct axi_dma_chan *chan,
struct axi_dma_hw_desc *desc)
{
+ if (!desc->lli) {
+ dev_err(dchan2dev(&chan->vc.chan), "NULL LLI\n");
+ return;
+ }
+
dev_err(dchan2dev(&chan->vc.chan),
"SAR: 0x%llx DAR: 0x%llx LLP: 0x%llx BTS 0x%x CTL: 0x%x:%08x",
le64_to_cpu(desc->lli->sar),
--
2.35.1


2022-07-21 13:00:04

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 2/3] dmaengine: dw-axi-dmac: do not print NULL LLI during error

On 08-07-22, 18:01, Ben Dooks wrote:
> During debugging we have seen an issue where axi_chan_dump_lli()
> is passed a NULL LLI pointer which ends up causing an OOPS due
> to trying to get fields from it. Simply print NULL LLI and exit
> to avoid this.

Applied, thanks

>
> Signed-off-by: Ben Dooks <[email protected]>
> ---
> drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> index 75c537153e92..d6ef5f49f281 100644
> --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> @@ -1008,6 +1008,11 @@ static void axi_chan_dump_regs(struct axi_dma_chan *chan)
> static void axi_chan_dump_lli(struct axi_dma_chan *chan,
> struct axi_dma_hw_desc *desc)
> {
> + if (!desc->lli) {
> + dev_err(dchan2dev(&chan->vc.chan), "NULL LLI\n");
> + return;
> + }
> +
> dev_err(dchan2dev(&chan->vc.chan),
> "SAR: 0x%llx DAR: 0x%llx LLP: 0x%llx BTS 0x%x CTL: 0x%x:%08x",
> le64_to_cpu(desc->lli->sar),
> --
> 2.35.1

--
~Vinod