Skip to content

Commit

Permalink
drivers/base/core.c: Remove two unused variables and two useless call…
Browse files Browse the repository at this point in the history
…s to kfree

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>
  • Loading branch information
Peter Senna Tschudin authored and Greg Kroah-Hartman committed Jan 17, 2013
1 parent 6b8fbde commit 1a5d76d
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1a5d76d

Please sign in to comment.