All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: marvell: unlock after phy_select_page() failure
@ 2020-05-29 10:02 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-05-29 10:02 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Florian Fainelli, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, netdev, kernel-janitors

We need to call phy_restore_page() even if phy_select_page() fails.
Otherwise we are holding the phy_lock_mdio_bus() lock.  This requirement
is documented at the start of the phy_select_page() function.

Fixes: a618e86da91d ("net : phy: marvell: Speedup TDR data retrieval by only changing page once")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/phy/marvell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 2c04e3b2b285f..4ea226566cec9 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1867,7 +1867,7 @@ static int marvell_vct5_amplitude_graph(struct phy_device *phydev)
 	 */
 	page = phy_select_page(phydev, MII_MARVELL_VCT5_PAGE);
 	if (page < 0)
-		return page;
+		goto restore_page;
 
 	for (distance = priv->first;
 	     distance <= priv->last;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next] net: phy: marvell: unlock after phy_select_page() failure
@ 2020-05-29 10:02 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-05-29 10:02 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Florian Fainelli, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, netdev, kernel-janitors

We need to call phy_restore_page() even if phy_select_page() fails.
Otherwise we are holding the phy_lock_mdio_bus() lock.  This requirement
is documented at the start of the phy_select_page() function.

Fixes: a618e86da91d ("net : phy: marvell: Speedup TDR data retrieval by only changing page once")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/phy/marvell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 2c04e3b2b285f..4ea226566cec9 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1867,7 +1867,7 @@ static int marvell_vct5_amplitude_graph(struct phy_device *phydev)
 	 */
 	page = phy_select_page(phydev, MII_MARVELL_VCT5_PAGE);
 	if (page < 0)
-		return page;
+		goto restore_page;
 
 	for (distance = priv->first;
 	     distance <= priv->last;
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] net: phy: marvell: unlock after phy_select_page() failure
  2020-05-29 10:02 ` Dan Carpenter
@ 2020-05-29 14:25   ` Andrew Lunn
  -1 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2020-05-29 14:25 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Florian Fainelli, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, netdev, kernel-janitors

On Fri, May 29, 2020 at 01:02:07PM +0300, Dan Carpenter wrote:
> We need to call phy_restore_page() even if phy_select_page() fails.
> Otherwise we are holding the phy_lock_mdio_bus() lock.  This requirement
> is documented at the start of the phy_select_page() function.
> 
> Fixes: a618e86da91d ("net : phy: marvell: Speedup TDR data retrieval by only changing page once")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] net: phy: marvell: unlock after phy_select_page() failure
@ 2020-05-29 14:25   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2020-05-29 14:25 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Florian Fainelli, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, netdev, kernel-janitors

On Fri, May 29, 2020 at 01:02:07PM +0300, Dan Carpenter wrote:
> We need to call phy_restore_page() even if phy_select_page() fails.
> Otherwise we are holding the phy_lock_mdio_bus() lock.  This requirement
> is documented at the start of the phy_select_page() function.
> 
> Fixes: a618e86da91d ("net : phy: marvell: Speedup TDR data retrieval by only changing page once")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] net: phy: marvell: unlock after phy_select_page() failure
  2020-05-29 10:02 ` Dan Carpenter
@ 2020-05-29 19:48   ` David Miller
  -1 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-05-29 19:48 UTC (permalink / raw)
  To: dan.carpenter
  Cc: andrew, f.fainelli, hkallweit1, linux, kuba, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 29 May 2020 13:02:07 +0300

> We need to call phy_restore_page() even if phy_select_page() fails.
> Otherwise we are holding the phy_lock_mdio_bus() lock.  This requirement
> is documented at the start of the phy_select_page() function.
> 
> Fixes: a618e86da91d ("net : phy: marvell: Speedup TDR data retrieval by only changing page once")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] net: phy: marvell: unlock after phy_select_page() failure
@ 2020-05-29 19:48   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-05-29 19:48 UTC (permalink / raw)
  To: dan.carpenter
  Cc: andrew, f.fainelli, hkallweit1, linux, kuba, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 29 May 2020 13:02:07 +0300

> We need to call phy_restore_page() even if phy_select_page() fails.
> Otherwise we are holding the phy_lock_mdio_bus() lock.  This requirement
> is documented at the start of the phy_select_page() function.
> 
> Fixes: a618e86da91d ("net : phy: marvell: Speedup TDR data retrieval by only changing page once")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-29 19:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 10:02 [PATCH net-next] net: phy: marvell: unlock after phy_select_page() failure Dan Carpenter
2020-05-29 10:02 ` Dan Carpenter
2020-05-29 14:25 ` Andrew Lunn
2020-05-29 14:25   ` Andrew Lunn
2020-05-29 19:48 ` David Miller
2020-05-29 19:48   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.