Commit b1b4416f authored by Christoph Manszewski's avatar Christoph Manszewski Committed by Herbert Xu

crypto: s5p-sss: Minor code cleanup

Modifications in s5p-sss.c:
- remove unnecessary 'goto' statements (making code shorter),
- change uint_8 and uint_32 to u8 and u32 types (for consistency in the
driver and making code shorter),
Signed-off-by: default avatarChristoph Manszewski <c.manszewski@samsung.com>
Reviewed-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Acked-by: default avatarKamil Konieczny <k.konieczny@partner.samsung.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 6c12b6ba
...@@ -249,8 +249,8 @@ struct s5p_aes_reqctx { ...@@ -249,8 +249,8 @@ struct s5p_aes_reqctx {
struct s5p_aes_ctx { struct s5p_aes_ctx {
struct s5p_aes_dev *dev; struct s5p_aes_dev *dev;
uint8_t aes_key[AES_MAX_KEY_SIZE]; u8 aes_key[AES_MAX_KEY_SIZE];
uint8_t nonce[CTR_RFC3686_NONCE_SIZE]; u8 nonce[CTR_RFC3686_NONCE_SIZE];
int keylen; int keylen;
}; };
...@@ -518,46 +518,28 @@ static int s5p_make_sg_cpy(struct s5p_aes_dev *dev, struct scatterlist *src, ...@@ -518,46 +518,28 @@ static int s5p_make_sg_cpy(struct s5p_aes_dev *dev, struct scatterlist *src,
static int s5p_set_outdata(struct s5p_aes_dev *dev, struct scatterlist *sg) static int s5p_set_outdata(struct s5p_aes_dev *dev, struct scatterlist *sg)
{ {
int err; if (!sg->length)
return -EINVAL;
if (!sg->length) {
err = -EINVAL;
goto exit;
}
err = dma_map_sg(dev->dev, sg, 1, DMA_FROM_DEVICE); if (!dma_map_sg(dev->dev, sg, 1, DMA_FROM_DEVICE))
if (!err) { return -ENOMEM;
err = -ENOMEM;
goto exit;
}
dev->sg_dst = sg; dev->sg_dst = sg;
err = 0;
exit: return 0;
return err;
} }
static int s5p_set_indata(struct s5p_aes_dev *dev, struct scatterlist *sg) static int s5p_set_indata(struct s5p_aes_dev *dev, struct scatterlist *sg)
{ {
int err; if (!sg->length)
return -EINVAL;
if (!sg->length) {
err = -EINVAL;
goto exit;
}
err = dma_map_sg(dev->dev, sg, 1, DMA_TO_DEVICE); if (!dma_map_sg(dev->dev, sg, 1, DMA_TO_DEVICE))
if (!err) { return -ENOMEM;
err = -ENOMEM;
goto exit;
}
dev->sg_src = sg; dev->sg_src = sg;
err = 0;
exit: return 0;
return err;
} }
/* /*
...@@ -662,8 +644,7 @@ static irqreturn_t s5p_aes_interrupt(int irq, void *dev_id) ...@@ -662,8 +644,7 @@ static irqreturn_t s5p_aes_interrupt(int irq, void *dev_id)
bool tx_end = false; bool tx_end = false;
bool hx_end = false; bool hx_end = false;
unsigned long flags; unsigned long flags;
uint32_t status; u32 status, st_bits;
u32 st_bits;
int err; int err;
spin_lock_irqsave(&dev->lock, flags); spin_lock_irqsave(&dev->lock, flags);
...@@ -1832,7 +1813,7 @@ static struct ahash_alg algs_sha1_md5_sha256[] = { ...@@ -1832,7 +1813,7 @@ static struct ahash_alg algs_sha1_md5_sha256[] = {
}; };
static void s5p_set_aes(struct s5p_aes_dev *dev, static void s5p_set_aes(struct s5p_aes_dev *dev,
const uint8_t *key, const uint8_t *iv, const u8 *key, const u8 *iv,
unsigned int keylen) unsigned int keylen)
{ {
void __iomem *keystart; void __iomem *keystart;
...@@ -1918,7 +1899,7 @@ static int s5p_set_outdata_start(struct s5p_aes_dev *dev, ...@@ -1918,7 +1899,7 @@ static int s5p_set_outdata_start(struct s5p_aes_dev *dev,
static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode) static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode)
{ {
struct ablkcipher_request *req = dev->req; struct ablkcipher_request *req = dev->req;
uint32_t aes_control; u32 aes_control;
unsigned long flags; unsigned long flags;
int err; int err;
u8 *iv; u8 *iv;
...@@ -2026,7 +2007,7 @@ static int s5p_aes_handle_req(struct s5p_aes_dev *dev, ...@@ -2026,7 +2007,7 @@ static int s5p_aes_handle_req(struct s5p_aes_dev *dev,
err = ablkcipher_enqueue_request(&dev->queue, req); err = ablkcipher_enqueue_request(&dev->queue, req);
if (dev->busy) { if (dev->busy) {
spin_unlock_irqrestore(&dev->lock, flags); spin_unlock_irqrestore(&dev->lock, flags);
goto exit; return err;
} }
dev->busy = true; dev->busy = true;
...@@ -2034,7 +2015,6 @@ static int s5p_aes_handle_req(struct s5p_aes_dev *dev, ...@@ -2034,7 +2015,6 @@ static int s5p_aes_handle_req(struct s5p_aes_dev *dev,
tasklet_schedule(&dev->tasklet); tasklet_schedule(&dev->tasklet);
exit:
return err; return err;
} }
...@@ -2056,7 +2036,7 @@ static int s5p_aes_crypt(struct ablkcipher_request *req, unsigned long mode) ...@@ -2056,7 +2036,7 @@ static int s5p_aes_crypt(struct ablkcipher_request *req, unsigned long mode)
} }
static int s5p_aes_setkey(struct crypto_ablkcipher *cipher, static int s5p_aes_setkey(struct crypto_ablkcipher *cipher,
const uint8_t *key, unsigned int keylen) const u8 *key, unsigned int keylen)
{ {
struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher); struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher);
struct s5p_aes_ctx *ctx = crypto_tfm_ctx(tfm); struct s5p_aes_ctx *ctx = crypto_tfm_ctx(tfm);
......
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