2020-04-15 21:43:52

by Colin King

[permalink] [raw]
Subject: [PATCH][next] drivers: hv: remove redundant assignment to pointer primary_channel

From: Colin Ian King <[email protected]>

The pointer primary_channel is being assigned with a value that is never,
The assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <[email protected]>
---
drivers/hv/channel_mgmt.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index ffd7fffa5f83..f7bbb8dc4b0f 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -425,8 +425,6 @@ void hv_process_channel_removal(struct vmbus_channel *channel)

if (channel->primary_channel == NULL) {
list_del(&channel->listentry);
-
- primary_channel = channel;
} else {
primary_channel = channel->primary_channel;
spin_lock_irqsave(&primary_channel->lock, flags);
--
2.25.1


2020-04-15 21:44:25

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH][next] drivers: hv: remove redundant assignment to pointer primary_channel



On Tue, 14 Apr 2020, Colin King wrote:

> From: Colin Ian King <[email protected]>
>
> The pointer primary_channel is being assigned with a value that is never,

never -> never used :)

> The assignment is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> drivers/hv/channel_mgmt.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
> index ffd7fffa5f83..f7bbb8dc4b0f 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -425,8 +425,6 @@ void hv_process_channel_removal(struct vmbus_channel *channel)
>
> if (channel->primary_channel == NULL) {
> list_del(&channel->listentry);
> -
> - primary_channel = channel;
> } else {
> primary_channel = channel->primary_channel;
> spin_lock_irqsave(&primary_channel->lock, flags);
> --
> 2.25.1
>
>

2020-04-15 21:55:14

by Wei Liu

[permalink] [raw]
Subject: Re: [PATCH][next] drivers: hv: remove redundant assignment to pointer primary_channel

On Tue, Apr 14, 2020 at 04:23:43PM +0100, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> The pointer primary_channel is being assigned with a value that is never,
> The assignment is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <[email protected]>

Thanks.

Now that the only user of primary_channel is within the else branch, we
can go one step further to move the definition of primary_channel there.

I can make the adjustment while committing this patch, as well as
updating the commit message.

Wei.

> ---
> drivers/hv/channel_mgmt.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
> index ffd7fffa5f83..f7bbb8dc4b0f 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -425,8 +425,6 @@ void hv_process_channel_removal(struct vmbus_channel *channel)
>
> if (channel->primary_channel == NULL) {
> list_del(&channel->listentry);
> -
> - primary_channel = channel;
> } else {
> primary_channel = channel->primary_channel;
> spin_lock_irqsave(&primary_channel->lock, flags);
> --
> 2.25.1
>

2020-04-15 21:56:40

by Colin King

[permalink] [raw]
Subject: Re: [PATCH][next] drivers: hv: remove redundant assignment to pointer primary_channel

On 14/04/2020 21:24, Wei Liu wrote:
> On Tue, Apr 14, 2020 at 04:23:43PM +0100, Colin King wrote:
>> From: Colin Ian King <[email protected]>
>>
>> The pointer primary_channel is being assigned with a value that is never,
>> The assignment is redundant and can be removed.
>>
>> Addresses-Coverity: ("Unused value")
>> Signed-off-by: Colin Ian King <[email protected]>
>
> Thanks.
>
> Now that the only user of primary_channel is within the else branch, we
> can go one step further to move the definition of primary_channel there.
>
> I can make the adjustment while committing this patch, as well as
> updating the commit message.
>
> Wei.

Thanks Wei,

Colin

>
>> ---
>> drivers/hv/channel_mgmt.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
>> index ffd7fffa5f83..f7bbb8dc4b0f 100644
>> --- a/drivers/hv/channel_mgmt.c
>> +++ b/drivers/hv/channel_mgmt.c
>> @@ -425,8 +425,6 @@ void hv_process_channel_removal(struct vmbus_channel *channel)
>>
>> if (channel->primary_channel == NULL) {
>> list_del(&channel->listentry);
>> -
>> - primary_channel = channel;
>> } else {
>> primary_channel = channel->primary_channel;
>> spin_lock_irqsave(&primary_channel->lock, flags);
>> --
>> 2.25.1
>>