ARM: OMAP: use consistent error checking
[deliverable/linux.git] / arch / arm / plat-omap / dmtimer.c
index d51b75bdcad4d6eb916dccfdc0dd7418ca7ed439..5679ec41928b34d78d9d63d42b18bfeecbe5df99 100644 (file)
@@ -140,8 +140,7 @@ static int omap_dm_timer_prepare(struct omap_dm_timer *timer)
         */
        if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
                timer->fclk = clk_get(&timer->pdev->dev, "fck");
-               if (WARN_ON_ONCE(IS_ERR_OR_NULL(timer->fclk))) {
-                       timer->fclk = NULL;
+               if (WARN_ON_ONCE(IS_ERR(timer->fclk))) {
                        dev_err(&timer->pdev->dev, ": No fclk handle.\n");
                        return -EINVAL;
                }
@@ -373,7 +372,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
 
 struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
 {
-       if (timer)
+       if (timer && !IS_ERR(timer->fclk))
                return timer->fclk;
        return NULL;
 }
@@ -482,7 +481,7 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
        if (pdata && pdata->set_timer_src)
                return pdata->set_timer_src(timer->pdev, source);
 
-       if (!timer->fclk)
+       if (IS_ERR(timer->fclk))
                return -EINVAL;
 
        switch (source) {
@@ -500,13 +499,13 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
        }
 
        parent = clk_get(&timer->pdev->dev, parent_name);
-       if (IS_ERR_OR_NULL(parent)) {
+       if (IS_ERR(parent)) {
                pr_err("%s: %s not found\n", __func__, parent_name);
                return -EINVAL;
        }
 
        ret = clk_set_parent(timer->fclk, parent);
-       if (IS_ERR_VALUE(ret))
+       if (ret < 0)
                pr_err("%s: failed to set %s as parent\n", __func__,
                        parent_name);
 
@@ -777,7 +776,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timers_active);
  * Called by driver framework at the end of device registration for all
  * timer devices.
  */
-static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
+static int omap_dm_timer_probe(struct platform_device *pdev)
 {
        unsigned long flags;
        struct omap_dm_timer *timer;
@@ -808,6 +807,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
                return  -ENOMEM;
        }
 
+       timer->fclk = ERR_PTR(-ENODEV);
        timer->io_base = devm_request_and_ioremap(dev, mem);
        if (!timer->io_base) {
                dev_err(dev, "%s: region already claimed.\n", __func__);
@@ -864,7 +864,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
  * In addition to freeing platform resources it also deletes the timer
  * entry from the local list.
  */
-static int __devexit omap_dm_timer_remove(struct platform_device *pdev)
+static int omap_dm_timer_remove(struct platform_device *pdev)
 {
        struct omap_dm_timer *timer;
        unsigned long flags;
@@ -891,7 +891,7 @@ MODULE_DEVICE_TABLE(of, omap_timer_match);
 
 static struct platform_driver omap_dm_timer_driver = {
        .probe  = omap_dm_timer_probe,
-       .remove = __devexit_p(omap_dm_timer_remove),
+       .remove = omap_dm_timer_remove,
        .driver = {
                .name   = "omap_timer",
                .of_match_table = of_match_ptr(omap_timer_match),
This page took 0.025949 seconds and 5 git commands to generate.