2013-01-16 05:51:24

by Vakul Garg

[permalink] [raw]
Subject: [PATCH] crypto: tcrypt - removed unused variable.

Removed unused variable for storing output string from:

(a) test_ahash_jiffies_digest()
(b) test_ahash_jiffies()
(c) test_ahash_cycles_digest()
(d) test_ahash_cycles()

This variable is not needed in above functions since the caller function
test_ahash_speed() already sets output buffer in the ahash transform using
ahash_request_set_crypt().

Signed-off-by: Vakul Garg <[email protected]>
---
crypto/tcrypt.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 7ae2130..1414b9f 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -499,7 +499,7 @@ static inline int do_one_ahash_op(struct ahash_request *req, int ret)
}

static int test_ahash_jiffies_digest(struct ahash_request *req, int blen,
- char *out, int sec)
+ int sec)
{
unsigned long start, end;
int bcount;
@@ -519,14 +519,14 @@ static int test_ahash_jiffies_digest(struct ahash_request *req, int blen,
}

static int test_ahash_jiffies(struct ahash_request *req, int blen,
- int plen, char *out, int sec)
+ int plen, int sec)
{
unsigned long start, end;
int bcount, pcount;
int ret;

if (plen == blen)
- return test_ahash_jiffies_digest(req, blen, out, sec);
+ return test_ahash_jiffies_digest(req, blen, sec);

for (start = jiffies, end = start + sec * HZ, bcount = 0;
time_before(jiffies, end); bcount++) {
@@ -550,8 +550,7 @@ static int test_ahash_jiffies(struct ahash_request *req, int blen,
return 0;
}

-static int test_ahash_cycles_digest(struct ahash_request *req, int blen,
- char *out)
+static int test_ahash_cycles_digest(struct ahash_request *req, int blen)
{
unsigned long cycles = 0;
int ret, i;
@@ -589,13 +588,13 @@ out:
}

static int test_ahash_cycles(struct ahash_request *req, int blen,
- int plen, char *out)
+ int plen)
{
unsigned long cycles = 0;
int i, pcount, ret;

if (plen == blen)
- return test_ahash_cycles_digest(req, blen, out);
+ return test_ahash_cycles_digest(req, blen);

/* Warm-up run. */
for (i = 0; i < 4; i++) {
@@ -696,10 +695,10 @@ static void test_ahash_speed(const char *algo, unsigned int sec,

if (sec)
ret = test_ahash_jiffies(req, speed[i].blen,
- speed[i].plen, output, sec);
+ speed[i].plen, sec);
else
ret = test_ahash_cycles(req, speed[i].blen,
- speed[i].plen, output);
+ speed[i].plen);

if (ret) {
pr_err("hashing failed ret=%d\n", ret);
--
1.7.7


2013-02-27 16:07:52

by Horia Geantă

[permalink] [raw]
Subject: Re: [PATCH] crypto: tcrypt - removed unused variable.

On 1/16/2013 7:48 AM, Vakul Garg wrote:
> Removed unused variable for storing output string from:
>
> (a) test_ahash_jiffies_digest()
> (b) test_ahash_jiffies()
> (c) test_ahash_cycles_digest()
> (d) test_ahash_cycles()
>
> This variable is not needed in above functions since the caller function
> test_ahash_speed() already sets output buffer in the ahash transform using
> ahash_request_set_crypt().
>
> Signed-off-by: Vakul Garg <[email protected]>
> ---

> @@ -519,14 +519,14 @@ static int test_ahash_jiffies_digest(struct ahash_request *req, int blen,
> }
>
> static int test_ahash_jiffies(struct ahash_request *req, int blen,
> - int plen, char *out, int sec)
> + int plen, int sec)
> {
> unsigned long start, end;
> int bcount, pcount;
> int ret;
>
> if (plen == blen)
> - return test_ahash_jiffies_digest(req, blen, out, sec);
> + return test_ahash_jiffies_digest(req, blen, sec);
>
> for (start = jiffies, end = start + sec * HZ, bcount = 0;
> time_before(jiffies, end); bcount++) {

You should also remove the deprecated comment in test_ahash_jiffies:
/* we assume there is enough space in 'out' for the result */

Regards,
Horia