Skip to content

Commit

Permalink
net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit()
Browse files Browse the repository at this point in the history
[ Upstream commit b0e380b ]

If ptp was not enabled due to missing IRQ for instance,
lan966x_ptp_deinit() will dereference NULL pointers.

Fixes: d096459 ("net: lan966x: Add support for ptp clocks")
Signed-off-by: Clément Léger <clement.leger@bootlin.com>
Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
clementleger authored and gregkh committed Jan 18, 2023
1 parent bbc17e8 commit c2258d5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
Expand Up @@ -853,6 +853,9 @@ void lan966x_ptp_deinit(struct lan966x *lan966x)
struct lan966x_port *port;
int i;

if (!lan966x->ptp)
return;

for (i = 0; i < lan966x->num_phys_ports; i++) {
port = lan966x->ports[i];
if (!port)
Expand Down

0 comments on commit c2258d5

Please sign in to comment.