[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170617175418.GB1974@lunn.ch>
Date: Sat, 17 Jun 2017 19:54:18 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Salil Mehta <salil.mehta@...wei.com>
Cc: davem@...emloft.net, yisen.zhuang@...wei.com,
huangdaode@...ilicon.com, lipeng321@...wei.com,
mehta.salil.lnk@...il.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linuxarm@...wei.com
Subject: Re: [PATCH V3 net-next 1/8] net: hns3: Add support of HNS3 Ethernet
Driver for hip08 SoC
> +static int hns3_nic_net_up(struct net_device *ndev)
> +{
> + struct hns3_nic_priv *priv = netdev_priv(ndev);
> + struct hnae3_handle *h = priv->ae_handle;
> + int i, j;
> + int ret;
> +
> + ret = hns3_nic_init_irq(priv);
> + if (ret != 0) {
if (ret)
No need to compare with zero.
> + netdev_err(ndev, "hns init irq failed! ret=%d\n", ret);
> + return ret;
> +static int hns3_nic_net_open(struct net_device *ndev)
> +{
> + struct hns3_nic_priv *priv = netdev_priv(ndev);
> + struct hnae3_handle *h = priv->ae_handle;
> + int ret;
> +
> + netif_carrier_off(ndev);
> +
> + ret = netif_set_real_num_tx_queues(ndev, h->kinfo.num_tqps);
> + if (ret < 0) {
> + netdev_err(ndev, "netif_set_real_num_tx_queues fail, ret=%d!\n",
> + ret);
> + return ret;
> + }
In general, functions return 0 for success, and something else for an
error. So there is no need to do a comparison. Please remove all
comparisons, unless it is really needed. It also makes the code look
consistent. At the moment you sometime have < 0, sometime !=0, and
sometimes no comparison at all.
Andrew
Powered by blists - more mailing lists