public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] dmaengine: Save few bytes and increase readability of dma_request_chan()
@ 2020-08-28 14:45 Andy Shevchenko
  2020-09-03  6:52 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2020-08-28 14:45 UTC (permalink / raw)
  To: Vinod Koul, dmaengine, Dan Williams, Peter Ujfalusi; +Cc: Andy Shevchenko

Split IS_ERR_OR_NULL() check followed by additional conditional
to two simple conditionals. This increases readability and saves memory:

Function                                     old     new   delta
dma_request_chan                             700     697      -3
Total: Before=10224, After=10221, chg -0.03%

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dmaengine.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index a53e71d2bbd4..adf804aa50a5 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -847,8 +847,10 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
 	}
 	mutex_unlock(&dma_list_mutex);
 
-	if (IS_ERR_OR_NULL(chan))
-		return chan ? chan : ERR_PTR(-EPROBE_DEFER);
+	if (IS_ERR(chan))
+		return chan;
+	if (!chan)
+		return ERR_PTR(-EPROBE_DEFER);
 
 found:
 #ifdef CONFIG_DEBUG_FS
-- 
2.28.0


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

* Re: [PATCH v1] dmaengine: Save few bytes and increase readability of dma_request_chan()
  2020-08-28 14:45 [PATCH v1] dmaengine: Save few bytes and increase readability of dma_request_chan() Andy Shevchenko
@ 2020-09-03  6:52 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2020-09-03  6:52 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: dmaengine, Dan Williams, Peter Ujfalusi

On 28-08-20, 17:45, Andy Shevchenko wrote:
> Split IS_ERR_OR_NULL() check followed by additional conditional
> to two simple conditionals. This increases readability and saves memory:
> 
> Function                                     old     new   delta
> dma_request_chan                             700     697      -3
> Total: Before=10224, After=10221, chg -0.03%

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2020-09-03  6:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-28 14:45 [PATCH v1] dmaengine: Save few bytes and increase readability of dma_request_chan() Andy Shevchenko
2020-09-03  6:52 ` Vinod Koul

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