From: Alexandru Ardelean <alexandru.ardelean@analog.com>
To: <linux-kernel@vger.kernel.org>
Cc: <gregkh@linuxfoundation.org>,
Alexandru Ardelean <alexandru.ardelean@analog.com>
Subject: [PATCH v2] uio: pruss: use devm_clk_get() for clk init
Date: Thu, 19 Nov 2020 16:50:59 +0200 [thread overview]
Message-ID: <20201119145059.48326-1-alexandru.ardelean@analog.com> (raw)
In-Reply-To: <20201111112242.62116-2-alexandru.ardelean@analog.com>
This change uses devm_clk_get() to obtain a reference to the clock. It has
the benefit that clk_put() is no longer required, and cleans up the exit &
error path.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
Changelog v1 -> v2:
* reverted silly/goofed `return ret` to `return PTR_ERR(gdev->pruss_clk);`
this caused a warning about `ret` being uninitialized
drivers/uio/uio_pruss.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c
index 41470c4dba02..e9096f53b4cc 100644
--- a/drivers/uio/uio_pruss.c
+++ b/drivers/uio/uio_pruss.c
@@ -110,7 +110,6 @@ static void pruss_cleanup(struct device *dev, struct uio_pruss_dev *gdev)
gdev->sram_vaddr,
sram_pool_sz);
clk_disable(gdev->pruss_clk);
- clk_put(gdev->pruss_clk);
}
static int pruss_probe(struct platform_device *pdev)
@@ -131,7 +130,7 @@ static int pruss_probe(struct platform_device *pdev)
return -ENOMEM;
/* Power on PRU in case its not done as part of boot-loader */
- gdev->pruss_clk = clk_get(dev, "pruss");
+ gdev->pruss_clk = devm_clk_get(dev, "pruss");
if (IS_ERR(gdev->pruss_clk)) {
dev_err(dev, "Failed to get clock\n");
return PTR_ERR(gdev->pruss_clk);
@@ -140,7 +139,7 @@ static int pruss_probe(struct platform_device *pdev)
ret = clk_enable(gdev->pruss_clk);
if (ret) {
dev_err(dev, "Failed to enable clock\n");
- goto err_clk_put;
+ return ret;
}
regs_prussio = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -229,8 +228,6 @@ static int pruss_probe(struct platform_device *pdev)
gen_pool_free(gdev->sram_pool, gdev->sram_vaddr, sram_pool_sz);
err_clk_disable:
clk_disable(gdev->pruss_clk);
-err_clk_put:
- clk_put(gdev->pruss_clk);
return ret;
}
--
2.17.1
prev parent reply other threads:[~2020-11-19 14:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 11:22 [PATCH 1/2] uio: pruss: move simple allocations to dem_ equivalents Alexandru Ardelean
2020-11-11 11:22 ` [PATCH 2/2] uio: pruss: use devm_clk_get() for clk init Alexandru Ardelean
2020-11-13 14:17 ` kernel test robot
2020-11-19 14:50 ` Alexandru Ardelean [this message]
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=20201119145059.48326-1-alexandru.ardelean@analog.com \
--to=alexandru.ardelean@analog.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).