From patchwork Sun Sep 17 14:36:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13388569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB948CD37B4 for ; Sun, 17 Sep 2023 14:37:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230078AbjIQOhG (ORCPT ); Sun, 17 Sep 2023 10:37:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236747AbjIQOgm (ORCPT ); Sun, 17 Sep 2023 10:36:42 -0400 Received: from smtp.smtpout.orange.fr (smtp-22.smtpout.orange.fr [80.12.242.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A724189 for ; Sun, 17 Sep 2023 07:36:36 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id hsstqeOGW9p0Shssuq1bZf; Sun, 17 Sep 2023 16:36:29 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1694961389; bh=Eb9i/pcg2sDgpzwYBXcHCssoUoji+5TNSyNGZC5cFDI=; h=From:To:Cc:Subject:Date; b=OUpyags0q45Skaeadp0j10giUtgRYonu/aKJ16AVOVD6A2stjVU2bpJsEf1Gek3nY Y7vZgkJw84llWWsZMfMK7Jaj9aYH3VV9pCl9+reGddQJdSKL2zWJXkqpf8VoM3GxhO GXwcv/Py9iCKgAHi1SGaYt5icxMiU6dTHQC0/V+4vpnsl8gySvCTXq/xaY2NWRkHll Ijzh1pG79230bGCDcS1VXhSUGutSYiYUKushEwsFoKQYRyFMECO6psyphEWqgSlz2J 4PFphBZ0eDwqGvC6CB2ijPj6wayN24dyBnxGslGwsp4ZOnKCXVW2nBcgvUNT02Jtq+ gB23zUaopkKUg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 17 Sep 2023 16:36:29 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Radu Pirea , Mark Brown , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] spi: at91-usart: Remove some dead code Date: Sun, 17 Sep 2023 16:36:26 +0200 Message-Id: <84eb08daf85d203b34af9d8d08abf86804211413.1694961365.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org dma_request_chan() does not return NULL. It returns a valid pointer or an error pointer. So, some dead code can be removed. The IS_ERR_OR_NULL() in the error handling path are still needed, because the error handling path is common to the whole function and the ctlr->dma_xx are NULL when at91_usart_spi_configure_dma() is called. Signed-off-by: Christophe JAILLET --- drivers/spi/spi-at91-usart.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/spi/spi-at91-usart.c b/drivers/spi/spi-at91-usart.c index b11d0f993cc7..1cea8e159344 100644 --- a/drivers/spi/spi-at91-usart.c +++ b/drivers/spi/spi-at91-usart.c @@ -132,28 +132,14 @@ static int at91_usart_spi_configure_dma(struct spi_controller *ctlr, dma_cap_set(DMA_SLAVE, mask); ctlr->dma_tx = dma_request_chan(dev, "tx"); - if (IS_ERR_OR_NULL(ctlr->dma_tx)) { - if (IS_ERR(ctlr->dma_tx)) { - err = PTR_ERR(ctlr->dma_tx); - goto at91_usart_spi_error_clear; - } - - dev_dbg(dev, - "DMA TX channel not available, SPI unable to use DMA\n"); - err = -EBUSY; + if (IS_ERR(ctlr->dma_tx)) { + err = PTR_ERR(ctlr->dma_tx); goto at91_usart_spi_error_clear; } ctlr->dma_rx = dma_request_chan(dev, "rx"); - if (IS_ERR_OR_NULL(ctlr->dma_rx)) { - if (IS_ERR(ctlr->dma_rx)) { - err = PTR_ERR(ctlr->dma_rx); - goto at91_usart_spi_error; - } - - dev_dbg(dev, - "DMA RX channel not available, SPI unable to use DMA\n"); - err = -EBUSY; + if (IS_ERR(ctlr->dma_rx)) { + err = PTR_ERR(ctlr->dma_rx); goto at91_usart_spi_error; }