diff mbox series

sctp: remove redundant initialization of variable status

Message ID 20200724121753.16721-1-colin.king@canonical.com
State Superseded
Delegated to: David Miller
Headers show
Series sctp: remove redundant initialization of variable status | expand

Commit Message

Colin Ian King July 24, 2020, 12:17 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable status is being initialized with a value that is never read
and it is being updated later with a new value.  The initialization is
redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 net/sctp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marcelo Ricardo Leitner July 24, 2020, 12:55 p.m. UTC | #1
On Fri, Jul 24, 2020 at 01:17:53PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable status is being initialized with a value that is never read
> and it is being updated later with a new value.  The initialization is
> redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

Are you willing to send another to patch to fix the var ordering in
reverse christmass tree in there?

> ---
>  net/sctp/protocol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 7ecaf7d575c0..a0448f7c64b9 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -1368,7 +1368,7 @@ static struct pernet_operations sctp_ctrlsock_ops = {
>  static __init int sctp_init(void)
>  {
>  	int i;
> -	int status = -EINVAL;
> +	int status;
>  	unsigned long goal;
>  	unsigned long limit;
>  	unsigned long nr_pages = totalram_pages();
> -- 
> 2.27.0
>
Colin Ian King July 24, 2020, 12:56 p.m. UTC | #2
On 24/07/2020 13:55, Marcelo Ricardo Leitner wrote:
> On Fri, Jul 24, 2020 at 01:17:53PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The variable status is being initialized with a value that is never read
>> and it is being updated later with a new value.  The initialization is
>> redundant and can be removed.
>>
>> Addresses-Coverity: ("Unused value")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> 
> Are you willing to send another to patch to fix the var ordering in
> reverse christmass tree in there?

Sure, I'll send a V2 to re-order the vars.

> 
>> ---
>>  net/sctp/protocol.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
>> index 7ecaf7d575c0..a0448f7c64b9 100644
>> --- a/net/sctp/protocol.c
>> +++ b/net/sctp/protocol.c
>> @@ -1368,7 +1368,7 @@ static struct pernet_operations sctp_ctrlsock_ops = {
>>  static __init int sctp_init(void)
>>  {
>>  	int i;
>> -	int status = -EINVAL;
>> +	int status;
>>  	unsigned long goal;
>>  	unsigned long limit;
>>  	unsigned long nr_pages = totalram_pages();
>> -- 
>> 2.27.0
>>
diff mbox series

Patch

diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 7ecaf7d575c0..a0448f7c64b9 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1368,7 +1368,7 @@  static struct pernet_operations sctp_ctrlsock_ops = {
 static __init int sctp_init(void)
 {
 	int i;
-	int status = -EINVAL;
+	int status;
 	unsigned long goal;
 	unsigned long limit;
 	unsigned long nr_pages = totalram_pages();