Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1336423 > unrolled thread

Re: drivers/net/phy/marvell.c:1037:5-8: WARNING: Unsigned expression compared with zero: val < 0

Started byJulia Lawall <julia.lawall@lip6.fr>
First post2016-02-17 14:40 +0100
Last post2016-02-17 15:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: drivers/net/phy/marvell.c:1037:5-8: WARNING: Unsigned expression  compared with zero: val < 0 Julia Lawall <julia.lawall@lip6.fr> - 2016-02-17 14:40 +0100
    Re: drivers/net/phy/marvell.c:1037:5-8: WARNING: Unsigned expression  compared with zero: val < 0 Andrew Lunn <andrew@lunn.ch> - 2016-02-17 15:00 +0100

#1336423 — Re: drivers/net/phy/marvell.c:1037:5-8: WARNING: Unsigned expression compared with zero: val < 0

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-02-17 14:40 +0100
SubjectRe: drivers/net/phy/marvell.c:1037:5-8: WARNING: Unsigned expression compared with zero: val < 0
Message-ID<r3auM-73z-29@gated-at.bofh.it>
Looks like a problem, please check.

julia


> >> drivers/net/phy/marvell.c:1037:5-8: WARNING: Unsigned expression compared with zero: val < 0
>
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git remote update linus
> git checkout d2fa47d9dd5c5f82d78c4503cf33989f67e8aa64
> vim +1037 drivers/net/phy/marvell.c
>
> d2fa47d9 Andrew Lunn 2015-12-30  1021  #define UINT64_MAX              (u64)(~((u64)0))
> d2fa47d9 Andrew Lunn 2015-12-30  1022  #endif
> d2fa47d9 Andrew Lunn 2015-12-30  1023  static u64 marvell_get_stat(struct phy_device *phydev, int i)
> d2fa47d9 Andrew Lunn 2015-12-30  1024  {
> d2fa47d9 Andrew Lunn 2015-12-30  1025  	struct marvell_hw_stat stat = marvell_hw_stats[i];
> d2fa47d9 Andrew Lunn 2015-12-30  1026  	struct marvell_priv *priv = phydev->priv;
> d2fa47d9 Andrew Lunn 2015-12-30  1027  	int err, oldpage;
> d2fa47d9 Andrew Lunn 2015-12-30  1028  	u64 val;
> d2fa47d9 Andrew Lunn 2015-12-30  1029
> d2fa47d9 Andrew Lunn 2015-12-30  1030  	oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE);
> d2fa47d9 Andrew Lunn 2015-12-30  1031  	err = phy_write(phydev, MII_MARVELL_PHY_PAGE,
> d2fa47d9 Andrew Lunn 2015-12-30  1032  			stat.page);
> d2fa47d9 Andrew Lunn 2015-12-30  1033  	if (err < 0)
> d2fa47d9 Andrew Lunn 2015-12-30  1034  		return UINT64_MAX;
> d2fa47d9 Andrew Lunn 2015-12-30  1035
> d2fa47d9 Andrew Lunn 2015-12-30  1036  	val = phy_read(phydev, stat.reg);
> d2fa47d9 Andrew Lunn 2015-12-30 @1037  	if (val < 0) {
> d2fa47d9 Andrew Lunn 2015-12-30  1038  		val = UINT64_MAX;
> d2fa47d9 Andrew Lunn 2015-12-30  1039  	} else {
> d2fa47d9 Andrew Lunn 2015-12-30  1040  		val = val & ((1 << stat.bits) - 1);
> d2fa47d9 Andrew Lunn 2015-12-30  1041  		priv->stats[i] += val;
> d2fa47d9 Andrew Lunn 2015-12-30  1042  		val = priv->stats[i];
> d2fa47d9 Andrew Lunn 2015-12-30  1043  	}
> d2fa47d9 Andrew Lunn 2015-12-30  1044
> d2fa47d9 Andrew Lunn 2015-12-30  1045  	phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage);
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>

[toc] | [next] | [standalone]


#1336455

FromAndrew Lunn <andrew@lunn.ch>
Date2016-02-17 15:00 +0100
Message-ID<r3aO7-7aS-43@gated-at.bofh.it>
In reply to#1336423
On Wed, Feb 17, 2016 at 08:36:49AM -0500, Julia Lawall wrote:
> Looks like a problem, please check.

Hi Julia

It is, and Dan Carpenter already pointed it out. There is a second phy
driver with the exact same problem. No need to tell me if you find it.

Thanks
       Andrew

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web