lkml.org 
[lkml]   [2014]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH 1/1] thunderbolt: Deletion of unnecessary checks before the function call "ring_free"
    Hi Markus,

    ring_free does not check for null:
    http://lxr.free-electrons.com/source/drivers/thunderbolt/nhi.c#L398

    Maybe your software confuses the method with:
    http://lxr.free-electrons.com/source/drivers/char/tpm/xen-tpmfront.c#L268

    Andreas

    On Fri, Nov 21, 2014 at 11:40 AM, SF Markus Elfring
    <elfring@users.sourceforge.net> wrote:
    > From: Markus Elfring <elfring@users.sourceforge.net>
    > Date: Fri, 21 Nov 2014 11:30:18 +0100
    >
    > The ring_free() function tests whether its argument is NULL and then
    > returns 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@users.sourceforge.net>
    > ---
    > drivers/thunderbolt/ctl.c | 6 ++----
    > 1 file changed, 2 insertions(+), 4 deletions(-)
    >
    > diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
    > index 799634b..55b9bdf 100644
    > --- a/drivers/thunderbolt/ctl.c
    > +++ b/drivers/thunderbolt/ctl.c
    > @@ -520,10 +520,8 @@ err:
    > void tb_ctl_free(struct tb_ctl *ctl)
    > {
    > int i;
    > - if (ctl->rx)
    > - ring_free(ctl->rx);
    > - if (ctl->tx)
    > - ring_free(ctl->tx);
    > + ring_free(ctl->rx);
    > + ring_free(ctl->tx);
    >
    > /* free RX packets */
    > for (i = 0; i < TB_CTL_RX_PKG_COUNT; i++)
    > --
    > 2.1.3
    >


    \
     
     \ /
      Last update: 2014-11-21 13:01    [W:4.028 / U:4.700 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site