Commit 0efe58f3 authored by Tudor Ambarus's avatar Tudor Ambarus Committed by Herbert Xu

crypto: atmel-{sha,tdes} - Propagate error from _hw_version_init()

atmel_{sha,tdes}_hw_version_init() calls atmel_{sha,tdes}_hw_init(),
which may fail. Check the return code of atmel_{sha,tdes}_hw_init()
and propagate the error if needed.
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent fb24307a
...@@ -1038,9 +1038,13 @@ static inline unsigned int atmel_sha_get_version(struct atmel_sha_dev *dd) ...@@ -1038,9 +1038,13 @@ static inline unsigned int atmel_sha_get_version(struct atmel_sha_dev *dd)
return atmel_sha_read(dd, SHA_HW_VERSION) & 0x00000fff; return atmel_sha_read(dd, SHA_HW_VERSION) & 0x00000fff;
} }
static void atmel_sha_hw_version_init(struct atmel_sha_dev *dd) static int atmel_sha_hw_version_init(struct atmel_sha_dev *dd)
{ {
atmel_sha_hw_init(dd); int err;
err = atmel_sha_hw_init(dd);
if (err)
return err;
dd->hw_version = atmel_sha_get_version(dd); dd->hw_version = atmel_sha_get_version(dd);
...@@ -1048,6 +1052,8 @@ static void atmel_sha_hw_version_init(struct atmel_sha_dev *dd) ...@@ -1048,6 +1052,8 @@ static void atmel_sha_hw_version_init(struct atmel_sha_dev *dd)
"version: 0x%x\n", dd->hw_version); "version: 0x%x\n", dd->hw_version);
clk_disable(dd->iclk); clk_disable(dd->iclk);
return 0;
} }
static int atmel_sha_handle_queue(struct atmel_sha_dev *dd, static int atmel_sha_handle_queue(struct atmel_sha_dev *dd,
...@@ -2789,7 +2795,9 @@ static int atmel_sha_probe(struct platform_device *pdev) ...@@ -2789,7 +2795,9 @@ static int atmel_sha_probe(struct platform_device *pdev)
if (err) if (err)
goto res_err; goto res_err;
atmel_sha_hw_version_init(sha_dd); err = atmel_sha_hw_version_init(sha_dd);
if (err)
goto iclk_unprepare;
atmel_sha_get_cap(sha_dd); atmel_sha_get_cap(sha_dd);
......
...@@ -236,9 +236,13 @@ static inline unsigned int atmel_tdes_get_version(struct atmel_tdes_dev *dd) ...@@ -236,9 +236,13 @@ static inline unsigned int atmel_tdes_get_version(struct atmel_tdes_dev *dd)
return atmel_tdes_read(dd, TDES_HW_VERSION) & 0x00000fff; return atmel_tdes_read(dd, TDES_HW_VERSION) & 0x00000fff;
} }
static void atmel_tdes_hw_version_init(struct atmel_tdes_dev *dd) static int atmel_tdes_hw_version_init(struct atmel_tdes_dev *dd)
{ {
atmel_tdes_hw_init(dd); int err;
err = atmel_tdes_hw_init(dd);
if (err)
return err;
dd->hw_version = atmel_tdes_get_version(dd); dd->hw_version = atmel_tdes_get_version(dd);
...@@ -246,6 +250,8 @@ static void atmel_tdes_hw_version_init(struct atmel_tdes_dev *dd) ...@@ -246,6 +250,8 @@ static void atmel_tdes_hw_version_init(struct atmel_tdes_dev *dd)
"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_tdes_dma_callback(void *data) static void atmel_tdes_dma_callback(void *data)
...@@ -1291,7 +1297,9 @@ static int atmel_tdes_probe(struct platform_device *pdev) ...@@ -1291,7 +1297,9 @@ static int atmel_tdes_probe(struct platform_device *pdev)
goto res_err; goto res_err;
} }
atmel_tdes_hw_version_init(tdes_dd); err = atmel_tdes_hw_version_init(tdes_dd);
if (err)
goto res_err;
atmel_tdes_get_cap(tdes_dd); atmel_tdes_get_cap(tdes_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