* [PATCH] dmaengine: ioat: Use common error handling code in ioat_xor_val_self_test()
@ 2017-10-22 15:34 SF Markus Elfring
2017-10-23 7:27 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2017-10-22 15:34 UTC (permalink / raw)
To: dmaengine, Arvind Yadav, Dan Williams, Dave Jiang, Geliang Tang,
Krister Johansen, Pan Bian, Vinod Koul
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 22 Oct 2017 17:25:09 +0200
Add a jump target so that a specific error code assignment
will be in the implementation mostly at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/dma/ioat/init.c | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
index 93e006c3441d..5bdd67940c81 100644
--- a/drivers/dma/ioat/init.c
+++ b/drivers/dma/ioat/init.c
@@ -853,8 +853,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
if (!tx) {
dev_err(dev, "Self-test xor prep failed\n");
- err = -ENODEV;
- goto dma_unmap;
+ goto failure_indication;
}
async_tx_ack(tx);
@@ -864,8 +863,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
cookie = tx->tx_submit(tx);
if (cookie < 0) {
dev_err(dev, "Self-test xor setup failed\n");
- err = -ENODEV;
- goto dma_unmap;
+ goto failure_indication;
}
dma->device_issue_pending(dma_chan);
@@ -874,8 +872,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
if (tmo = 0 ||
dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
dev_err(dev, "Self-test xor timed out\n");
- err = -ENODEV;
- goto dma_unmap;
+ goto failure_indication;
}
for (i = 0; i < IOAT_NUM_SRC_TEST; i++)
@@ -921,8 +918,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
&xor_val_result, DMA_PREP_INTERRUPT);
if (!tx) {
dev_err(dev, "Self-test zero prep failed\n");
- err = -ENODEV;
- goto dma_unmap;
+ goto failure_indication;
}
async_tx_ack(tx);
@@ -932,8 +928,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
cookie = tx->tx_submit(tx);
if (cookie < 0) {
dev_err(dev, "Self-test zero setup failed\n");
- err = -ENODEV;
- goto dma_unmap;
+ goto failure_indication;
}
dma->device_issue_pending(dma_chan);
@@ -942,8 +937,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
if (tmo = 0 ||
dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
dev_err(dev, "Self-test validate timed out\n");
- err = -ENODEV;
- goto dma_unmap;
+ goto failure_indication;
}
for (i = 0; i < IOAT_NUM_SRC_TEST + 1; i++)
@@ -974,8 +968,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
&xor_val_result, DMA_PREP_INTERRUPT);
if (!tx) {
dev_err(dev, "Self-test 2nd zero prep failed\n");
- err = -ENODEV;
- goto dma_unmap;
+ goto failure_indication;
}
async_tx_ack(tx);
@@ -985,8 +978,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
cookie = tx->tx_submit(tx);
if (cookie < 0) {
dev_err(dev, "Self-test 2nd zero setup failed\n");
- err = -ENODEV;
- goto dma_unmap;
+ goto failure_indication;
}
dma->device_issue_pending(dma_chan);
@@ -995,20 +987,20 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
if (tmo = 0 ||
dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
dev_err(dev, "Self-test 2nd validate timed out\n");
- err = -ENODEV;
- goto dma_unmap;
+ goto failure_indication;
}
if (xor_val_result != SUM_CHECK_P_RESULT) {
dev_err(dev, "Self-test validate failed compare\n");
- err = -ENODEV;
- goto dma_unmap;
+ goto failure_indication;
}
for (i = 0; i < IOAT_NUM_SRC_TEST + 1; i++)
dma_unmap_page(dev, dma_srcs[i], PAGE_SIZE, DMA_TO_DEVICE);
goto free_resources;
+failure_indication:
+ err = -ENODEV;
dma_unmap:
if (op = IOAT_OP_XOR) {
while (--i >= 0)
--
2.14.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: ioat: Use common error handling code in ioat_xor_val_self_test()
2017-10-22 15:34 [PATCH] dmaengine: ioat: Use common error handling code in ioat_xor_val_self_test() SF Markus Elfring
@ 2017-10-23 7:27 ` Dan Carpenter
2017-10-23 15:59 ` Dave Jiang
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2017-10-23 7:27 UTC (permalink / raw)
To: SF Markus Elfring
Cc: dmaengine, Arvind Yadav, Dan Williams, Dave Jiang, Geliang Tang,
Krister Johansen, Pan Bian, Vinod Koul, LKML, kernel-janitors
These patches hurt readability.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: ioat: Use common error handling code in ioat_xor_val_self_test()
2017-10-23 7:27 ` Dan Carpenter
@ 2017-10-23 15:59 ` Dave Jiang
2017-10-23 16:51 ` Vinod Koul
0 siblings, 1 reply; 5+ messages in thread
From: Dave Jiang @ 2017-10-23 15:59 UTC (permalink / raw)
To: Dan Carpenter, SF Markus Elfring
Cc: dmaengine@vger.kernel.org, Arvind Yadav, Williams, Dan J,
Geliang Tang, Krister Johansen, Pan Bian, Koul, Vinod, LKML,
kernel-janitors@vger.kernel.org
On 10/23/2017 12:27 AM, Dan Carpenter wrote:
> These patches hurt readability.
>
> regards,
> dan carpenter
>
I agree with Dan. I'm ok with not accepting this patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: ioat: Use common error handling code in ioat_xor_val_self_test()
2017-10-23 15:59 ` Dave Jiang
@ 2017-10-23 16:51 ` Vinod Koul
2017-10-23 17:39 ` SF Markus Elfring
0 siblings, 1 reply; 5+ messages in thread
From: Vinod Koul @ 2017-10-23 16:51 UTC (permalink / raw)
To: Dave Jiang
Cc: Dan Carpenter, SF Markus Elfring, dmaengine@vger.kernel.org,
Arvind Yadav, Williams, Dan J, Geliang Tang, Krister Johansen,
Pan Bian, LKML, kernel-janitors@vger.kernel.org
On Mon, Oct 23, 2017 at 08:59:19AM -0700, Dave Jiang wrote:
> On 10/23/2017 12:27 AM, Dan Carpenter wrote:
> > These patches hurt readability.
> >
> > regards,
> > dan carpenter
> >
>
> I agree with Dan. I'm ok with not accepting this patch.
And I have no intention to :)
At least they should explain why or how it help, give the Coccinelle
scripts.. But sadly that is not done ...
--
~Vinod
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: dmaengine: ioat: Use common error handling code in ioat_xor_val_self_test()
2017-10-23 16:51 ` Vinod Koul
@ 2017-10-23 17:39 ` SF Markus Elfring
0 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-10-23 17:39 UTC (permalink / raw)
To: Vinod Koul, Dave Jiang, dmaengine
Cc: Dan Carpenter, Arvind Yadav, Williams, Dan J, Geliang Tang,
Krister Johansen, Pan Bian, LKML, kernel-janitors
>> I agree with Dan. I'm ok with not accepting this patch.
>
> And I have no intention to :)
This is a pity.
> At least they should explain why or how it help,
Do you see useful consequences (like a bit less memory requirements)
if the assignment statement “err = -ENODEV” will be stored only once
behind the jump label “failure_indication” in the suggested update
for the implementation of the function “ioat_xor_val_self_test”
(instead of being duplicated several times)?
> give the Coccinelle scripts..
How can they matter for a better understanding of the concrete
source code adjustment?
> But sadly that is not done ...
I did not include a link for special background information explicitly.
But how do you think about corresponding details from discussions
on a topic like “Comparing statement lists with SmPL”?
https://systeme.lip6.fr/pipermail/cocci/2017-August/004388.html
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-23 17:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-22 15:34 [PATCH] dmaengine: ioat: Use common error handling code in ioat_xor_val_self_test() SF Markus Elfring
2017-10-23 7:27 ` Dan Carpenter
2017-10-23 15:59 ` Dave Jiang
2017-10-23 16:51 ` Vinod Koul
2017-10-23 17:39 ` SF Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).