aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/tcrypt.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2016-06-28 03:23:06 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2016-06-28 04:06:41 -0400
commitf83f5b12ee674c187f329ef8eb9352dc45dcb25f (patch)
treed9bdfb25eb6688e043746b842f98e4fcaef78ee0 /crypto/tcrypt.c
parent14009c4bde13d191206d58d0513a9179568a0125 (diff)
crypto: tcrypt - Fix mixing printk/pr_err and obvious indentation issues
The recently added test_mb_ahash_speed() has clearly serious coding style issues. Try to fix some of them: 1. Don't mix pr_err() and printk(); 2. Don't wrap strings; 3. Properly align goto statement in if() block; 4. Align wrapped arguments on new line; 5. Don't wrap functions on first argument; Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r--crypto/tcrypt.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 158c164cbddf..8893ba5321b5 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -608,12 +608,12 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec,
608 608
609 req[i] = ahash_request_alloc(tfm, GFP_KERNEL); 609 req[i] = ahash_request_alloc(tfm, GFP_KERNEL);
610 if (!req[i]) { 610 if (!req[i]) {
611 printk(KERN_ERR "alg: hash: Failed to allocate " 611 pr_err("alg: hash: Failed to allocate request for %s\n",
612 "request for %s\n", algo); 612 algo);
613 goto out_noreq; 613 goto out_noreq;
614 } 614 }
615 ahash_request_set_callback(req[i], CRYPTO_TFM_REQ_MAY_BACKLOG, 615 ahash_request_set_callback(req[i], CRYPTO_TFM_REQ_MAY_BACKLOG,
616 tcrypt_complete, &tresult[i]); 616 tcrypt_complete, &tresult[i]);
617 617
618 hash_buff = xbuf[i][0]; 618 hash_buff = xbuf[i][0];
619 memcpy(hash_buff, ptext, 4096); 619 memcpy(hash_buff, ptext, 4096);
@@ -621,15 +621,14 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec,
621 621
622 j = 0; 622 j = 0;
623 623
624 printk(KERN_INFO "\ntesting speed of %s (%s)\n", algo, 624 pr_err("\ntesting speed of %s (%s)\n", algo,
625 get_driver_name(crypto_ahash, tfm)); 625 get_driver_name(crypto_ahash, tfm));
626 626
627 for (i = 0; speed[i].blen != 0; i++) { 627 for (i = 0; speed[i].blen != 0; i++) {
628 if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) { 628 if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) {
629 printk(KERN_ERR 629 pr_err("template (%u) too big for tvmem (%lu)\n",
630 "template (%u) too big for tvmem (%lu)\n", 630 speed[i].blen, TVMEMSIZE * PAGE_SIZE);
631 speed[i].blen, TVMEMSIZE * PAGE_SIZE); 631 goto out;
632 goto out;
633 } 632 }
634 633
635 if (speed[i].klen) 634 if (speed[i].klen)
@@ -637,13 +636,12 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec,
637 636
638 for (k = 0; k < 8; ++k) { 637 for (k = 0; k < 8; ++k) {
639 sg_init_one(&sg[k][0], (void *) xbuf[k][0], 638 sg_init_one(&sg[k][0], (void *) xbuf[k][0],
640 speed[i].blen); 639 speed[i].blen);
641 ahash_request_set_crypt(req[k], sg[k], 640 ahash_request_set_crypt(req[k], sg[k],
642 result[k], speed[i].blen); 641 result[k], speed[i].blen);
643 } 642 }
644 643
645 printk(KERN_INFO "test%3u " 644 pr_err("test%3u (%5u byte blocks,%5u bytes per update,%4u updates): ",
646 "(%5u byte blocks,%5u bytes per update,%4u updates): ",
647 i, speed[i].blen, speed[i].plen, 645 i, speed[i].blen, speed[i].plen,
648 speed[i].blen / speed[i].plen); 646 speed[i].blen / speed[i].plen);
649 647
@@ -653,9 +651,8 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec,
653 if (ret == -EBUSY || ret == -EINPROGRESS) 651 if (ret == -EBUSY || ret == -EINPROGRESS)
654 continue; 652 continue;
655 if (ret) { 653 if (ret) {
656 printk(KERN_ERR 654 pr_err("alg (%s) something wrong, ret = %d ...\n",
657 "alg (%s) something wrong, ret = %d ...\n", 655 algo, ret);
658 algo, ret);
659 goto out; 656 goto out;
660 } 657 }
661 } 658 }
@@ -664,11 +661,9 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec,
664 for (k = 0; k < 8; ++k) { 661 for (k = 0; k < 8; ++k) {
665 struct tcrypt_result *tr = &tresult[k]; 662 struct tcrypt_result *tr = &tresult[k];
666 663
667 ret = wait_for_completion_interruptible 664 ret = wait_for_completion_interruptible(&tr->completion);
668 (&tr->completion);
669 if (ret) 665 if (ret)
670 printk(KERN_ERR 666 pr_err("alg(%s): hash: digest failed\n", algo);
671 "alg(%s): hash: digest failed\n", algo);
672 end[k] = get_cycles(); 667 end[k] = get_cycles();
673 } 668 }
674 669