Commit aab0a39b authored by Cyrille Pitchen's avatar Cyrille Pitchen Committed by Herbert Xu

crypto: atmel-aes - propagate error from atmel_aes_hw_version_init()

Before this patch atmel_aes_hw_version_init() had no returned value.
However it calls atmel_aes_hw_init(), which may fail. So check the
returned code of atmel_aes_hw_init() and propagate error if needed.
Signed-off-by: default avatarCyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 7f1cbbc5
...@@ -280,16 +280,20 @@ static inline unsigned int atmel_aes_get_version(struct atmel_aes_dev *dd) ...@@ -280,16 +280,20 @@ static inline unsigned int atmel_aes_get_version(struct atmel_aes_dev *dd)
return atmel_aes_read(dd, AES_HW_VERSION) & 0x00000fff; return atmel_aes_read(dd, AES_HW_VERSION) & 0x00000fff;
} }
static void atmel_aes_hw_version_init(struct atmel_aes_dev *dd) static int atmel_aes_hw_version_init(struct atmel_aes_dev *dd)
{ {
atmel_aes_hw_init(dd); int err;
err = atmel_aes_hw_init(dd);
if (err)
return err;
dd->hw_version = atmel_aes_get_version(dd); dd->hw_version = atmel_aes_get_version(dd);
dev_info(dd->dev, dev_info(dd->dev, "version: 0x%x\n", dd->hw_version);
"version: 0x%x\n", dd->hw_version);
clk_disable_unprepare(dd->iclk); clk_disable_unprepare(dd->iclk);
return 0;
} }
static void atmel_aes_finish_req(struct atmel_aes_dev *dd, int err) static void atmel_aes_finish_req(struct atmel_aes_dev *dd, int err)
...@@ -1407,7 +1411,9 @@ static int atmel_aes_probe(struct platform_device *pdev) ...@@ -1407,7 +1411,9 @@ static int atmel_aes_probe(struct platform_device *pdev)
goto res_err; goto res_err;
} }
atmel_aes_hw_version_init(aes_dd); err = atmel_aes_hw_version_init(aes_dd);
if (err)
goto res_err;
atmel_aes_get_cap(aes_dd); atmel_aes_get_cap(aes_dd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment