These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / devfreq / devfreq.c
index ca1b362..ca848cc 100644 (file)
@@ -53,7 +53,7 @@ static struct devfreq *find_device_devfreq(struct device *dev)
 {
        struct devfreq *tmp_devfreq;
 
-       if (unlikely(IS_ERR_OR_NULL(dev))) {
+       if (IS_ERR_OR_NULL(dev)) {
                pr_err("DEVFREQ: %s: Invalid parameters\n", __func__);
                return ERR_PTR(-EINVAL);
        }
@@ -133,7 +133,7 @@ static struct devfreq_governor *find_devfreq_governor(const char *name)
 {
        struct devfreq_governor *tmp_governor;
 
-       if (unlikely(IS_ERR_OR_NULL(name))) {
+       if (IS_ERR_OR_NULL(name)) {
                pr_err("DEVFREQ: %s: Invalid parameters\n", __func__);
                return ERR_PTR(-EINVAL);
        }
@@ -177,10 +177,10 @@ int update_devfreq(struct devfreq *devfreq)
                return err;
 
        /*
-        * Adjust the freuqency with user freq and QoS.
+        * Adjust the frequency with user freq and QoS.
         *
-        * List from the highest proiority
-        * max_freq (probably called by thermal when it's too hot)
+        * List from the highest priority
+        * max_freq
         * min_freq
         */
 
@@ -482,7 +482,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
                                                devfreq->profile->max_state *
                                                devfreq->profile->max_state,
                                                GFP_KERNEL);
-       devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned int) *
+       devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned long) *
                                                devfreq->profile->max_state,
                                                GFP_KERNEL);
        devfreq->last_stat_updated = jiffies;
@@ -492,7 +492,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
        if (err) {
                put_device(&devfreq->dev);
                mutex_unlock(&devfreq->lock);
-               goto err_dev;
+               goto err_out;
        }
 
        mutex_unlock(&devfreq->lock);
@@ -518,7 +518,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
 err_init:
        list_del(&devfreq->node);
        device_unregister(&devfreq->dev);
-err_dev:
        kfree(devfreq);
 err_out:
        return ERR_PTR(err);
@@ -795,8 +794,10 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
                ret = PTR_ERR(governor);
                goto out;
        }
-       if (df->governor == governor)
+       if (df->governor == governor) {
+               ret = 0;
                goto out;
+       }
 
        if (df->governor) {
                ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL);