Skip to content

Commit da1ef8e

Browse files
robimarkogregkh
authored andcommitted
net: phy: micrel: always set shared->phydev for LAN8814
[ Upstream commit 399d109 ] Currently, during the LAN8814 PTP probe shared->phydev is only set if PTP clock gets actually set, otherwise the function will return before setting it. This is an issue as shared->phydev is unconditionally being used when IRQ is being handled, especially in lan8814_gpio_process_cap and since it was not set it will cause a NULL pointer exception and crash the kernel. So, simply always set shared->phydev to avoid the NULL pointer exception. Fixes: b3f1a08 ("net: phy: micrel: Add support for PTP_PF_EXTTS for lan8814") Signed-off-by: Robert Marko <[email protected]> Tested-by: Horatiu Vultur <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 7a832b0 commit da1ef8e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/phy/micrel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3870,6 +3870,8 @@ static int lan8814_ptp_probe_once(struct phy_device *phydev)
38703870
{
38713871
struct lan8814_shared_priv *shared = phydev->shared->priv;
38723872

3873+
shared->phydev = phydev;
3874+
38733875
/* Initialise shared lock for clock*/
38743876
mutex_init(&shared->shared_lock);
38753877

@@ -3921,8 +3923,6 @@ static int lan8814_ptp_probe_once(struct phy_device *phydev)
39213923

39223924
phydev_dbg(phydev, "successfully registered ptp clock\n");
39233925

3924-
shared->phydev = phydev;
3925-
39263926
/* The EP.4 is shared between all the PHYs in the package and also it
39273927
* can be accessed by any of the PHYs
39283928
*/

0 commit comments

Comments
 (0)