lkml.org 
[lkml]   [2015]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] configfs: Delete unnecessary checks before the function call "config_item_put"
    From: Markus Elfring <elfring@users.sourceforge.net>
    Date: Fri, 26 Jun 2015 15:20:43 +0200

    The config_item_put() 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>
    ---
    fs/configfs/file.c | 5 ++---
    fs/configfs/item.c | 3 +--
    2 files changed, 3 insertions(+), 5 deletions(-)

    diff --git a/fs/configfs/file.c b/fs/configfs/file.c
    index 403269f..c70997f 100644
    --- a/fs/configfs/file.c
    +++ b/fs/configfs/file.c
    @@ -274,7 +274,7 @@ static int check_perm(struct inode * inode, struct file * file)
    Enomem:
    module_put(attr->ca_owner);
    Done:
    - if (error && item)
    + if (error)
    config_item_put(item);
    return error;
    }
    @@ -291,8 +291,7 @@ static int configfs_release(struct inode * inode, struct file * filp)
    struct module * owner = attr->ca_owner;
    struct configfs_buffer * buffer = filp->private_data;

    - if (item)
    - config_item_put(item);
    + config_item_put(item);
    /* After this point, attr should not be accessed. */
    module_put(owner);

    diff --git a/fs/configfs/item.c b/fs/configfs/item.c
    index 4d6a30e..6173fa7 100644
    --- a/fs/configfs/item.c
    +++ b/fs/configfs/item.c
    @@ -152,8 +152,7 @@ static void config_item_cleanup(struct config_item *item)
    t->ct_item_ops->release(item);
    if (s)
    config_group_put(s);
    - if (parent)
    - config_item_put(parent);
    + config_item_put(parent);
    }

    static void config_item_release(struct kref *kref)
    --
    2.4.4


    \
     
     \ /
      Last update: 2015-06-26 15:41    [W:4.018 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site