From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Woojung Huh <woojung.huh@microchip.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: [PATCH net-next v1 04/10] net: dsa: microchip: ksz9477: add error handling to ksz9477_r/w_phy
Date: Fri, 29 Jul 2022 15:03:40 +0200 [thread overview]
Message-ID: <20220729130346.2961889-5-o.rempel@pengutronix.de> (raw)
In-Reply-To: <20220729130346.2961889-1-o.rempel@pengutronix.de>
Now ksz_pread/ksz_pwrite can return error value. So, make use of it.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz9477.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 9d749537cf01..074d4c16d427 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -283,6 +283,7 @@ static void ksz9477_r_phy_quirks(struct ksz_device *dev, u16 addr, u16 reg,
int ksz9477_r_phy(struct ksz_device *dev, u16 addr, u16 reg, u16 *data)
{
u16 val = 0xffff;
+ int ret;
/* No real PHY after this. Simulate the PHY.
* A fixed PHY can be setup in the device tree, but this function is
@@ -323,7 +324,10 @@ int ksz9477_r_phy(struct ksz_device *dev, u16 addr, u16 reg, u16 *data)
break;
}
} else {
- ksz_pread16(dev, addr, 0x100 + (reg << 1), &val);
+ ret = ksz_pread16(dev, addr, 0x100 + (reg << 1), &val);
+ if (ret)
+ return ret;
+
ksz9477_r_phy_quirks(dev, addr, reg, &val);
}
@@ -340,11 +344,9 @@ int ksz9477_w_phy(struct ksz_device *dev, u16 addr, u16 reg, u16 val)
/* No gigabit support. Do not write to this register. */
if (!(dev->features & GBIT_SUPPORT) && reg == MII_CTRL1000)
- return 0;
+ return -ENOTSUPP;
- ksz_pwrite16(dev, addr, 0x100 + (reg << 1), val);
-
- return 0;
+ return ksz_pwrite16(dev, addr, 0x100 + (reg << 1), val);
}
void ksz9477_cfg_port_member(struct ksz_device *dev, int port, u8 member)
--
2.30.2
next prev parent reply other threads:[~2022-07-29 13:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-29 13:03 [PATCH net-next v1 00/10] net: dsa: microchip: add error handling and register access validation Oleksij Rempel
2022-07-29 13:03 ` [PATCH net-next v1 01/10] net: dsa: microchip: don't announce extended register support on non Gbit chips Oleksij Rempel
2022-07-29 13:03 ` [PATCH net-next v1 02/10] net: dsa: microchip: allow to pass return values for PHY read/write accesses Oleksij Rempel
2022-08-02 11:19 ` Vladimir Oltean
2022-07-29 13:03 ` [PATCH net-next v1 03/10] net: dsa: microchip: forward error value on all ksz_pread/ksz_pwrite functions Oleksij Rempel
2022-08-02 11:19 ` Vladimir Oltean
2022-07-29 13:03 ` Oleksij Rempel [this message]
2022-08-02 11:24 ` [PATCH net-next v1 04/10] net: dsa: microchip: ksz9477: add error handling to ksz9477_r/w_phy Vladimir Oltean
2022-07-29 13:03 ` [PATCH net-next v1 05/10] net: dsa: microchip: ksz8795: add error handling to ksz8_r/w_phy Oleksij Rempel
2022-08-02 11:29 ` Vladimir Oltean
2022-07-29 13:03 ` [PATCH net-next v1 06/10] net: dsa: microchip: KSZ9893: do not write to not supported Output Clock Control Register Oleksij Rempel
2022-07-29 13:03 ` [PATCH net-next v1 07/10] net: dsa: microchip: warn about not supported synclko properties on KSZ9893 chips Oleksij Rempel
2022-08-02 11:36 ` Vladimir Oltean
2022-08-05 11:56 ` Oleksij Rempel
2022-08-05 13:42 ` Vladimir Oltean
2022-08-13 14:32 ` Oleksij Rempel
2022-08-13 15:11 ` Andrew Lunn
2022-08-13 16:18 ` Oleksij Rempel
2022-08-13 20:42 ` Andrew Lunn
2022-08-14 4:26 ` Oleksij Rempel
2022-08-14 8:04 ` Vladimir Oltean
2022-07-29 13:03 ` [PATCH net-next v1 08/10] net: dsa: microchip: add support for regmap_access_tables Oleksij Rempel
2022-07-29 13:03 ` [PATCH net-next v1 09/10] net: dsa: microchip: add regmap_range for KSZ8563 chip Oleksij Rempel
2022-08-01 5:11 ` Oleksij Rempel
2022-07-29 13:03 ` [PATCH net-next v1 10/10] net: dsa: microchip: ksz9477: remove MII_CTRL1000 check from ksz9477_w_phy() Oleksij Rempel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220729130346.2961889-5-o.rempel@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.com \
--cc=woojung.huh@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).