Skip to content

Commit

Permalink
devres: fix devres_get()
Browse files Browse the repository at this point in the history
commit 6452637 upstream.

Currently, devres_get() passes devres_free() the pointer to devres,
but devres_free() should be given with the pointer to resource data.

Fixes: 9ac7849 ("devres: device resource management")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Masahiro Yamada authored and Greg Kroah-Hartman committed Sep 21, 2015
1 parent 0bd183d commit db4d799
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/base/devres.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ void * devres_get(struct device *dev, void *new_res,
if (!dr) {
add_dr(dev, &new_dr->node);
dr = new_dr;
new_dr = NULL;
new_res = NULL;
}
spin_unlock_irqrestore(&dev->devres_lock, flags);
devres_free(new_dr);
devres_free(new_res);

return dr->data;
}
Expand Down

0 comments on commit db4d799

Please sign in to comment.