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: 141178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2257343vqi; Sun, 17 Sep 2023 11:45:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF2A+R8VwCGeAgrDyIh5ut1jlJ1emoYh/mEYaRKpc2oLRG8kAyI5Mhbw1U0crbTPtJoDI77 X-Received: by 2002:a05:6871:720:b0:1bf:e522:7133 with SMTP id f32-20020a056871072000b001bfe5227133mr9363030oap.38.1694976354122; Sun, 17 Sep 2023 11:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694976354; cv=none; d=google.com; s=arc-20160816; b=ia6R/rkF7usOl3FfZAv6NGsps1pHSp0iDkM8/hYaA/GlYfjvGIMG3jUvIr71fciSLE ijS7MgU9ppfPLfMxO4rlVF/doWMzwccklOoHcTF7/A+TF61HVJSDd1uizsA1B9vZuKzN TLkuMVahEcq+tk96wSzgoixetVDr4PlI3qRtDmxiLRi5gurAlbwmqFA/Zd9Sp2oAsCqc xFqbXdbm0NvL3+lo7Dh2vWX7lXMoYoUQBk9gUC2YKHk3FAammvecuLNBWak2d21WRHIW aL5KpQlGISTTPqzQ9zZrdwZFZXvmW44iR++lSWjqkIK+m5Uo+wCZTxqcGIFKXso+rMeY q5wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Eb9i/pcg2sDgpzwYBXcHCssoUoji+5TNSyNGZC5cFDI=; fh=Ip96McimxhuPUvOrJhhHP4UO4FJ3+MZLIrU/DV0xfsA=; b=apx/OFEDk4WnghVUg489w9jJYhFt23jKzNrPSgBaJg+sWmWjUw2a5ZXyjOv8Ufrf3g X+twjtMEOFtqtBKWCgZpfmPWeS7IYVzn8AJpmIZPwOPTPELwvHVK+8ydFp6LG7wzGEtu rFVUfMCCp6vXMcFeCDaVh8e/qgI79qj0BNanFXrzyl/WfiS2pTLiuo4n4o2AasAKa6U/ 43Jx489rDndbQTUk7J09YxKmSTCEHBYPrzj1jpHkxJLF4q80KXv3C2xlCIh/zYNpGKHm 1cQUFrJk7ZVOH9rX+pvcupK43QiB3hTTxdlYQbf01HnrI6TyuitlrArnfpVgKzrLeSMU GthA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=OUpyags0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id oc7-20020a17090b1c0700b00271a0262e88si542152pjb.4.2023.09.17.11.45.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 11:45:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=OUpyags0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 4117980BEB15; Sun, 17 Sep 2023 07:41:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234619AbjIQOhH (ORCPT + 29 others); Sun, 17 Sep 2023 10:37:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236757AbjIQOgm (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 6AD2B18E 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 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 17 Sep 2023 07:41:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777311525394860719 X-GMAIL-MSGID: 1777311525394860719 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; }