OMAP: PM: SmartReflex: Fix possible null pointer read access
[pandora-kernel.git] / arch / arm / mach-omap2 / smartreflex.c
index 77ecebf..c37e823 100644 (file)
@@ -780,8 +780,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val)
        struct omap_sr *sr_info = (struct omap_sr *) data;
 
        if (!sr_info) {
-               pr_warning("%s: omap_sr struct for sr_%s not found\n",
-                       __func__, sr_info->voltdm->name);
+               pr_warning("%s: omap_sr struct not found\n", __func__);
                return -EINVAL;
        }
 
@@ -795,8 +794,7 @@ static int omap_sr_autocomp_store(void *data, u64 val)
        struct omap_sr *sr_info = (struct omap_sr *) data;
 
        if (!sr_info) {
-               pr_warning("%s: omap_sr struct for sr_%s not found\n",
-                       __func__, sr_info->voltdm->name);
+               pr_warning("%s: omap_sr struct not found\n", __func__);
                return -EINVAL;
        }
 
@@ -834,7 +832,8 @@ static int __init omap_sr_probe(struct platform_device *pdev)
 
        if (!pdata) {
                dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto err_free_devinfo;
        }
 
        mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -966,7 +965,7 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
        }
 
        sr_info = _sr_lookup(pdata->voltdm);
-       if (!sr_info) {
+       if (IS_ERR(sr_info)) {
                dev_warn(&pdev->dev, "%s: omap_sr struct not found\n",
                        __func__);
                return -EINVAL;