From: Martin Blumenstingl Date: Wed, 12 Jun 2019 19:58:59 +0000 (+0200) Subject: pwm: meson: Use devm_clk_get_optional() to get the input clock X-Git-Tag: v5.15~6030^2~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba4004c715c906474ae84f1f9a97f55d3259c6bd;p=platform%2Fkernel%2Flinux-starfive.git pwm: meson: Use devm_clk_get_optional() to get the input clock Simplify the code which fetches the input clock for a PWM channel by using devm_clk_get_optional(). This comes with a small functional change: previously all errors except EPROBE_DEFER were ignored. Now all other errors are also treated as errors. If no input clock is present devm_clk_get_optional() will return NULL instead of an error which matches the behavior of the old code. Reviewed-by: Neil Armstrong Reviewed-by: Uwe Kleine-König Signed-off-by: Martin Blumenstingl Signed-off-by: Thierry Reding --- diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 1e54468..8b277a2 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -483,14 +483,9 @@ static int meson_pwm_init_channels(struct meson_pwm *meson, snprintf(name, sizeof(name), "clkin%u", i); - channel->clk_parent = devm_clk_get(dev, name); - if (IS_ERR(channel->clk_parent)) { - err = PTR_ERR(channel->clk_parent); - if (err == -EPROBE_DEFER) - return err; - - channel->clk_parent = NULL; - } + channel->clk_parent = devm_clk_get_optional(dev, name); + if (IS_ERR(channel->clk_parent)) + return PTR_ERR(channel->clk_parent); } return 0;