From: Masahiro Yamada Date: Wed, 15 Jul 2015 01:29:00 +0000 (+0900) Subject: devres: fix devres_get() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=64526370d11ce8868ca495723d595b61e8697fbf;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: 9ac7849e35f7 ("devres: device resource management") Signed-off-by: Masahiro Yamada Acked-by: Tejun Heo Cc: stable # 2.6.21+ Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/base/devres.c b/drivers/base/devres.c index c8a53d1e019f..875464690117 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c @@ -297,10 +297,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; }