net: ethernet: aquantia: Null pointer check for aq_nic_ndev_alloc.
We should check for a null pointer for aq_nic_ndev_alloc instead netdev_priv. Signed-off-by: Pavel Belous <pavel.belous@aquantia.com> Reviewed-by: Lino Sanfilippo <LinoSanfilippo@gmx.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b350d7b8b8
commit
df9000ef96
|
@ -202,12 +202,13 @@ struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops,
|
|||
int err = 0;
|
||||
|
||||
ndev = aq_nic_ndev_alloc();
|
||||
self = netdev_priv(ndev);
|
||||
if (!self) {
|
||||
err = -EINVAL;
|
||||
if (!ndev) {
|
||||
err = -ENOMEM;
|
||||
goto err_exit;
|
||||
}
|
||||
|
||||
self = netdev_priv(ndev);
|
||||
|
||||
ndev->netdev_ops = ndev_ops;
|
||||
ndev->ethtool_ops = et_ops;
|
||||
|
||||
|
|
Loading…
Reference in New Issue