pwm: sti: Avoid conditional gotos
[linux-2.6-microblaze.git] / drivers / pwm / pwm-imx1.c
index f8b2c2e..727e0d3 100644 (file)
@@ -136,7 +136,6 @@ MODULE_DEVICE_TABLE(of, pwm_imx1_dt_ids);
 static int pwm_imx1_probe(struct platform_device *pdev)
 {
        struct pwm_imx1_chip *imx;
-       struct resource *r;
 
        imx = devm_kzalloc(&pdev->dev, sizeof(*imx), GFP_KERNEL);
        if (!imx)
@@ -145,31 +144,21 @@ static int pwm_imx1_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, imx);
 
        imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
-       if (IS_ERR(imx->clk_ipg)) {
-               dev_err(&pdev->dev, "getting ipg clock failed with %ld\n",
-                               PTR_ERR(imx->clk_ipg));
-               return PTR_ERR(imx->clk_ipg);
-       }
+       if (IS_ERR(imx->clk_ipg))
+               return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_ipg),
+                                    "getting ipg clock failed\n");
 
        imx->clk_per = devm_clk_get(&pdev->dev, "per");
-       if (IS_ERR(imx->clk_per)) {
-               int ret = PTR_ERR(imx->clk_per);
-
-               if (ret != -EPROBE_DEFER)
-                       dev_err(&pdev->dev,
-                               "failed to get peripheral clock: %d\n",
-                               ret);
-
-               return ret;
-       }
+       if (IS_ERR(imx->clk_per))
+               return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_per),
+                                    "failed to get peripheral clock\n");
 
        imx->chip.ops = &pwm_imx1_ops;
        imx->chip.dev = &pdev->dev;
        imx->chip.base = -1;
        imx->chip.npwm = 1;
 
-       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       imx->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+       imx->mmio_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(imx->mmio_base))
                return PTR_ERR(imx->mmio_base);