[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1410311911070.2481@hadrien>
Date: Fri, 31 Oct 2014 19:11:30 +0100 (CET)
From: Julia Lawall <julia.lawall@...6.fr>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org, trivial@...nel.org,
Coccinelle <cocci@...teme.lip6.fr>
Subject: Re: [PATCH resent] staging: rtl8188eu: Deletion of unnecessary checks
before three function calls
On Fri, 31 Oct 2014, SF Markus Elfring wrote:
> >> The functions kfree(), rtw_free_netdev() and vfree() test whether their
> >> argument is NULL and then return immediately. Thus the test around the call
> >> is not needed.
> >>
> >> This issue was detected by using the Coccinelle software.
> >>
> >> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> >> ---
> >> drivers/staging/rtl8188eu/core/rtw_efuse.c | 3 +--
> >> drivers/staging/rtl8188eu/core/rtw_mlme.c | 3 +--
> >> drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 3 +--
> >> drivers/staging/rtl8188eu/core/rtw_xmit.c | 6 ++----
> >> drivers/staging/rtl8188eu/os_dep/usb_intf.c | 5 ++---
> >> 5 files changed, 7 insertions(+), 13 deletions(-)
> >>
> >> diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c
> >> b/drivers/staging/rtl8188eu/core/rtw_efuse.c
> >> index 7006088..77f7552 100644
> >> --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
> >> +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
> >> @@ -212,8 +212,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16
> >> _size_byte, u8 *pbuf)
> >> exit:
> >> kfree(efuseTbl);
> >>
> >> - if (eFuseWord)
> >> - kfree(eFuseWord);
> >> + kfree(eFuseWord);
> >
> > I think that this code has been updated already. It would be better to
> > add labels so that kfree is only executed when needed.
>
> Are there any chances to achieve the suggested fine-tuning for jump labels
> also with another semantic patch approach?
No, I don't think so. The pattern is not regular enough.
julia
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists