From patchwork Tue Sep 26 14:04:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13399268 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE310125BA for ; Tue, 26 Sep 2023 14:04:49 +0000 (UTC) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BAEBEB for ; Tue, 26 Sep 2023 07:04:48 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-404314388ceso95221275e9.2 for ; Tue, 26 Sep 2023 07:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695737087; x=1696341887; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=uczmpeiKwXB8axUDwYOEbCY8/ztReOFNjQ1oGbsb9Io=; b=CAXusjLdWzcnYCoDlcwZdd1uhgXMosQIhM6x1y8F5sepBIQ7klaORJNNw48zlio9Ej ar6s3bZ6ziqZ1513kD9h1Tn1Zr/ocz9/GraKNBlPFn+mjXUsS845g4Ts7EX9cDjHlwuj D/nId7LS+eHoCePbXrl1lI315yq45YKhZW+NN3gS0ssaybtfKDg5jHx8K2l0gKNnFimq Wm8TxkbHYAGY8LmVs/KvfC4NrzlLBaaJId28y69v3T4LYhBJWPDvz5tuw3g9BhxbCp1I SfkLbG+QGQqPjYzUHROsyC1ZVVNhmWkDceGPHPEPYFDG1AH/yjby/fhfoKMTbVT9hkg9 WJOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695737087; x=1696341887; 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=uczmpeiKwXB8axUDwYOEbCY8/ztReOFNjQ1oGbsb9Io=; b=B873/IwDiAKIak+y3AxLIsjIRsxlKsYMQvldVMHxbOkXu0PxVjqoAS9lTEb4A4cNXt fefP7xLTqd/i/lb1DYwley1NXsA55JvfcnmGnVC21hSPdtflpfq4/bi277EQKqwbdRxq UVcyHWo4ypj0YrRdPkw/QidMoiLkE1XoSMnbgWUf1Kdo+NjniVFgwBlhcynmWDmUKAzn usbtB33TN1+9icYm/gNMXUDbukD9JazzCNp7CPDdS/eLyDX6FEba84uogU1Oa2tvkeTB 1VdYvPjVqW/n8y18hZVm7cf0R4702uob5E/9Vc0RQtNlEiF4ryt2muWQWwoegxkI0Hi8 cwdQ== X-Gm-Message-State: AOJu0YxBmAZ0XOCf5lssOW9JBXxqrgAY31gHLmhsGe2TrGOT5osAZINs CJslMhdwaOo0AmVeo5kZheUuHg== X-Google-Smtp-Source: AGHT+IEDz/ZpXWz+o29U1CgHU4VdFdAdoSMqj7ISGG528MHjGDWQoubPXna40xSUkw1fnIeUkF5Zkw== X-Received: by 2002:a05:600c:220f:b0:405:3466:6b8 with SMTP id z15-20020a05600c220f00b00405346606b8mr8787593wml.12.1695737086989; Tue, 26 Sep 2023 07:04:46 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id i19-20020a05600c2d9300b004054dcbf92asm10363169wmg.20.2023.09.26.07.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:04:46 -0700 (PDT) Date: Tue, 26 Sep 2023 17:04:43 +0300 From: Dan Carpenter To: Grygorii Strashko Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Roger Quadros , Siddharth Vadapalli , netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/3 net] net: ethernet: ti: am65-cpsw: Fix error code in am65_cpsw_nuss_init_tx_chns() Message-ID: <4c2073cc-e7ef-4f16-9655-1a46cfed9fe9@moroto.mountain> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline 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_NONE, 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 X-Patchwork-Delegate: kuba@kernel.org This accidentally returns success, but it should return a negative error code. Fixes: 93a76530316a ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver") Signed-off-by: Dan Carpenter Reviewed-by: Roger Quadros --- Sorry for the delay on this. I wrote this before traveling and meant to send it earlier but forgot. drivers/net/ethernet/ti/am65-cpsw-nuss.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index bea6fc0f324c..31e84c503e22 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -1750,6 +1750,7 @@ static int am65_cpsw_nuss_init_tx_chns(struct am65_cpsw_common *common) if (tx_chn->irq <= 0) { dev_err(dev, "Failed to get tx dma irq %d\n", tx_chn->irq); + ret = tx_chn->irq ?: -ENXIO; goto err; } From patchwork Tue Sep 26 14:05:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13399269 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 661E328E2C for ; Tue, 26 Sep 2023 14:06:06 +0000 (UTC) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AFEF101 for ; Tue, 26 Sep 2023 07:06:04 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4053c6f1087so80123425e9.0 for ; Tue, 26 Sep 2023 07:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695737162; x=1696341962; 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=UcRzKohvhYG9fh6I54Q5rNI9BXZ5yEgznCb3EQhNi6o=; b=LDwVgDjpAlqnwFHMlciV4K+o7wf8t3Atq7goezwpkv+OC21DLjcEyMyHPjPuUJH6GN xJDXjTXdzlHPOONn32hlR/VN2uRon1QaEREdqD9ke2VPf6aYF5mi0C/b1zQf7ZgQb2FV BzBLkCzTwCWj0ua0tuEZuM+qocAXaM+wFMfTOQCOxlCgCODBXQcegA+6G18Yk03CNFdw ytD4fAiokyuZoQAkSVCjnJwHkf12AMHBPhqwj3aihGGZocY1UFMJPKKaSgIjuG000FD5 eDcLSzJERW86S5bzuABNoGaLxJwfgGEXonrfUZqaRxMt5+LQ16VNGBFBTh5QlyXBM6m4 DRhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695737162; x=1696341962; 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=UcRzKohvhYG9fh6I54Q5rNI9BXZ5yEgznCb3EQhNi6o=; b=DECcP076wgYn54XJsDf3htKjVfJEjEfUTq+LNM1e1Oiu0Rf3MU32vo4DN/AALFqrg4 GDoz+H7cfwUkNgeOqLGG52m9fdEOdzqTqlq8PH+cZDGATnWYkGmsOCYbIa7vkWtWGoII cL5hUmI6bWIwAVCX42otUwJ7MePaPii5QTFDDzcptsvHSOmb9gRBOkgNcFIE5+L3N2fC SiPyUxYed5Bm3sSUBZzw0D2+CNtcfzN3zyBqa6udx26GWmG5pIfZQjH3ds+OZYEVU/Ff 8cMVBaF1avjsVII0wTEfy3SyOvxxdRRefURddsamGJVynBOK5TtHwohTrMsvXWpx9tI1 nx/g== X-Gm-Message-State: AOJu0Yw3XFbXUizzmPuAn2kbENR8xMxHhAXKhst60LkLvISgGhBbAmtg YoeCYntHSsxxKgvE6e+uPb3Lmw== X-Google-Smtp-Source: AGHT+IHmw82WFnssIIqIEmLrYn1BHyVpk4TK8UqZ0ZbBr+7udHZkOSzO+Gz2dBbsn42VZE3nesQ+Bw== X-Received: by 2002:a7b:c7d5:0:b0:3fe:5501:d284 with SMTP id z21-20020a7bc7d5000000b003fe5501d284mr8407088wmk.11.1695737162629; Tue, 26 Sep 2023 07:06:02 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id g14-20020a7bc4ce000000b003fc01189b0dsm15126914wmk.42.2023.09.26.07.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:06:02 -0700 (PDT) Date: Tue, 26 Sep 2023 17:05:59 +0300 From: Dan Carpenter To: Roger Quadros Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , MD Danish Anwar , Andrew Lunn , Grygorii Strashko , Vignesh Raghavendra , netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/3 net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_tx_chns() Message-ID: <34770474-0345-4223-9c11-9039b74d03b4@moroto.mountain> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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_NONE, 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 lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The "tx_chn->irq" variable is unsigned so the error checking does not work correctly. Fixes: 128d5874c082 ("net: ti: icssg-prueth: Add ICSSG ethernet driver") Signed-off-by: Dan Carpenter Reviewed-by: Roger Quadros --- drivers/net/ethernet/ti/icssg/icssg_prueth.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c index 92b13057d4de..89c0c3449d98 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c @@ -316,12 +316,14 @@ static int prueth_init_tx_chns(struct prueth_emac *emac) goto fail; } - tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn); - if (tx_chn->irq <= 0) { - ret = -EINVAL; + ret = k3_udma_glue_tx_get_irq(tx_chn->tx_chn); + if (ret <= 0) { + if (!ret) + ret = -EINVAL; netdev_err(ndev, "failed to get tx irq\n"); goto fail; } + tx_chn->irq = ret; snprintf(tx_chn->name, sizeof(tx_chn->name), "%s-tx%d", dev_name(dev), tx_chn->id); 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: 13399270 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA7F91C296 for ; Tue, 26 Sep 2023 14:07:05 +0000 (UTC) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 057A4FC for ; Tue, 26 Sep 2023 07:07:04 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32329d935d4so3997301f8f.2 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=pwzWw+b7li7B0R06Xs6HKzw52/O8d2xFSeqFoo+E8n3UPUhAp/pFVwD+scGP1bLiNW zIggT6bRLc7B9ishY7M4Ejq9EsF1YW5VO2kUN4TDmnxPpoRqTPQ/D2GhFA9EqAKeC9En xtvxLD0eeJsfZ9Qu811izWYlloltxU3EKPX+IGqP8vKTv9+ZLY/HmcPKhlIZbrpojFUr JBXH9K/V7YvtQqoRV7dSbqdhB18dhcBQxgXH3HLNnKuMFXdBdI7BI9Bae2wAkG0Ltjee Iuitf4p1kegyHObnpfBKrcKaKj+2vBUm0WFSL8TXbmbHQFSftwcBtjSU55Qz2kQrLaGy a4lg== X-Gm-Message-State: AOJu0YznzEJaAzTE4u7CWABqcAs/SApGWGk5TUMlx76Bm1ERU6wM4g4u 5UgkrJnVEYcZgbUqJH14RVOATQ== X-Google-Smtp-Source: AGHT+IHrmM3RsXnpLcivnylPyp5TD1hIjaMqvfDzbaCd3y/aleld6b+go0DyjpPmtjDYj1lye7oReA== 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: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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_NONE, 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 X-Patchwork-Delegate: kuba@kernel.org 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; }