Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

hwrng: imx-rngc - use devm_clk_get_enabled

Use the new devm_clk_get_enabled function to get our clock.

We don't have to disable and unprepare the clock ourselves any more in
error paths and in the remove function.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Martin Kaiser and committed by
Herbert Xu
6a2bc448 6363d81b

+6 -19
+6 -19
drivers/char/hw_random/imx-rngc.c
··· 245 245 if (IS_ERR(rngc->base)) 246 246 return PTR_ERR(rngc->base); 247 247 248 - rngc->clk = devm_clk_get(&pdev->dev, NULL); 248 + rngc->clk = devm_clk_get_enabled(&pdev->dev, NULL); 249 249 if (IS_ERR(rngc->clk)) { 250 250 dev_err(&pdev->dev, "Can not get rng_clk\n"); 251 251 return PTR_ERR(rngc->clk); ··· 255 255 if (irq < 0) 256 256 return irq; 257 257 258 - ret = clk_prepare_enable(rngc->clk); 259 - if (ret) 260 - return ret; 261 - 262 258 ver_id = readl(rngc->base + RNGC_VER_ID); 263 259 rng_type = ver_id >> RNGC_TYPE_SHIFT; 264 260 /* 265 261 * This driver supports only RNGC and RNGB. (There's a different 266 262 * driver for RNGA.) 267 263 */ 268 - if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB) { 269 - ret = -ENODEV; 270 - goto err; 271 - } 264 + if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB) 265 + return -ENODEV; 272 266 273 267 ret = devm_request_irq(&pdev->dev, 274 268 irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); 275 269 if (ret) { 276 270 dev_err(rngc->dev, "Can't get interrupt working.\n"); 277 - goto err; 271 + return ret; 278 272 } 279 273 280 274 init_completion(&rngc->rng_op_done); ··· 288 294 ret = imx_rngc_self_test(rngc); 289 295 if (ret) { 290 296 dev_err(rngc->dev, "self test failed\n"); 291 - goto err; 297 + return ret; 292 298 } 293 299 } 294 300 295 301 ret = hwrng_register(&rngc->rng); 296 302 if (ret) { 297 303 dev_err(&pdev->dev, "hwrng registration failed\n"); 298 - goto err; 304 + return ret; 299 305 } 300 306 301 307 dev_info(&pdev->dev, ··· 303 309 rng_type == RNGC_TYPE_RNGB ? 'B' : 'C', 304 310 (ver_id >> RNGC_VER_MAJ_SHIFT) & 0xff, ver_id & 0xff); 305 311 return 0; 306 - 307 - err: 308 - clk_disable_unprepare(rngc->clk); 309 - 310 - return ret; 311 312 } 312 313 313 314 static int __exit imx_rngc_remove(struct platform_device *pdev) ··· 310 321 struct imx_rngc *rngc = platform_get_drvdata(pdev); 311 322 312 323 hwrng_unregister(&rngc->rng); 313 - 314 - clk_disable_unprepare(rngc->clk); 315 324 316 325 return 0; 317 326 }