diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2013-11-29 06:39:30 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-09 01:41:48 -0500 |
commit | 001d1953eae7089ab148ec32e13848be8d0b3874 (patch) | |
tree | e9cb147ddb2e2d06888271c85af2e30c0b43bde0 /drivers/w1 | |
parent | 71531f55a83dcb79b89287f6b11fb2e4eb496d4d (diff) |
w1: mxc_w1: Check the clk_prepare_enable() return value
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r-- | drivers/w1/masters/mxc_w1.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c index 953168c63392..1e5d94c5afc9 100644 --- a/drivers/w1/masters/mxc_w1.c +++ b/drivers/w1/masters/mxc_w1.c | |||
@@ -108,7 +108,7 @@ static int mxc_w1_probe(struct platform_device *pdev) | |||
108 | unsigned long clkrate; | 108 | unsigned long clkrate; |
109 | struct resource *res; | 109 | struct resource *res; |
110 | unsigned int clkdiv; | 110 | unsigned int clkdiv; |
111 | int err = 0; | 111 | int err; |
112 | 112 | ||
113 | mdev = devm_kzalloc(&pdev->dev, sizeof(struct mxc_w1_device), | 113 | mdev = devm_kzalloc(&pdev->dev, sizeof(struct mxc_w1_device), |
114 | GFP_KERNEL); | 114 | GFP_KERNEL); |
@@ -135,20 +135,23 @@ static int mxc_w1_probe(struct platform_device *pdev) | |||
135 | if (IS_ERR(mdev->regs)) | 135 | if (IS_ERR(mdev->regs)) |
136 | return PTR_ERR(mdev->regs); | 136 | return PTR_ERR(mdev->regs); |
137 | 137 | ||
138 | clk_prepare_enable(mdev->clk); | 138 | err = clk_prepare_enable(mdev->clk); |
139 | if (err) | ||
140 | return err; | ||
141 | |||
139 | __raw_writeb(clkdiv - 1, mdev->regs + MXC_W1_TIME_DIVIDER); | 142 | __raw_writeb(clkdiv - 1, mdev->regs + MXC_W1_TIME_DIVIDER); |
140 | 143 | ||
141 | mdev->bus_master.data = mdev; | 144 | mdev->bus_master.data = mdev; |
142 | mdev->bus_master.reset_bus = mxc_w1_ds2_reset_bus; | 145 | mdev->bus_master.reset_bus = mxc_w1_ds2_reset_bus; |
143 | mdev->bus_master.touch_bit = mxc_w1_ds2_touch_bit; | 146 | mdev->bus_master.touch_bit = mxc_w1_ds2_touch_bit; |
144 | 147 | ||
145 | err = w1_add_master_device(&mdev->bus_master); | 148 | platform_set_drvdata(pdev, mdev); |
146 | 149 | ||
150 | err = w1_add_master_device(&mdev->bus_master); | ||
147 | if (err) | 151 | if (err) |
148 | return err; | 152 | clk_disable_unprepare(mdev->clk); |
149 | 153 | ||
150 | platform_set_drvdata(pdev, mdev); | 154 | return err; |
151 | return 0; | ||
152 | } | 155 | } |
153 | 156 | ||
154 | /* | 157 | /* |