From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Shtylyov Subject: [PATCH 2/2] sh_eth: kill redundant check in the probe() method Date: Sun, 31 Dec 2017 21:41:36 +0300 Message-ID: <20171231184448.233694839@cogentembedded.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Cc: Sergei Shtylyov To: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org ("open list:RENESAS ETHERNET DRIVERS") Return-path: Content-Disposition: inline; filename=sh_eth-kill-redundant-check-in-the-probe-method.patch Sender: linux-renesas-soc-owner@vger.kernel.org List-Id: netdev.vger.kernel.org Browsing thru the driver diassembly, I noticed that gcc was able to figure out that the 'ndev' pointer is always non-NULL when calling free_netdev() on the probe() method's error path and thus skip that redundant NULL check... gcc is smart, be like gcc! :-) Signed-off-by: Sergei Shtylyov --- drivers/net/ethernet/renesas/sh_eth.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Index: net-next/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net-next/drivers/net/ethernet/renesas/sh_eth.c @@ -3282,8 +3282,7 @@ out_napi_del: out_release: /* net_dev free */ - if (ndev) - free_netdev(ndev); + free_netdev(ndev); pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev);