From 214a0006b2c83ffa41794a424a9dd6758ca9eb4d Mon Sep 17 00:00:00 2001 From: Samuel Zou Date: Wed, 6 May 2020 17:25:46 +0800 Subject: [PATCH] dmaengine: ti: k3-udma: Use PTR_ERR_OR_ZERO() to simplify code Fixes coccicheck warnings: drivers/dma/ti/k3-udma.c:1294:1-3: WARNING: PTR_ERR_OR_ZERO can be used drivers/dma/ti/k3-udma.c:1311:1-3: WARNING: PTR_ERR_OR_ZERO can be used drivers/dma/ti/k3-udma.c:1376:1-3: WARNING: PTR_ERR_OR_ZERO can be used Reported-by: Hulk Robot Signed-off-by: Samuel Zou Link: https://lore.kernel.org/r/1588757146-38858-1-git-send-email-zou_wei@huawei.com Signed-off-by: Vinod Koul --- drivers/dma/ti/k3-udma.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index fa53234d8f09..80d64f71a7cb 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -1291,10 +1291,8 @@ static int udma_get_tchan(struct udma_chan *uc) } uc->tchan = __udma_reserve_tchan(ud, uc->config.channel_tpl, -1); - if (IS_ERR(uc->tchan)) - return PTR_ERR(uc->tchan); - return 0; + return PTR_ERR_OR_ZERO(uc->tchan); } static int udma_get_rchan(struct udma_chan *uc) @@ -1308,10 +1306,8 @@ static int udma_get_rchan(struct udma_chan *uc) } uc->rchan = __udma_reserve_rchan(ud, uc->config.channel_tpl, -1); - if (IS_ERR(uc->rchan)) - return PTR_ERR(uc->rchan); - return 0; + return PTR_ERR_OR_ZERO(uc->rchan); } static int udma_get_chan_pair(struct udma_chan *uc) @@ -1373,10 +1369,8 @@ static int udma_get_rflow(struct udma_chan *uc, int flow_id) } uc->rflow = __udma_get_rflow(ud, flow_id); - if (IS_ERR(uc->rflow)) - return PTR_ERR(uc->rflow); - return 0; + return PTR_ERR_OR_ZERO(uc->rflow); } static void udma_put_rchan(struct udma_chan *uc)