* [PATCH] net: phy: dp83867: Fix a never true comparison
@ 2022-03-19 14:02 li.haolin
2022-04-01 15:32 ` Ramon Fried
0 siblings, 1 reply; 3+ messages in thread
From: li.haolin @ 2022-03-19 14:02 UTC (permalink / raw)
To: joe.hershberger, rfried.dev; +Cc: u-boot, Haolin Li
From: Haolin Li <li.haolin@qq.com>
The type of the return value of phy_read() and phy_read_mmd() is int.
Change the variable to not be unsigned so that we not get into an
unsigned compared against 0.
Signed-off-by: Haolin Li <li.haolin@qq.com>
---
drivers/net/phy/dp83867.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index eada4541c9..c5d44f4629 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -266,7 +266,7 @@ static int dp83867_of_init(struct phy_device *phydev)
static int dp83867_config(struct phy_device *phydev)
{
struct dp83867_private *dp83867;
- unsigned int val, delay, cfg2;
+ int val, delay, cfg2;
int ret, bs;
dp83867 = (struct dp83867_private *)phydev->priv;
@@ -291,8 +291,11 @@ static int dp83867_config(struct phy_device *phydev)
if (phy_interface_is_rgmii(phydev)) {
val = phy_read(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL);
- if (val < 0)
+ if (val < 0) {
+ ret = val;
goto err_out;
+ }
+
val &= ~DP83867_PHYCR_FIFO_DEPTH_MASK;
val |= (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: dp83867: Fix a never true comparison
2022-03-19 14:02 [PATCH] net: phy: dp83867: Fix a never true comparison li.haolin
@ 2022-04-01 15:32 ` Ramon Fried
2022-04-01 19:20 ` Ramon Fried
0 siblings, 1 reply; 3+ messages in thread
From: Ramon Fried @ 2022-04-01 15:32 UTC (permalink / raw)
To: li.haolin; +Cc: Joe Hershberger, U-Boot Mailing List
On Sat, Mar 19, 2022 at 4:02 PM <li.haolin@qq.com> wrote:
>
> From: Haolin Li <li.haolin@qq.com>
>
> The type of the return value of phy_read() and phy_read_mmd() is int.
> Change the variable to not be unsigned so that we not get into an
> unsigned compared against 0.
>
> Signed-off-by: Haolin Li <li.haolin@qq.com>
> ---
> drivers/net/phy/dp83867.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
> index eada4541c9..c5d44f4629 100644
> --- a/drivers/net/phy/dp83867.c
> +++ b/drivers/net/phy/dp83867.c
> @@ -266,7 +266,7 @@ static int dp83867_of_init(struct phy_device *phydev)
> static int dp83867_config(struct phy_device *phydev)
> {
> struct dp83867_private *dp83867;
> - unsigned int val, delay, cfg2;
> + int val, delay, cfg2;
> int ret, bs;
>
> dp83867 = (struct dp83867_private *)phydev->priv;
> @@ -291,8 +291,11 @@ static int dp83867_config(struct phy_device *phydev)
>
> if (phy_interface_is_rgmii(phydev)) {
> val = phy_read(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL);
> - if (val < 0)
> + if (val < 0) {
> + ret = val;
> goto err_out;
> + }
> +
> val &= ~DP83867_PHYCR_FIFO_DEPTH_MASK;
> val |= (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT);
>
> --
> 2.25.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: dp83867: Fix a never true comparison
2022-04-01 15:32 ` Ramon Fried
@ 2022-04-01 19:20 ` Ramon Fried
0 siblings, 0 replies; 3+ messages in thread
From: Ramon Fried @ 2022-04-01 19:20 UTC (permalink / raw)
To: li.haolin; +Cc: Joe Hershberger, U-Boot Mailing List
On Fri, Apr 1, 2022 at 6:32 PM Ramon Fried <rfried.dev@gmail.com> wrote:
>
> On Sat, Mar 19, 2022 at 4:02 PM <li.haolin@qq.com> wrote:
> >
> > From: Haolin Li <li.haolin@qq.com>
> >
> > The type of the return value of phy_read() and phy_read_mmd() is int.
> > Change the variable to not be unsigned so that we not get into an
> > unsigned compared against 0.
> >
> > Signed-off-by: Haolin Li <li.haolin@qq.com>
> > ---
> > drivers/net/phy/dp83867.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
> > index eada4541c9..c5d44f4629 100644
> > --- a/drivers/net/phy/dp83867.c
> > +++ b/drivers/net/phy/dp83867.c
> > @@ -266,7 +266,7 @@ static int dp83867_of_init(struct phy_device *phydev)
> > static int dp83867_config(struct phy_device *phydev)
> > {
> > struct dp83867_private *dp83867;
> > - unsigned int val, delay, cfg2;
> > + int val, delay, cfg2;
> > int ret, bs;
> >
> > dp83867 = (struct dp83867_private *)phydev->priv;
> > @@ -291,8 +291,11 @@ static int dp83867_config(struct phy_device *phydev)
> >
> > if (phy_interface_is_rgmii(phydev)) {
> > val = phy_read(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL);
> > - if (val < 0)
> > + if (val < 0) {
> > + ret = val;
> > goto err_out;
> > + }
> > +
> > val &= ~DP83867_PHYCR_FIFO_DEPTH_MASK;
> > val |= (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT);
> >
> > --
> > 2.25.1
> >
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Applied to u-boot-net/next
Thanks,
Ramon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-01 19:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19 14:02 [PATCH] net: phy: dp83867: Fix a never true comparison li.haolin
2022-04-01 15:32 ` Ramon Fried
2022-04-01 19:20 ` Ramon Fried
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).