diff mbox series

[net-next] net: phy: aquantia: do not return an error on clearing pending IRQs

Message ID 20201109154601.3812574-1-ciorneiioana@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series [net-next] net: phy: aquantia: do not return an error on clearing pending IRQs | expand

Checks

Context Check Description
jkicinski/cover_letter success Link
jkicinski/fixes_present success Link
jkicinski/patch_count success Link
jkicinski/tree_selection success Clearly marked for net-next
jkicinski/subject_prefix success Link
jkicinski/source_inline success Was 0 now: 0
jkicinski/verify_signedoff success Link
jkicinski/module_param success Was 0 now: 0
jkicinski/build_32bit success Errors and warnings before: 0 this patch: 0
jkicinski/kdoc success Errors and warnings before: 0 this patch: 0
jkicinski/verify_fixes success Link
jkicinski/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
jkicinski/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
jkicinski/header_inline success Link
jkicinski/stable success Stable not CCed

Commit Message

Ioana Ciornei Nov. 9, 2020, 3:46 p.m. UTC
From: Ioana Ciornei <ioana.ciornei@nxp.com>

The referenced commit added in .config_intr() the part of code which upon
configuration of the IRQ state it also clears up any pending IRQ. If
there were actually pending IRQs, a read on the IRQ status register will
return something non zero. This should not result in the callback
returning an error.

Fix this by returning an error only when the result of the
phy_read_mmd() is negative.

Fixes: e11ef96d44f1 ("net: phy: aquantia: remove the use of .ack_interrupt()")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/net/phy/aquantia_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Camelia Alexandra Groza Nov. 11, 2020, 4:44 p.m. UTC | #1
> -----Original Message-----
> From: Ioana Ciornei <ciorneiioana@gmail.com>
> Sent: Monday, November 9, 2020 17:46
> To: kuba@kernel.org; netdev@vger.kernel.org
> Cc: Ioana Ciornei <ioana.ciornei@nxp.com>
> Subject: [PATCH net-next] net: phy: aquantia: do not return an error on
> clearing pending IRQs
> 
> From: Ioana Ciornei <ioana.ciornei@nxp.com>
> 
> The referenced commit added in .config_intr() the part of code which upon
> configuration of the IRQ state it also clears up any pending IRQ. If
> there were actually pending IRQs, a read on the IRQ status register will
> return something non zero. This should not result in the callback
> returning an error.
> 
> Fix this by returning an error only when the result of the
> phy_read_mmd() is negative.
> 
> Fixes: e11ef96d44f1 ("net: phy: aquantia: remove the use of
> .ack_interrupt()")
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>

I ran into this issue recently. Thanks for the fix.

Tested-by: Camelia Groza <camelia.groza@nxp.com>
Jakub Kicinski Nov. 11, 2020, 10:11 p.m. UTC | #2
On Mon,  9 Nov 2020 17:46:01 +0200 Ioana Ciornei wrote:
> From: Ioana Ciornei <ioana.ciornei@nxp.com>
> 
> The referenced commit added in .config_intr() the part of code which upon
> configuration of the IRQ state it also clears up any pending IRQ. If
> there were actually pending IRQs, a read on the IRQ status register will
> return something non zero. This should not result in the callback
> returning an error.
> 
> Fix this by returning an error only when the result of the
> phy_read_mmd() is negative.
> 
> Fixes: e11ef96d44f1 ("net: phy: aquantia: remove the use of .ack_interrupt()")
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>

Applied, thanks!
diff mbox series

Patch

diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c
index 345f70f9d39b..968dd43a2b1e 100644
--- a/drivers/net/phy/aquantia_main.c
+++ b/drivers/net/phy/aquantia_main.c
@@ -250,7 +250,7 @@  static int aqr_config_intr(struct phy_device *phydev)
 	if (en) {
 		/* Clear any pending interrupts before enabling them */
 		err = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2);
-		if (err)
+		if (err < 0)
 			return err;
 	}
 
@@ -273,7 +273,7 @@  static int aqr_config_intr(struct phy_device *phydev)
 	if (!en) {
 		/* Clear any pending interrupts after we have disabled them */
 		err = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2);
-		if (err)
+		if (err < 0)
 			return err;
 	}