miiphy: miiphyutil.c: fix compile warning
PATCH 1/1 miiphy: miiphyutil.c: fix compile warning
Fix warning introduced while recent PHY Lib changes:
miiphyutil.c: In function 'miiphy_read':
miiphyutil.c:304: warning: comparison is always false due to limited range of data type
Signed-off-by Anatolij Gustschin <[email protected]>
Cc Andy Fleming <[email protected]>
--- common/miiphyutil.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
common/miiphyutil.c +8 -4
@@ -294,14 +294,18 @@ int miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) {struct mii_dev *bus; +int ret; bus =miiphy_get_active_dev (devname); -if (bus) - *value = bus->read (bus, addr,MDIO_DEVAD_NONE , reg); -else +if (!bus)return 1 ; -return (*value <0 ) ?1 :0 ; + ret = bus->read (bus, addr,MDIO_DEVAD_NONE , reg); +if (ret <0 ) +return 1 ; + + *value = (unsigned short )ret; +return 0 ; }/*****************************************************************************
Signature · 1 line
1.7.1
Wolfgang Denk
AppliedPATCH 1/1 miiphy: miiphyutil.c: fix compile warning
Dear Anatolij Gustschin,
Quoted 10 lines · In message <[email protected]> you wrote:
Fix warning introduced while recent PHY Lib changes:
miiphyutil.c: In function 'miiphy_read':
miiphyutil.c:304: warning: comparison is always false due to limited range of data typeSigned-off-by Anatolij Gustschin <[email protected]>Cc Andy Fleming <[email protected]>--- common/miiphyutil.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de It is easier to change the specification to fit the program than vice versa.