]> Pileus Git - ~andy/linux/commitdiff
drivers/base/core.c: Remove two unused variables and two useless calls to kfree
authorPeter Senna Tschudin <peter.senna@gmail.com>
Sat, 8 Dec 2012 17:38:06 +0000 (15:38 -0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jan 2013 20:57:06 +0000 (12:57 -0800)
old_class_name, and new_class_name are never used. This patch remove the
declaration and calls to kfree.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r1 forall@
type T; identifier i;
@@
* T *i = NULL;
  ... when != i
* kfree(i);
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c

index a235085e343c47ca2b643f876c31ab70032359b5..27603a6c0a93ea63fc40f640c8b892fb5e0c618c 100644 (file)
@@ -1685,8 +1685,6 @@ EXPORT_SYMBOL_GPL(device_destroy);
  */
 int device_rename(struct device *dev, const char *new_name)
 {
-       char *old_class_name = NULL;
-       char *new_class_name = NULL;
        char *old_device_name = NULL;
        int error;
 
@@ -1717,8 +1715,6 @@ int device_rename(struct device *dev, const char *new_name)
 out:
        put_device(dev);
 
-       kfree(new_class_name);
-       kfree(old_class_name);
        kfree(old_device_name);
 
        return error;