mtd: nand: orion: fix clk handling
authorSimon Baatz <gmbnomis@gmail.com>
Mon, 27 Mar 2017 18:02:07 +0000 (20:02 +0200)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Wed, 29 Mar 2017 15:05:34 +0000 (17:05 +0200)
commit675b11d94ce9baa5eb365a51b35d2793f77c8ab8
tree0d880e4b1591a333d4c923bc3c2dd7b63a4be891
parente713ddd87ccee801be1fd13f478407b1bde93c21
mtd: nand: orion: fix clk handling

The clk handling in orion_nand.c had two problems:

- In the probe function, clk_put() was called for an enabled clock,
  which violates the API (see documentation for clk_put() in
  include/linux/clk.h)

- In the error path of the probe function, clk_put() could be called
  twice for the same clock.

In order to clean this up, use the managed function devm_clk_get() and
store the pointer to the clk in the driver data.

Fixes: baffab28b13120694fa3ebab08d3e99667a851d2 ('ARM: Orion: fix driver probe error handling with respect to clk')
Cc: <stable@vger.kernel.org> # v4.5+
Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/orion_nand.c