Skip to content

Commit

Permalink
gpio: zynq: Simplify with dev_err_probe()
Browse files Browse the repository at this point in the history
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
  • Loading branch information
Krzysztof Kozlowski authored and Bartosz Golaszewski committed Aug 28, 2020
1 parent 308a028 commit 805a6ef
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/gpio/gpio-zynq.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,11 +929,9 @@ static int zynq_gpio_probe(struct platform_device *pdev)

/* Retrieve GPIO clock */
gpio->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(gpio->clk)) {
if (PTR_ERR(gpio->clk) != -EPROBE_DEFER)
dev_err(&pdev->dev, "input clock not found.\n");
return PTR_ERR(gpio->clk);
}
if (IS_ERR(gpio->clk))
return dev_err_probe(&pdev->dev, PTR_ERR(gpio->clk), "input clock not found.\n");

ret = clk_prepare_enable(gpio->clk);
if (ret) {
dev_err(&pdev->dev, "Unable to enable clock.\n");
Expand Down

0 comments on commit 805a6ef

Please sign in to comment.