Commit 9bc0d009 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Willy Tarreau

devres: fix devres_get()

commit 64526370 upstream.

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

Fixes: 9ac7849e ("devres: device resource management")
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
(cherry picked from commit ebc0ae5a)
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent 8c367f5c
...@@ -253,10 +253,10 @@ void * devres_get(struct device *dev, void *new_res, ...@@ -253,10 +253,10 @@ void * devres_get(struct device *dev, void *new_res,
if (!dr) { if (!dr) {
add_dr(dev, &new_dr->node); add_dr(dev, &new_dr->node);
dr = new_dr; dr = new_dr;
new_dr = NULL; new_res = NULL;
} }
spin_unlock_irqrestore(&dev->devres_lock, flags); spin_unlock_irqrestore(&dev->devres_lock, flags);
devres_free(new_dr); devres_free(new_res);
return dr->data; return dr->data;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment