* [PATCH net-next] net: bridge: remove unneeded variable 'err'
@ 2018-12-17 9:46 YueHaibing
2018-12-17 9:51 ` Nikolay Aleksandrov
2018-12-18 23:50 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: YueHaibing @ 2018-12-17 9:46 UTC (permalink / raw)
To: davem, roopa, nikolay; +Cc: linux-kernel, netdev, bridge, YueHaibing
function br_multicast_toggle now always return 0,
so the variable 'err' is unneeded.
Also cleanup dead branch in br_changelink.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
net/bridge/br_multicast.c | 3 +--
net/bridge/br_netlink.c | 4 +---
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 879cd23..3aeff08 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1937,7 +1937,6 @@ static void br_multicast_start_querier(struct net_bridge *br,
int br_multicast_toggle(struct net_bridge *br, unsigned long val)
{
struct net_bridge_port *port;
- int err = 0;
spin_lock_bh(&br->multicast_lock);
if (!!br_opt_get(br, BROPT_MULTICAST_ENABLED) == !!val)
@@ -1958,7 +1957,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val)
unlock:
spin_unlock_bh(&br->multicast_lock);
- return err;
+ return 0;
}
bool br_multicast_enabled(const struct net_device *dev)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 935495b..9c07591 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -1175,9 +1175,7 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
if (data[IFLA_BR_MCAST_SNOOPING]) {
u8 mcast_snooping = nla_get_u8(data[IFLA_BR_MCAST_SNOOPING]);
- err = br_multicast_toggle(br, mcast_snooping);
- if (err)
- return err;
+ br_multicast_toggle(br, mcast_snooping);
}
if (data[IFLA_BR_MCAST_QUERY_USE_IFADDR]) {
--
2.7.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: bridge: remove unneeded variable 'err'
2018-12-17 9:46 [PATCH net-next] net: bridge: remove unneeded variable 'err' YueHaibing
@ 2018-12-17 9:51 ` Nikolay Aleksandrov
2018-12-17 11:16 ` YueHaibing
2018-12-18 23:50 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Nikolay Aleksandrov @ 2018-12-17 9:51 UTC (permalink / raw)
To: YueHaibing, davem, roopa; +Cc: linux-kernel, netdev, bridge
On 17/12/2018 11:46, YueHaibing wrote:
> function br_multicast_toggle now always return 0,
> so the variable 'err' is unneeded.
> Also cleanup dead branch in br_changelink.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> net/bridge/br_multicast.c | 3 +--
> net/bridge/br_netlink.c | 4 +---
> 2 files changed, 2 insertions(+), 5 deletions(-)
>
That is correct, but in such case just make it void.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: bridge: remove unneeded variable 'err'
2018-12-17 9:51 ` Nikolay Aleksandrov
@ 2018-12-17 11:16 ` YueHaibing
2018-12-17 11:21 ` Nikolay Aleksandrov
0 siblings, 1 reply; 5+ messages in thread
From: YueHaibing @ 2018-12-17 11:16 UTC (permalink / raw)
To: Nikolay Aleksandrov, davem, roopa; +Cc: linux-kernel, netdev, bridge
On 2018/12/17 17:51, Nikolay Aleksandrov wrote:
> On 17/12/2018 11:46, YueHaibing wrote:
>> function br_multicast_toggle now always return 0,
>> so the variable 'err' is unneeded.
>> Also cleanup dead branch in br_changelink.
>>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>> net/bridge/br_multicast.c | 3 +--
>> net/bridge/br_netlink.c | 4 +---
>> 2 files changed, 2 insertions(+), 5 deletions(-)
>>
>
> That is correct, but in such case just make it void.
In net/bridge/br_sysfs_br.c:
static ssize_t multicast_snooping_store(struct device *d,
struct device_attribute *attr,
const char *buf, size_t len)
{
return store_bridge_parm(d, buf, len, br_multicast_toggle);
}
and store_bridge_parm need the returned err.
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: bridge: remove unneeded variable 'err'
2018-12-17 11:16 ` YueHaibing
@ 2018-12-17 11:21 ` Nikolay Aleksandrov
0 siblings, 0 replies; 5+ messages in thread
From: Nikolay Aleksandrov @ 2018-12-17 11:21 UTC (permalink / raw)
To: YueHaibing, davem, roopa; +Cc: linux-kernel, netdev, bridge
On 17/12/2018 13:16, YueHaibing wrote:
> On 2018/12/17 17:51, Nikolay Aleksandrov wrote:
>> On 17/12/2018 11:46, YueHaibing wrote:
>>> function br_multicast_toggle now always return 0,
>>> so the variable 'err' is unneeded.
>>> Also cleanup dead branch in br_changelink.
>>>
>>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>>> ---
>>> net/bridge/br_multicast.c | 3 +--
>>> net/bridge/br_netlink.c | 4 +---
>>> 2 files changed, 2 insertions(+), 5 deletions(-)
>>>
>>
>> That is correct, but in such case just make it void.
>
> In net/bridge/br_sysfs_br.c:
>
> static ssize_t multicast_snooping_store(struct device *d,
> struct device_attribute *attr,
> const char *buf, size_t len)
> {
> return store_bridge_parm(d, buf, len, br_multicast_toggle);
> }
>
> and store_bridge_parm need the returned err.
>
That can be worked-around with a set option that returns 0 but it's not that
important.
Fair enough,
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: bridge: remove unneeded variable 'err'
2018-12-17 9:46 [PATCH net-next] net: bridge: remove unneeded variable 'err' YueHaibing
2018-12-17 9:51 ` Nikolay Aleksandrov
@ 2018-12-18 23:50 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2018-12-18 23:50 UTC (permalink / raw)
To: yuehaibing; +Cc: roopa, nikolay, linux-kernel, netdev, bridge
From: YueHaibing <yuehaibing@huawei.com>
Date: Mon, 17 Dec 2018 17:46:23 +0800
> function br_multicast_toggle now always return 0,
> so the variable 'err' is unneeded.
> Also cleanup dead branch in br_changelink.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-12-18 23:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-17 9:46 [PATCH net-next] net: bridge: remove unneeded variable 'err' YueHaibing
2018-12-17 9:51 ` Nikolay Aleksandrov
2018-12-17 11:16 ` YueHaibing
2018-12-17 11:21 ` Nikolay Aleksandrov
2018-12-18 23:50 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).