lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0a77e955-e5a6-4a0e-8c1d-8b2ebd0d1eec@gmail.com>
Date: Thu, 6 Jun 2024 20:30:43 +0300
From: Péter Ujfalusi <peter.ujfalusi@...il.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Vinod Koul <vkoul@...nel.org>, "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
 Paolo Abeni <pabeni@...hat.com>, MD Danish Anwar <danishanwar@...com>,
 Roger Quadros <rogerq@...nel.org>,
 Grygorii Strashko <grygorii.strashko@...com>,
 Julien Panis <jpanis@...libre.com>, Chintan Vankar <c-vankar@...com>,
 Diogo Ivo <diogo.ivo@...mens.com>, Simon Horman <horms@...nel.org>,
 dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
 netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net-next] dmaengine: ti: k3-udma-glue: clean up return in
 k3_udma_glue_rx_get_irq()



On 6/6/24 5:23 PM, Dan Carpenter wrote:
> 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.

Acked-by: Peter Ujfalusi <peter.ujfalusi@...il.com>

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>  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;
>  		}

-- 
Péter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ