2020-08-02 11:16:20

by Tianjia Zhang

[permalink] [raw]
Subject: [PATCH] s390/pkey: Remove redundant variable initialization

In the first place, the initialization value of `rc` is wrong.
It is unnecessary to initialize `rc` variables, so remove their
initialization operation.

Fixes: f2bbc96e7cfad ("s390/pkey: add CCA AES cipher key support")
Cc: Harald Freudenberger <[email protected]>
Signed-off-by: Tianjia Zhang <[email protected]>
---
drivers/s390/crypto/pkey_api.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
index 74e63ec49068..58140506a8e7 100644
--- a/drivers/s390/crypto/pkey_api.c
+++ b/drivers/s390/crypto/pkey_api.c
@@ -818,7 +818,7 @@ static int pkey_keyblob2pkey2(const struct pkey_apqn *apqns, size_t nr_apqns,
static int pkey_apqns4key(const u8 *key, size_t keylen, u32 flags,
struct pkey_apqn *apqns, size_t *nr_apqns)
{
- int rc = EINVAL;
+ int rc;
u32 _nr_apqns, *_apqns = NULL;
struct keytoken_header *hdr = (struct keytoken_header *)key;

@@ -886,7 +886,7 @@ static int pkey_apqns4keytype(enum pkey_key_type ktype,
u8 cur_mkvp[32], u8 alt_mkvp[32], u32 flags,
struct pkey_apqn *apqns, size_t *nr_apqns)
{
- int rc = -EINVAL;
+ int rc;
u32 _nr_apqns, *_apqns = NULL;

if (ktype == PKEY_TYPE_CCA_DATA || ktype == PKEY_TYPE_CCA_CIPHER) {
--
2.26.2


2020-08-03 07:20:44

by Harald Freudenberger

[permalink] [raw]
Subject: Re: [PATCH] s390/pkey: Remove redundant variable initialization

On 02.08.20 13:15, Tianjia Zhang wrote:
> In the first place, the initialization value of `rc` is wrong.
> It is unnecessary to initialize `rc` variables, so remove their
> initialization operation.
>
> Fixes: f2bbc96e7cfad ("s390/pkey: add CCA AES cipher key support")
> Cc: Harald Freudenberger <[email protected]>
> Signed-off-by: Tianjia Zhang <[email protected]>
> ---
> drivers/s390/crypto/pkey_api.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
> index 74e63ec49068..58140506a8e7 100644
> --- a/drivers/s390/crypto/pkey_api.c
> +++ b/drivers/s390/crypto/pkey_api.c
> @@ -818,7 +818,7 @@ static int pkey_keyblob2pkey2(const struct pkey_apqn *apqns, size_t nr_apqns,
> static int pkey_apqns4key(const u8 *key, size_t keylen, u32 flags,
> struct pkey_apqn *apqns, size_t *nr_apqns)
> {
> - int rc = EINVAL;
> + int rc;
> u32 _nr_apqns, *_apqns = NULL;
> struct keytoken_header *hdr = (struct keytoken_header *)key;
>
> @@ -886,7 +886,7 @@ static int pkey_apqns4keytype(enum pkey_key_type ktype,
> u8 cur_mkvp[32], u8 alt_mkvp[32], u32 flags,
> struct pkey_apqn *apqns, size_t *nr_apqns)
> {
> - int rc = -EINVAL;
> + int rc;
> u32 _nr_apqns, *_apqns = NULL;
>
> if (ktype == PKEY_TYPE_CCA_DATA || ktype == PKEY_TYPE_CCA_CIPHER) {
Thanks, I've picked this one and committed to the s390 subsystem.