diff mbox

dmaengine: remove redundant null check on req

Message ID 20170517133549.7157-1-colin.king@canonical.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Colin King May 17, 2017, 1:35 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Req is never null on at the point of the null check, so
remove this redundant check and just return &req->tx.

Detected by CoverityScan, CID#1436147 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/dma/bcm-sba-raid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Williams May 17, 2017, 7:12 p.m. UTC | #1
On Wed, May 17, 2017 at 6:35 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Req is never null on at the point of the null check, so
> remove this redundant check and just return &req->tx.
>
> Detected by CoverityScan, CID#1436147 ("Logically dead code")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Hi Colin,

Looks good, can you also include the driver name in your patch subjects?

For example "dmaengine, bcm-scm-raid: remove redundant null check on
req", would make it clear that this is a driver fix and not a core
dmaengine issue.
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vinod Koul May 19, 2017, 3:22 a.m. UTC | #2
On Wed, May 17, 2017 at 12:12:00PM -0700, Dan Williams wrote:
> On Wed, May 17, 2017 at 6:35 AM, Colin King <colin.king@canonical.com> wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > Req is never null on at the point of the null check, so
> > remove this redundant check and just return &req->tx.
> >
> > Detected by CoverityScan, CID#1436147 ("Logically dead code")
> >
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> Hi Colin,
> 
> Looks good, can you also include the driver name in your patch subjects?
> 
> For example "dmaengine, bcm-scm-raid: remove redundant null check on
> req", would make it clear that this is a driver fix and not a core
> dmaengine issue.

Yeah that would help, also do the same for static patch you sent on the
driver.
diff mbox

Patch

diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c
index 7daa883eeded..8246c26eabe5 100644
--- a/drivers/dma/bcm-sba-raid.c
+++ b/drivers/dma/bcm-sba-raid.c
@@ -582,7 +582,7 @@  sba_prep_dma_interrupt(struct dma_chan *dchan, unsigned long flags)
 	req->tx.flags = flags;
 	req->tx.cookie = -EBUSY;
 
-	return (req) ? &req->tx : NULL;
+	return &req->tx;
 }
 
 static void sba_fillup_memcpy_msg(struct sba_request *req,