From patchwork Tue Sep 26 14:06:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 144990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2091438vqu; Tue, 26 Sep 2023 10:50:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHWv7bwLBLjmC5GeZr02ElcALgMOAI5xAHtT3dsOwpip9dij9uKZJ9Jc6TPnf0qHTvGOEjy X-Received: by 2002:a17:902:da83:b0:1b2:4852:9a5f with SMTP id j3-20020a170902da8300b001b248529a5fmr9423937plx.54.1695750647014; Tue, 26 Sep 2023 10:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695750647; cv=none; d=google.com; s=arc-20160816; b=vYIp/2uF8NroFn8fuvUJhO6Va3TUryqSlPp9Tun60kPyItxVV2CPRkOxwa6CbrUjNV djYFSlK8eugQ9hHTIgxymfPcGaZ7E8AZQ3feUmwd8NiiGL+2q+3Mfdk/5S5kvungUfAi 2RgpCTh1wxwhMoqI1CDxiBtUAKoqpRViLZwEpF6zmw6PbBefgB6ETqg8aciqGk9PyERH rl8HcMKNAuZ43sf4AckQTLjq/wPAzgcfrQNwEYM0fic233XhKHEMLe5Wqm1LHvu+344M Ht5RQqneSLOhUzCdj3jBRLLNfAh8Al9VOhd+nI0F5FcUJ8yNFjlhHxDr+EmQzodAbdPf J/jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=3fL7byGgITI5Pp0Gd+G4m6HpKfvXhtfMbVSSCjqe9VQ=; fh=lTEF6DVmQ0aT9gTdRBlSFp+iErlPBH5SqqJFbtnXVIo=; b=vKPY1NhSGYu9VVGp+K6fOa21113KSe8AXLj/dvjvf75SPWkS4Ydi+t3ws7SOwE/skd Tet8jb1/SnZqZrgt+FjuHyF1a5uvc7vsHG8FXKfug7vUFeQ6a22/9EwELiBfwdgEg6GK niuBTTqcCKO0gfkFLGLKErsRM7H4nQeYqwOnMc9m47Snvloa9yVO7DjOt7UXH4WvCvwO f1Zw80Smf9nXeguKEaLxIkyO+qOE19MVVlqVVyHV+cDwn7APh5E1DlP5s6nV9Yd4ZDvq btTwxM4+7sFAk/5nIKi6zqPwb3LhKe3qPbZ1FnvpBzWDYc1NYSRjZL8Q2EE5mQTCmJPE jW4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BnCASo/T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id a17-20020a170902ecd100b001c5616520cfsi3788224plh.204.2023.09.26.10.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 10:50:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BnCASo/T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3D11A808DB46; Tue, 26 Sep 2023 07:07:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231305AbjIZOHM (ORCPT + 28 others); Tue, 26 Sep 2023 10:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbjIZOHL (ORCPT ); Tue, 26 Sep 2023 10:07:11 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05193EB for ; Tue, 26 Sep 2023 07:07:04 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-317c3ac7339so8616759f8f.0 for ; Tue, 26 Sep 2023 07:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695737222; x=1696342022; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3fL7byGgITI5Pp0Gd+G4m6HpKfvXhtfMbVSSCjqe9VQ=; b=BnCASo/Tc6qi8EZNvvmtD3lpKkDK5Jr10FBAjpayIpuUuTWRz+oWq5JIEXd8y8Oi9y 5MbEsapYW42020HkaAUkZGGEG1TxizLzNgG+0sLORgH4dbUuOe8B/yo8Fmac0/LSOWRm vnGYrva4u1M3QdsYVkLOiU+wVOiOkkW6MJfbPxtqcvKSqClcAfBYIYkWKqwkXtUjOM4a x1IuOqaJZ37If7bT35bvHgR3EZNHfQX4+jROIFzLAhXQ5pAOWeAeHA1lubjEQ2FT4o52 rbIf4hqF71maWXWVBUQiz1x+Dqla2Elt4xhwbwveJAOhcRqLxHIR6LZRcHoWWPTK/ivS 32Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695737222; x=1696342022; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3fL7byGgITI5Pp0Gd+G4m6HpKfvXhtfMbVSSCjqe9VQ=; b=G3Tc54qQTs7iDAD3R1atvP0IvpIw0ucE36nDlgqJq8nafSrntaTQYkabOATYM9ZLVi RbO7Z+rmAN76IJmNvTnKb20WpEhGWVm5cXq5Cf66tTFvx+24pNc6cLscOGplsFqAu2HW HgmdK6sP90sFYK/CsPAYVm5EF5ci021wwnUGVR5BTuh6Ps2ouk+rk9dDGI2D2sqDV6RN D6KBWqhMN4RrvJSlSVp/8myAcj0kLBkWoXZO6/B/V8DZRhQw0SOIDwJ06FCvYruv6c3/ a8H4T7gZrnfGsNXck2dA2kGL2blgPD6U78KbO1oyNrMHCR77TaRW0FHP5m1bSGldCXfw Gcrw== X-Gm-Message-State: AOJu0YwvuQBZBmpcyjRtgBLApXrAOIgvlDVIvVRG2lneIS3cQfPmu/Pb rLJmZsmNJ3Lu036DLIKEHosYDQ== X-Received: by 2002:a5d:4c85:0:b0:317:6ef1:7939 with SMTP id z5-20020a5d4c85000000b003176ef17939mr9042370wrs.23.1695737222048; Tue, 26 Sep 2023 07:07:02 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id b1-20020a5d4d81000000b003215c6e30cbsm14632256wru.104.2023.09.26.07.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:07:01 -0700 (PDT) Date: Tue, 26 Sep 2023 17:06:58 +0300 From: Dan Carpenter To: Peter Ujfalusi Cc: Vinod Koul , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Siddharth Vadapalli , Roger Quadros , Grygorii Strashko , MD Danish Anwar , Andrew Lunn , Vignesh Raghavendra , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 3/3 net] dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return Message-ID: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4c2073cc-e7ef-4f16-9655-1a46cfed9fe9@moroto.mountain> X-Mailer: git-send-email haha only kidding X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Tue, 26 Sep 2023 07:07:16 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778123430416637303 X-GMAIL-MSGID: 1778123430416637303 The k3_udma_glue_tx_get_irq() function currently returns negative error codes on error, zero on error and positive values for success. This complicates life for the callers who need to propagate the error code. Also GCC will not warn about unsigned comparisons when you check: if (unsigned_irq <= 0) All the callers have been fixed now but let's just make this easy going forward. Signed-off-by: Dan Carpenter Reviewed-by: Roger Quadros Acked-by: Vinod Koul --- drivers/dma/ti/k3-udma-glue.c | 3 +++ drivers/net/ethernet/ti/am65-cpsw-nuss.c | 4 ++-- drivers/net/ethernet/ti/icssg/icssg_prueth.c | 4 +--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c index 789193ed0386..c278d5facf7d 100644 --- a/drivers/dma/ti/k3-udma-glue.c +++ b/drivers/dma/ti/k3-udma-glue.c @@ -558,6 +558,9 @@ int k3_udma_glue_tx_get_irq(struct k3_udma_glue_tx_channel *tx_chn) tx_chn->virq = k3_ringacc_get_ring_irq_num(tx_chn->ringtxcq); } + if (!tx_chn->virq) + return -ENXIO; + return tx_chn->virq; } EXPORT_SYMBOL_GPL(k3_udma_glue_tx_get_irq); diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 31e84c503e22..24120605502f 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -1747,10 +1747,10 @@ static int am65_cpsw_nuss_init_tx_chns(struct am65_cpsw_common *common) } tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn); - if (tx_chn->irq <= 0) { + if (tx_chn->irq < 0) { dev_err(dev, "Failed to get tx dma irq %d\n", tx_chn->irq); - ret = tx_chn->irq ?: -ENXIO; + ret = tx_chn->irq; goto err; } diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c index 89c0c3449d98..3c611b9aaecf 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c @@ -317,9 +317,7 @@ static int prueth_init_tx_chns(struct prueth_emac *emac) } ret = k3_udma_glue_tx_get_irq(tx_chn->tx_chn); - if (ret <= 0) { - if (!ret) - ret = -EINVAL; + if (ret < 0) { netdev_err(ndev, "failed to get tx irq\n"); goto fail; }