From: Rosen Penev <rosenp@gmail.com>
To: linux-gpio@vger.kernel.org
Cc: Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
Ralph Sennhauser <ralph.sennhauser@gmail.com>,
Rob Herring <robh@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCHv2] gpio: mvebu: use devm_clk_get_optional_enabled()
Date: Wed, 8 Jul 2026 15:48:22 -0700 [thread overview]
Message-ID: <20260708224822.960617-1-rosenp@gmail.com> (raw)
The clock is obtained without doing any sort of cleanup on remove or
anywhere else. Use the proper function to handle this. When it fails
with -EPROBE_DEFER for example, return so that it can be handled. When
the clock is not found, it's NULL and not a PTR_ERR. Handle that as
well.
Fixes: 757642f9a584e ("gpio: mvebu: Add limited PWM support")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
v2: return -ENOENT as before.
drivers/gpio/gpio-mvebu.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 8d3acadb0d68..a863b0bf46ff 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -833,8 +833,8 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
offset = 0;
}
- if (IS_ERR(mvchip->clk))
- return PTR_ERR(mvchip->clk);
+ if (!mvchip->clk)
+ return -ENOENT;
chip = devm_pwmchip_alloc(dev, mvchip->chip.ngpio, sizeof(*mvpwm));
if (IS_ERR(chip))
@@ -1182,10 +1182,10 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
return id;
}
- mvchip->clk = devm_clk_get(&pdev->dev, NULL);
/* Not all SoCs require a clock.*/
- if (!IS_ERR(mvchip->clk))
- clk_prepare_enable(mvchip->clk);
+ mvchip->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
+ if (IS_ERR(mvchip->clk))
+ return PTR_ERR(mvchip->clk);
mvchip->soc_variant = soc_variant;
mvchip->chip.label = dev_name(&pdev->dev);
--
2.55.0
next reply other threads:[~2026-07-08 22:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 22:48 Rosen Penev [this message]
2026-07-08 23:38 ` Andrew Lunn
2026-07-09 0:34 ` Rosen Penev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260708224822.960617-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=andrew@lunn.ch \
--cc=brgl@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ralph.sennhauser@gmail.com \
--cc=robh@kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox