Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Christoph Manszewski <c.manszewski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Christoph Manszewski and committed by
Herbert Xu
b1b4416f 6c12b6ba

+17 -37
+17 -37
drivers/crypto/s5p-sss.c
··· 249 249 struct s5p_aes_ctx { 250 250 struct s5p_aes_dev *dev; 251 251 252 - uint8_t aes_key[AES_MAX_KEY_SIZE]; 253 - uint8_t nonce[CTR_RFC3686_NONCE_SIZE]; 252 + u8 aes_key[AES_MAX_KEY_SIZE]; 253 + u8 nonce[CTR_RFC3686_NONCE_SIZE]; 254 254 int keylen; 255 255 }; 256 256 ··· 518 518 519 519 static int s5p_set_outdata(struct s5p_aes_dev *dev, struct scatterlist *sg) 520 520 { 521 - int err; 521 + if (!sg->length) 522 + return -EINVAL; 522 523 523 - if (!sg->length) { 524 - err = -EINVAL; 525 - goto exit; 526 - } 527 - 528 - err = dma_map_sg(dev->dev, sg, 1, DMA_FROM_DEVICE); 529 - if (!err) { 530 - err = -ENOMEM; 531 - goto exit; 532 - } 524 + if (!dma_map_sg(dev->dev, sg, 1, DMA_FROM_DEVICE)) 525 + return -ENOMEM; 533 526 534 527 dev->sg_dst = sg; 535 - err = 0; 536 528 537 - exit: 538 - return err; 529 + return 0; 539 530 } 540 531 541 532 static int s5p_set_indata(struct s5p_aes_dev *dev, struct scatterlist *sg) 542 533 { 543 - int err; 534 + if (!sg->length) 535 + return -EINVAL; 544 536 545 - if (!sg->length) { 546 - err = -EINVAL; 547 - goto exit; 548 - } 549 - 550 - err = dma_map_sg(dev->dev, sg, 1, DMA_TO_DEVICE); 551 - if (!err) { 552 - err = -ENOMEM; 553 - goto exit; 554 - } 537 + if (!dma_map_sg(dev->dev, sg, 1, DMA_TO_DEVICE)) 538 + return -ENOMEM; 555 539 556 540 dev->sg_src = sg; 557 - err = 0; 558 541 559 - exit: 560 - return err; 542 + return 0; 561 543 } 562 544 563 545 /* ··· 644 662 bool tx_end = false; 645 663 bool hx_end = false; 646 664 unsigned long flags; 647 - uint32_t status; 648 - u32 st_bits; 665 + u32 status, st_bits; 649 666 int err; 650 667 651 668 spin_lock_irqsave(&dev->lock, flags); ··· 1813 1832 }; 1814 1833 1815 1834 static void s5p_set_aes(struct s5p_aes_dev *dev, 1816 - const uint8_t *key, const uint8_t *iv, 1835 + const u8 *key, const u8 *iv, 1817 1836 unsigned int keylen) 1818 1837 { 1819 1838 void __iomem *keystart; ··· 1899 1918 static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode) 1900 1919 { 1901 1920 struct ablkcipher_request *req = dev->req; 1902 - uint32_t aes_control; 1921 + u32 aes_control; 1903 1922 unsigned long flags; 1904 1923 int err; 1905 1924 u8 *iv; ··· 2007 2026 err = ablkcipher_enqueue_request(&dev->queue, req); 2008 2027 if (dev->busy) { 2009 2028 spin_unlock_irqrestore(&dev->lock, flags); 2010 - goto exit; 2029 + return err; 2011 2030 } 2012 2031 dev->busy = true; 2013 2032 ··· 2015 2034 2016 2035 tasklet_schedule(&dev->tasklet); 2017 2036 2018 - exit: 2019 2037 return err; 2020 2038 } 2021 2039 ··· 2036 2056 } 2037 2057 2038 2058 static int s5p_aes_setkey(struct crypto_ablkcipher *cipher, 2039 - const uint8_t *key, unsigned int keylen) 2059 + const u8 *key, unsigned int keylen) 2040 2060 { 2041 2061 struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher); 2042 2062 struct s5p_aes_ctx *ctx = crypto_tfm_ctx(tfm);