diff options
author | Simon Baatz <gmbnomis@gmail.com> | 2017-03-27 14:02:08 -0400 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@free-electrons.com> | 2017-03-29 11:05:37 -0400 |
commit | ef980cf8b05bc862f4533fcdeae2911e6ff7027a (patch) | |
tree | ca2930d38a4da7fcccd35f513ceb5011996a8919 | |
parent | 675b11d94ce9baa5eb365a51b35d2793f77c8ab8 (diff) |
mtd: nand: orion: improve handling of optional clock
The clock gate used by orion_nand is not available on all platforms.
When getting this optional clock gate, the code masked all errors.
Let's be more precise here and actually only allow ENOENT.
EPROBE_DEFER is handled like any other error code since probe deferral
is not supported by drivers using module_platform_driver_probe().
Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
-rw-r--r-- | drivers/mtd/nand/orion_nand.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c index 3acdc20485f1..f8e463a97b9e 100644 --- a/drivers/mtd/nand/orion_nand.c +++ b/drivers/mtd/nand/orion_nand.c | |||
@@ -156,8 +156,17 @@ static int __init orion_nand_probe(struct platform_device *pdev) | |||
156 | /* Not all platforms can gate the clock, so it is not | 156 | /* Not all platforms can gate the clock, so it is not |
157 | an error if the clock does not exists. */ | 157 | an error if the clock does not exists. */ |
158 | info->clk = devm_clk_get(&pdev->dev, NULL); | 158 | info->clk = devm_clk_get(&pdev->dev, NULL); |
159 | if (!IS_ERR(info->clk)) | 159 | if (IS_ERR(info->clk)) { |
160 | clk_prepare_enable(info->clk); | 160 | ret = PTR_ERR(info->clk); |
161 | if (ret == -ENOENT) { | ||
162 | info->clk = NULL; | ||
163 | } else { | ||
164 | dev_err(&pdev->dev, "failed to get clock!\n"); | ||
165 | return ret; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | clk_prepare_enable(info->clk); | ||
161 | 170 | ||
162 | ret = nand_scan(mtd, 1); | 171 | ret = nand_scan(mtd, 1); |
163 | if (ret) | 172 | if (ret) |
@@ -173,9 +182,7 @@ static int __init orion_nand_probe(struct platform_device *pdev) | |||
173 | return 0; | 182 | return 0; |
174 | 183 | ||
175 | no_dev: | 184 | no_dev: |
176 | if (!IS_ERR(info->clk)) | 185 | clk_disable_unprepare(info->clk); |
177 | clk_disable_unprepare(info->clk); | ||
178 | |||
179 | return ret; | 186 | return ret; |
180 | } | 187 | } |
181 | 188 | ||
@@ -187,8 +194,7 @@ static int orion_nand_remove(struct platform_device *pdev) | |||
187 | 194 | ||
188 | nand_release(mtd); | 195 | nand_release(mtd); |
189 | 196 | ||
190 | if (!IS_ERR(info->clk)) | 197 | clk_disable_unprepare(info->clk); |
191 | clk_disable_unprepare(info->clk); | ||
192 | 198 | ||
193 | return 0; | 199 | return 0; |
194 | } | 200 | } |