summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/aquantia/atlantic
diff options
context:
space:
mode:
authorPavel Belous <pavel.belous@aquantia.com>2017-02-20 22:36:46 +0300
committerDavid S. Miller <davem@davemloft.net>2017-02-20 17:11:09 -0500
commitdf9000ef9609c8a5e57783d0667ba7f39f52ed1e (patch)
tree3577f23d8ce2925166c9b48538f9bee8bc773271 /drivers/net/ethernet/aquantia/atlantic
parentb350d7b8b8c99d67dc9a21eeeb1f3564c5213cbd (diff)
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>
Diffstat (limited to 'drivers/net/ethernet/aquantia/atlantic')
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_nic.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 019bcc725715..a8a27c5e8aeb 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -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;