pwm: devm: alloc correct pointer size
authorWolfram Sang <wsa@the-dreams.de>
Mon, 3 Jun 2013 20:27:17 +0000 (22:27 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 10 Jun 2013 10:50:10 +0000 (12:50 +0200)
The allocated object should be the size of what the pointer is pointing
to and not the size of the pointer itself.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/core.c

index 32221cb0cbe713622c8773822fc1f6e5be91e49d..0cf0f65eb037ad20ad750dac4c5cbf0b1ab4f73c 100644 (file)
@@ -694,7 +694,7 @@ struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id)
 {
        struct pwm_device **ptr, *pwm;
 
-       ptr = devres_alloc(devm_pwm_release, sizeof(**ptr), GFP_KERNEL);
+       ptr = devres_alloc(devm_pwm_release, sizeof(*ptr), GFP_KERNEL);
        if (!ptr)
                return ERR_PTR(-ENOMEM);
 
@@ -724,7 +724,7 @@ struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np,
 {
        struct pwm_device **ptr, *pwm;
 
-       ptr = devres_alloc(devm_pwm_release, sizeof(**ptr), GFP_KERNEL);
+       ptr = devres_alloc(devm_pwm_release, sizeof(*ptr), GFP_KERNEL);
        if (!ptr)
                return ERR_PTR(-ENOMEM);