@@ -165,16 +165,14 @@ __cfg80211_rdev_from_attrs(struct net *netns, struct nlattr **attrs)
165
165
166
166
if (attrs [NL80211_ATTR_IFINDEX ]) {
167
167
int ifindex = nla_get_u32 (attrs [NL80211_ATTR_IFINDEX ]);
168
- netdev = dev_get_by_index (netns , ifindex );
168
+ netdev = __dev_get_by_index (netns , ifindex );
169
169
if (netdev ) {
170
170
if (netdev -> ieee80211_ptr )
171
171
tmp = wiphy_to_dev (
172
172
netdev -> ieee80211_ptr -> wiphy );
173
173
else
174
174
tmp = NULL ;
175
175
176
- dev_put (netdev );
177
-
178
176
/* not wireless device -- return error */
179
177
if (!tmp )
180
178
return ERR_PTR (- EINVAL );
@@ -1656,15 +1654,14 @@ static int nl80211_dump_wiphy_parse(struct sk_buff *skb,
1656
1654
struct cfg80211_registered_device * rdev ;
1657
1655
int ifidx = nla_get_u32 (tb [NL80211_ATTR_IFINDEX ]);
1658
1656
1659
- netdev = dev_get_by_index (sock_net (skb -> sk ), ifidx );
1657
+ netdev = __dev_get_by_index (sock_net (skb -> sk ), ifidx );
1660
1658
if (!netdev )
1661
1659
return - ENODEV ;
1662
1660
if (netdev -> ieee80211_ptr ) {
1663
1661
rdev = wiphy_to_dev (
1664
1662
netdev -> ieee80211_ptr -> wiphy );
1665
1663
state -> filter_wiphy = rdev -> wiphy_idx ;
1666
1664
}
1667
- dev_put (netdev );
1668
1665
}
1669
1666
1670
1667
return 0 ;
@@ -1987,7 +1984,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1987
1984
if (info -> attrs [NL80211_ATTR_IFINDEX ]) {
1988
1985
int ifindex = nla_get_u32 (info -> attrs [NL80211_ATTR_IFINDEX ]);
1989
1986
1990
- netdev = dev_get_by_index (genl_info_net (info ), ifindex );
1987
+ netdev = __dev_get_by_index (genl_info_net (info ), ifindex );
1991
1988
if (netdev && netdev -> ieee80211_ptr )
1992
1989
rdev = wiphy_to_dev (netdev -> ieee80211_ptr -> wiphy );
1993
1990
else
@@ -2015,32 +2012,24 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
2015
2012
rdev , nla_data (info -> attrs [NL80211_ATTR_WIPHY_NAME ]));
2016
2013
2017
2014
if (result )
2018
- goto bad_res ;
2015
+ return result ;
2019
2016
2020
2017
if (info -> attrs [NL80211_ATTR_WIPHY_TXQ_PARAMS ]) {
2021
2018
struct ieee80211_txq_params txq_params ;
2022
2019
struct nlattr * tb [NL80211_TXQ_ATTR_MAX + 1 ];
2023
2020
2024
- if (!rdev -> ops -> set_txq_params ) {
2025
- result = - EOPNOTSUPP ;
2026
- goto bad_res ;
2027
- }
2021
+ if (!rdev -> ops -> set_txq_params )
2022
+ return - EOPNOTSUPP ;
2028
2023
2029
- if (!netdev ) {
2030
- result = - EINVAL ;
2031
- goto bad_res ;
2032
- }
2024
+ if (!netdev )
2025
+ return - EINVAL ;
2033
2026
2034
2027
if (netdev -> ieee80211_ptr -> iftype != NL80211_IFTYPE_AP &&
2035
- netdev -> ieee80211_ptr -> iftype != NL80211_IFTYPE_P2P_GO ) {
2036
- result = - EINVAL ;
2037
- goto bad_res ;
2038
- }
2028
+ netdev -> ieee80211_ptr -> iftype != NL80211_IFTYPE_P2P_GO )
2029
+ return - EINVAL ;
2039
2030
2040
- if (!netif_running (netdev )) {
2041
- result = - ENETDOWN ;
2042
- goto bad_res ;
2043
- }
2031
+ if (!netif_running (netdev ))
2032
+ return - ENETDOWN ;
2044
2033
2045
2034
nla_for_each_nested (nl_txq_params ,
2046
2035
info -> attrs [NL80211_ATTR_WIPHY_TXQ_PARAMS ],
@@ -2051,12 +2040,12 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
2051
2040
txq_params_policy );
2052
2041
result = parse_txq_params (tb , & txq_params );
2053
2042
if (result )
2054
- goto bad_res ;
2043
+ return result ;
2055
2044
2056
2045
result = rdev_set_txq_params (rdev , netdev ,
2057
2046
& txq_params );
2058
2047
if (result )
2059
- goto bad_res ;
2048
+ return result ;
2060
2049
}
2061
2050
}
2062
2051
@@ -2065,7 +2054,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
2065
2054
nl80211_can_set_dev_channel (wdev ) ? wdev : NULL ,
2066
2055
info );
2067
2056
if (result )
2068
- goto bad_res ;
2057
+ return result ;
2069
2058
}
2070
2059
2071
2060
if (info -> attrs [NL80211_ATTR_WIPHY_TX_POWER_SETTING ]) {
@@ -2076,19 +2065,15 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
2076
2065
if (!(rdev -> wiphy .features & NL80211_FEATURE_VIF_TXPOWER ))
2077
2066
txp_wdev = NULL ;
2078
2067
2079
- if (!rdev -> ops -> set_tx_power ) {
2080
- result = - EOPNOTSUPP ;
2081
- goto bad_res ;
2082
- }
2068
+ if (!rdev -> ops -> set_tx_power )
2069
+ return - EOPNOTSUPP ;
2083
2070
2084
2071
idx = NL80211_ATTR_WIPHY_TX_POWER_SETTING ;
2085
2072
type = nla_get_u32 (info -> attrs [idx ]);
2086
2073
2087
2074
if (!info -> attrs [NL80211_ATTR_WIPHY_TX_POWER_LEVEL ] &&
2088
- (type != NL80211_TX_POWER_AUTOMATIC )) {
2089
- result = - EINVAL ;
2090
- goto bad_res ;
2091
- }
2075
+ (type != NL80211_TX_POWER_AUTOMATIC ))
2076
+ return - EINVAL ;
2092
2077
2093
2078
if (type != NL80211_TX_POWER_AUTOMATIC ) {
2094
2079
idx = NL80211_ATTR_WIPHY_TX_POWER_LEVEL ;
@@ -2097,67 +2082,60 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
2097
2082
2098
2083
result = rdev_set_tx_power (rdev , txp_wdev , type , mbm );
2099
2084
if (result )
2100
- goto bad_res ;
2085
+ return result ;
2101
2086
}
2102
2087
2103
2088
if (info -> attrs [NL80211_ATTR_WIPHY_ANTENNA_TX ] &&
2104
2089
info -> attrs [NL80211_ATTR_WIPHY_ANTENNA_RX ]) {
2105
2090
u32 tx_ant , rx_ant ;
2106
2091
if ((!rdev -> wiphy .available_antennas_tx &&
2107
2092
!rdev -> wiphy .available_antennas_rx ) ||
2108
- !rdev -> ops -> set_antenna ) {
2109
- result = - EOPNOTSUPP ;
2110
- goto bad_res ;
2111
- }
2093
+ !rdev -> ops -> set_antenna )
2094
+ return - EOPNOTSUPP ;
2112
2095
2113
2096
tx_ant = nla_get_u32 (info -> attrs [NL80211_ATTR_WIPHY_ANTENNA_TX ]);
2114
2097
rx_ant = nla_get_u32 (info -> attrs [NL80211_ATTR_WIPHY_ANTENNA_RX ]);
2115
2098
2116
2099
/* reject antenna configurations which don't match the
2117
2100
* available antenna masks, except for the "all" mask */
2118
2101
if ((~tx_ant && (tx_ant & ~rdev -> wiphy .available_antennas_tx )) ||
2119
- (~rx_ant && (rx_ant & ~rdev -> wiphy .available_antennas_rx ))) {
2120
- result = - EINVAL ;
2121
- goto bad_res ;
2122
- }
2102
+ (~rx_ant && (rx_ant & ~rdev -> wiphy .available_antennas_rx )))
2103
+ return - EINVAL ;
2123
2104
2124
2105
tx_ant = tx_ant & rdev -> wiphy .available_antennas_tx ;
2125
2106
rx_ant = rx_ant & rdev -> wiphy .available_antennas_rx ;
2126
2107
2127
2108
result = rdev_set_antenna (rdev , tx_ant , rx_ant );
2128
2109
if (result )
2129
- goto bad_res ;
2110
+ return result ;
2130
2111
}
2131
2112
2132
2113
changed = 0 ;
2133
2114
2134
2115
if (info -> attrs [NL80211_ATTR_WIPHY_RETRY_SHORT ]) {
2135
2116
retry_short = nla_get_u8 (
2136
2117
info -> attrs [NL80211_ATTR_WIPHY_RETRY_SHORT ]);
2137
- if (retry_short == 0 ) {
2138
- result = - EINVAL ;
2139
- goto bad_res ;
2140
- }
2118
+ if (retry_short == 0 )
2119
+ return - EINVAL ;
2120
+
2141
2121
changed |= WIPHY_PARAM_RETRY_SHORT ;
2142
2122
}
2143
2123
2144
2124
if (info -> attrs [NL80211_ATTR_WIPHY_RETRY_LONG ]) {
2145
2125
retry_long = nla_get_u8 (
2146
2126
info -> attrs [NL80211_ATTR_WIPHY_RETRY_LONG ]);
2147
- if (retry_long == 0 ) {
2148
- result = - EINVAL ;
2149
- goto bad_res ;
2150
- }
2127
+ if (retry_long == 0 )
2128
+ return - EINVAL ;
2129
+
2151
2130
changed |= WIPHY_PARAM_RETRY_LONG ;
2152
2131
}
2153
2132
2154
2133
if (info -> attrs [NL80211_ATTR_WIPHY_FRAG_THRESHOLD ]) {
2155
2134
frag_threshold = nla_get_u32 (
2156
2135
info -> attrs [NL80211_ATTR_WIPHY_FRAG_THRESHOLD ]);
2157
- if (frag_threshold < 256 ) {
2158
- result = - EINVAL ;
2159
- goto bad_res ;
2160
- }
2136
+ if (frag_threshold < 256 )
2137
+ return - EINVAL ;
2138
+
2161
2139
if (frag_threshold != (u32 ) - 1 ) {
2162
2140
/*
2163
2141
* Fragments (apart from the last one) are required to
@@ -2187,10 +2165,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
2187
2165
u32 old_frag_threshold , old_rts_threshold ;
2188
2166
u8 old_coverage_class ;
2189
2167
2190
- if (!rdev -> ops -> set_wiphy_params ) {
2191
- result = - EOPNOTSUPP ;
2192
- goto bad_res ;
2193
- }
2168
+ if (!rdev -> ops -> set_wiphy_params )
2169
+ return - EOPNOTSUPP ;
2194
2170
2195
2171
old_retry_short = rdev -> wiphy .retry_short ;
2196
2172
old_retry_long = rdev -> wiphy .retry_long ;
@@ -2218,11 +2194,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
2218
2194
rdev -> wiphy .coverage_class = old_coverage_class ;
2219
2195
}
2220
2196
}
2221
-
2222
- bad_res :
2223
- if (netdev )
2224
- dev_put (netdev );
2225
- return result ;
2197
+ return 0 ;
2226
2198
}
2227
2199
2228
2200
static inline u64 wdev_id (struct wireless_dev * wdev )
0 commit comments