diff options
author | Mark A. Greer <mgreer@animalcreek.com> | 2013-11-12 15:12:27 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-12-05 08:28:40 -0500 |
commit | f13ab86a6123cc85c072253769fcaac72949ae93 (patch) | |
tree | 3a896286d5dd810755b2534ae40c21566f080a22 | |
parent | f4875e12f3ddafef844e21321efc7fae03454387 (diff) |
crypto: omap-sham - Only release DMA channel if successfully requested
In omap_sham_probe() and omap_sham_remove(), 'dd->dma_lch'
is released without checking to see if it was successfully
requested or not. This is a bug and was identified and
reported by Dan Carpenter here:
http://www.spinics.net/lists/devicetree/msg11023.html
Add code to only release 'dd->dma_lch' when its not NULL
(that is, when it was successfully requested).
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
CC: Joel Fernandes <joelf@ti.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/crypto/omap-sham.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index e45aaaf0db30..831f9a438b03 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c | |||
@@ -1970,7 +1970,8 @@ err_algs: | |||
1970 | crypto_unregister_ahash( | 1970 | crypto_unregister_ahash( |
1971 | &dd->pdata->algs_info[i].algs_list[j]); | 1971 | &dd->pdata->algs_info[i].algs_list[j]); |
1972 | pm_runtime_disable(dev); | 1972 | pm_runtime_disable(dev); |
1973 | dma_release_channel(dd->dma_lch); | 1973 | if (dd->dma_lch) |
1974 | dma_release_channel(dd->dma_lch); | ||
1974 | data_err: | 1975 | data_err: |
1975 | dev_err(dev, "initialization failed.\n"); | 1976 | dev_err(dev, "initialization failed.\n"); |
1976 | 1977 | ||
@@ -1994,7 +1995,9 @@ static int omap_sham_remove(struct platform_device *pdev) | |||
1994 | &dd->pdata->algs_info[i].algs_list[j]); | 1995 | &dd->pdata->algs_info[i].algs_list[j]); |
1995 | tasklet_kill(&dd->done_task); | 1996 | tasklet_kill(&dd->done_task); |
1996 | pm_runtime_disable(&pdev->dev); | 1997 | pm_runtime_disable(&pdev->dev); |
1997 | dma_release_channel(dd->dma_lch); | 1998 | |
1999 | if (dd->dma_lch) | ||
2000 | dma_release_channel(dd->dma_lch); | ||
1998 | 2001 | ||
1999 | return 0; | 2002 | return 0; |
2000 | } | 2003 | } |