From patchwork Thu Jun 6 14:23:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13688559 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04EFAC25B75 for ; Thu, 6 Jun 2024 14:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=d7/CSFwUl71M3nzB4VYA9bteBQXmcxQ0H8vQPzJFgyM=; b=I2uExDfzs+zRYe 8t94ZQFPjW1cVs1MThsAx0gadYJsGHWaC8xKZLJDkHfgyF0UQASsNwqUtuv4x8wNSy0oWRCKvAUtX ipFnmO3EXlcU85TUdw4T3oPKP547Nh6iL9LH9MglWXujZusNZgt9YaXwJg3YugqC32ufNNVqSmoAr JZEujEo3DuvJEEOYtakvSgqY+3WcEvSON6exYmdESPBnUT2Dfbv991H7wH4lHb+yPkUG66RsYUZAZ fP31fXDnOf4q65ck0EOHfWE3EnLi6Xd+mZN8S3981f2fGtREtaq+uNmocRcUYtyHuD8pdvX6JfTbJ eP9VvV/qy1GifFmsRPSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFE21-0000000A3Nn-1Az7; Thu, 06 Jun 2024 14:23:57 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFE1y-0000000A3My-3kkQ for linux-arm-kernel@lists.infradead.org; Thu, 06 Jun 2024 14:23:56 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-57a32b0211aso1362013a12.2 for ; Thu, 06 Jun 2024 07:23:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717683831; x=1718288631; darn=lists.infradead.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=is6s/GpBASAFrFWj8/JczGtlu19laRTn68QOzHiY+QA=; b=Dc46zIylB0p20T31zikstImFo7c4f29c7jh8RenC2fj6zRcoCj8a8y8c/GJMv6KXRm gkk+Yzs+f03/r8uTUUjF95Cn1eJ20RAFdX3ka3vCj0jiH4yXGR7e2vUBgPlxXrsQKIiV AyTK77rf84ZxyWwIiW50Q0RPzCN5pwNiQK1vY3Piypd5WbpTqrRibLtGb8KWi/6RZxMg DHgxIUz7lIFBzYnN5NqA3VpN0QEX8KKaK9FHZVgaOQqjMCZWlDreBm6QgBWoeZBeMPWq M1YbM4J3kz6Toy4WS1abvK4VlGOHlaUgLWsE9nXs3L8Z99GCKVrooFT43uE+nSVbpCxN 0bIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717683831; x=1718288631; h=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=is6s/GpBASAFrFWj8/JczGtlu19laRTn68QOzHiY+QA=; b=UhuoOb81NuvXx4RseTguhA7jSRE51kg9ZVQ+FK4t2ThdVH9mkQaG44y9htxdy5qvxn RR1kUb0Yxdio2x/h0o78zq1E2f4yshLUg+nkFIKfRvCc2gdXPesbIN2H3jhTJXVwb3U/ 23ZbgM0oxdorhi9ZGwtDdsPAZKKV9gLLkEWa0bOaQBpHXvP/b6MLWdK7DNbCNca0TbxY QTem56Da5jpG+66bY6unkHVOhxvKLWx44hNGKfre3KULDU+gCrfowyfP81CbY6NC05G4 exyINmcPWH4M9/6xamZKL0Ygx27VkdrJlVOCDMTBi+poVv7KoiWjvG1CDUsThPENeveB gVzw== X-Forwarded-Encrypted: i=1; AJvYcCXTz2W6FhNx7U7FijDVUNQG1xjMBpRc+eRJlEu6Z6UmzR7JqJzJKhXdPLdnCd0tRuJAiydkTQ2oIUHheIQhjrDjrZbo8Xo6l1nHic9ARu59d7b1q/0= X-Gm-Message-State: AOJu0YzR3DPN4Q97rTWoEp/QGQJSdZZonYWlCkbM6CSHrLHOJc3U3xea Na/yhs2/64Fx73zMXr9P/1xIwvmxpxqrJLQ+20pwHlhSwAkxDEQcZ/0L532Iybg= X-Google-Smtp-Source: AGHT+IHgstzJ2kZrCspX8fsFXWFYWZkQB0H/XNx5XJ20AdVItbU/LBbuTqT5RL9D/+AsyONocr+DnA== X-Received: by 2002:a50:d79b:0:b0:57a:259a:489a with SMTP id 4fb4d7f45d1cf-57a8b6a698fmr3514806a12.14.1717683830353; Thu, 06 Jun 2024 07:23:50 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aae2323f7sm1159364a12.85.2024.06.06.07.23.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:23:49 -0700 (PDT) Date: Thu, 6 Jun 2024 17:23:44 +0300 From: Dan Carpenter To: Peter Ujfalusi Cc: Vinod Koul , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , MD Danish Anwar , Roger Quadros , Grygorii Strashko , Julien Panis , Chintan Vankar , Diogo Ivo , Simon Horman , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-janitors@vger.kernel.org Subject: [PATCH net-next] dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_irq() Message-ID: <2f28f769-6929-4fc2-b875-00bf1d8bf3c4@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240606_072355_026826_37368E24 X-CRM114-Status: GOOD ( 15.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently the k3_udma_glue_rx_get_irq() function returns either negative error codes or zero on error. Generally, in the kernel, zero means success so this be confusing and has caused bugs in the past. Also the "tx" version of this function only returns negative error codes. Let's clean this "rx" function so both functions match. This patch has no effect on runtime. Signed-off-by: Dan Carpenter Acked-by: Peter Ujfalusi 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_common.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 c9b93055dc9d..b96b448a0e69 100644 --- a/drivers/dma/ti/k3-udma-glue.c +++ b/drivers/dma/ti/k3-udma-glue.c @@ -1531,6 +1531,9 @@ int k3_udma_glue_rx_get_irq(struct k3_udma_glue_rx_channel *rx_chn, flow->virq = k3_ringacc_get_ring_irq_num(flow->ringrx); } + if (!flow->virq) + return -ENXIO; + return flow->virq; } EXPORT_SYMBOL_GPL(k3_udma_glue_rx_get_irq); diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 4e50b3792888..8c26acc9cde1 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -2424,10 +2424,10 @@ static int am65_cpsw_nuss_init_rx_chns(struct am65_cpsw_common *common) rx_chn->irq = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i); - if (rx_chn->irq <= 0) { + if (rx_chn->irq < 0) { dev_err(dev, "Failed to get rx dma irq %d\n", rx_chn->irq); - ret = -ENXIO; + ret = rx_chn->irq; goto err; } } diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c index 088ab8076db4..cac7863c5cb2 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_common.c +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c @@ -440,9 +440,7 @@ int prueth_init_rx_chns(struct prueth_emac *emac, fdqring_id = k3_udma_glue_rx_flow_get_fdq_id(rx_chn->rx_chn, i); ret = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i); - if (ret <= 0) { - if (!ret) - ret = -ENXIO; + if (ret < 0) { netdev_err(ndev, "Failed to get rx dma irq"); goto fail; }