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: <YHjJotQ9vQ03KZSH@lunn.ch>
Date:   Fri, 16 Apr 2021 01:17:54 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 net-next 01/10] net: korina: Fix MDIO functions

> +static int korina_mdio_wait(struct korina_private *lp)
> +{
> +	u32 value;
> +
> +	return readl_poll_timeout_atomic(&lp->eth_regs->miimind,
> +					 value, value & ETH_MII_IND_BSY,
> +					 1, 1000);
> +}
> +
> +static int korina_mdio_read(struct net_device *dev, int phy, int reg)
>  {
>  	struct korina_private *lp = netdev_priv(dev);
>  	int ret;
>  
> -	mii_id = ((lp->rx_irq == 0x2c ? 1 : 0) << 8);
> +	if (korina_mdio_wait(lp))
> +		return -ETIMEDOUT;
>  
> -	writel(0, &lp->eth_regs->miimcfg);
> -	writel(0, &lp->eth_regs->miimcmd);
> -	writel(mii_id | reg, &lp->eth_regs->miimaddr);
> -	writel(ETH_MII_CMD_SCN, &lp->eth_regs->miimcmd);
> +	writel(phy << 8 | reg, &lp->eth_regs->miimaddr);
> +	writel(1, &lp->eth_regs->miimcmd);
> +
> +	if (korina_mdio_wait(lp))
> +		return -ETIMEDOUT;

Just return what readl_poll_timeout_atomic() returns. In general, you
should not change error codes.

>  
> -	ret = (int)(readl(&lp->eth_regs->miimrdd));
> +	if (readl(&lp->eth_regs->miimind) & ETH_MII_IND_NV)
> +		return -1;

Please use -ESOMETHING, not -1.

       Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ