Check for corner case of port_init failure before using the port_info pointer.
Unified · Split
| @@ -126,6 +126,11 @@ static int ionic_get_link_ksettings(struct net_device *netdev, · 125 unmodified lines | |||
| 126 | 126 | ||
| 127 | ethtool_link_ksettings_zero_link_mode(ks, supported); | 127 | ethtool_link_ksettings_zero_link_mode(ks, supported); |
| 128 | 128 | ||
| 129 | if (!idev->port_info) { | ||
| 130 | netdev_err(netdev, "port_info not initialized\n"); | ||
| 131 | return -EOPNOTSUPP; | ||
| 132 | } | ||
| 133 | |||
| 129 | /* The port_info data is found in a DMA space that the NIC keeps | 134 | /* The port_info data is found in a DMA space that the NIC keeps |
| 130 | * up-to-date, so there's no need to request the data from the | 135 | * up-to-date, so there's no need to request the data from the |
| 131 | * NIC, we already have it in our memory space. | 136 | * NIC, we already have it in our memory space. |