* [PATCH 1/2] ravb: kill redundant check in the probe() method
@ 2017-12-31 18:41 Sergei Shtylyov
2018-01-02 7:52 ` Geert Uytterhoeven
2018-01-02 10:09 ` Sergei Shtylyov
0 siblings, 2 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2017-12-31 18:41 UTC (permalink / raw)
To: netdev, "open list:RENESAS ETHERNET DRIVERS"; +Cc: Sergei Shtylyov
[-- Attachment #1: ravb-kill-redundant-check-in-the-probe-method.patch --]
[-- Type: text/plain, Size: 901 bytes --]
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 <sergei.shtylyov@cogentembedded.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: net-next/drivers/net/ethernet/renesas/ravb_main.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/ravb_main.c
+++ net-next/drivers/net/ethernet/renesas/ravb_main.c
@@ -2205,8 +2205,7 @@ out_dma_free:
if (chip_id != RCAR_GEN2)
ravb_ptp_stop(ndev);
out_release:
- if (ndev)
- free_netdev(ndev);
+ free_netdev(ndev);
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ravb: kill redundant check in the probe() method
2017-12-31 18:41 [PATCH 1/2] ravb: kill redundant check in the probe() method Sergei Shtylyov
@ 2018-01-02 7:52 ` Geert Uytterhoeven
2018-01-02 10:09 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2018-01-02 7:52 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: netdev, open list:RENESAS ETHERNET DRIVERS
Hi Sergei,
On Sun, Dec 31, 2017 at 7:41 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> 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! :-)
Thanks for your patch!
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> --- net-next.orig/drivers/net/ethernet/renesas/ravb_main.c
> +++ net-next/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2205,8 +2205,7 @@ out_dma_free:
> if (chip_id != RCAR_GEN2)
> ravb_ptp_stop(ndev);
> out_release:
> - if (ndev)
> - free_netdev(ndev);
> + free_netdev(ndev);
>
> pm_runtime_put(&pdev->dev);
> pm_runtime_disable(&pdev->dev);
BTW, there isn't a functional dependency, but you may want to move the
freeing of the netdev below disabling of Runtime PM for symmetry (use
reverse order in cleanup).
Gr{oetje,eeting}s,
Geert
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] ravb: kill redundant check in the probe() method
2017-12-31 18:41 [PATCH 1/2] ravb: kill redundant check in the probe() method Sergei Shtylyov
2018-01-02 7:52 ` Geert Uytterhoeven
@ 2018-01-02 10:09 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2018-01-02 10:09 UTC (permalink / raw)
To: netdev, open list:RENESAS ETHERNET DRIVERS
Hello!
On 12/31/2017 9:41 PM, Sergei Shtylyov wrote:
> Browsing thru the driver diassembly, I noticed that gcc was able to
Aw, it's disassembly!
DaveM, is that worth reposting?
> 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 <sergei.shtylyov@cogentembedded.com>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-02 10:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-31 18:41 [PATCH 1/2] ravb: kill redundant check in the probe() method Sergei Shtylyov
2018-01-02 7:52 ` Geert Uytterhoeven
2018-01-02 10:09 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).