devres: fix devres_get()
Currently, devres_get() passes devres_free() the pointer to devres,
but devres_free() should be given with the pointer to resource data.
Fixes: 9ac7849e35
("devres: device resource management")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: stable <stable@vger.kernel.org> # 2.6.21+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
cbfe8fa6cd
commit
64526370d1
|
@ -297,10 +297,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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue