patch "w1: mxc_w1: Enable clock before calling clk_get_rate() on it" added to char-misc-testing
Subsystems (3)
This is a note to let you know that I've just added the patch titled
w1: mxc_w1: Enable clock before calling clk_get_rate() on it
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-testing branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will be merged to the char-misc-next branch sometime soon, after it passes testing, and the merge window is open.
If you have any questions about this process, please let me know.
Quoted 1 line
From
955bc61328dc0a297fb3baccd84e9d3aee501ed8Mon Sep 17 00:00:00 2001
From: Stefan Potyra <[email protected]>
Date: Wed, 2 May 2018 10:55:31 +0200
Subject: w1: mxc_w1: Enable clock before calling clk_get_rate() on it
According to the API, you may only call clk_get_rate() after actually enabling it.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/w1/masters/mxc_w1.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/w1/masters/mxc_w1.c +13 -7
@@ -112,6 +112,10 @@ static int mxc_w1_probe(struct platform_device *pdev)if (IS_ERR (mdev->clk))return PTR_ERR (mdev->clk); + err =clk_prepare_enable (mdev->clk); +if (err) +return err; + clkrate =clk_get_rate (mdev->clk);if (clkrate <10000000 ) dev_warn(&pdev->dev,
@@ -125,12 +129,10 @@ static int mxc_w1_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); mdev->regs =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (mdev->regs)) -return PTR_ERR (mdev->regs); - - err =clk_prepare_enable (mdev->clk); -if (err) -return err; +if (IS_ERR (mdev->regs)) { + err =PTR_ERR (mdev->regs); + goto out_disable_clk; + }/* Software reset 1-Wire module */ writeb (MXC_W1_RESET_RST , mdev->regs +MXC_W1_RESET );
@@ -146,8 +148,12 @@ static int mxc_w1_probe(struct platform_device *pdev) err =w1_add_master_device (&mdev->bus_master);if (err) -clk_disable_unprepare (mdev->clk); + goto out_disable_clk; +return 0 ; + +out_disable_clk: +clk_disable_unprepare (mdev->clk);return err; }
Signature · 1 line
2.17.0