Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0179-5.4.80-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3637 - (show annotations) (download)
Mon Oct 24 12:40:44 2022 UTC (18 months, 1 week ago) by niro
File size: 153984 byte(s)
-add missing
1 diff --git a/Documentation/xtensa/mmu.rst b/Documentation/xtensa/mmu.rst
2 index e52a12960fdc4..450573afa31a6 100644
3 --- a/Documentation/xtensa/mmu.rst
4 +++ b/Documentation/xtensa/mmu.rst
5 @@ -82,7 +82,8 @@ Default MMUv2-compatible layout::
6 +------------------+
7 | VMALLOC area | VMALLOC_START 0xc0000000 128MB - 64KB
8 +------------------+ VMALLOC_END
9 - | Cache aliasing | TLBTEMP_BASE_1 0xc7ff0000 DCACHE_WAY_SIZE
10 + +------------------+
11 + | Cache aliasing | TLBTEMP_BASE_1 0xc8000000 DCACHE_WAY_SIZE
12 | remap area 1 |
13 +------------------+
14 | Cache aliasing | TLBTEMP_BASE_2 DCACHE_WAY_SIZE
15 @@ -124,7 +125,8 @@ Default MMUv2-compatible layout::
16 +------------------+
17 | VMALLOC area | VMALLOC_START 0xa0000000 128MB - 64KB
18 +------------------+ VMALLOC_END
19 - | Cache aliasing | TLBTEMP_BASE_1 0xa7ff0000 DCACHE_WAY_SIZE
20 + +------------------+
21 + | Cache aliasing | TLBTEMP_BASE_1 0xa8000000 DCACHE_WAY_SIZE
22 | remap area 1 |
23 +------------------+
24 | Cache aliasing | TLBTEMP_BASE_2 DCACHE_WAY_SIZE
25 @@ -167,7 +169,8 @@ Default MMUv2-compatible layout::
26 +------------------+
27 | VMALLOC area | VMALLOC_START 0x90000000 128MB - 64KB
28 +------------------+ VMALLOC_END
29 - | Cache aliasing | TLBTEMP_BASE_1 0x97ff0000 DCACHE_WAY_SIZE
30 + +------------------+
31 + | Cache aliasing | TLBTEMP_BASE_1 0x98000000 DCACHE_WAY_SIZE
32 | remap area 1 |
33 +------------------+
34 | Cache aliasing | TLBTEMP_BASE_2 DCACHE_WAY_SIZE
35 diff --git a/Makefile b/Makefile
36 index f02539be5e073..7c58e4ce51385 100644
37 --- a/Makefile
38 +++ b/Makefile
39 @@ -1,7 +1,7 @@
40 # SPDX-License-Identifier: GPL-2.0
41 VERSION = 5
42 PATCHLEVEL = 4
43 -SUBLEVEL = 79
44 +SUBLEVEL = 80
45 EXTRAVERSION =
46 NAME = Kleptomaniac Octopus
47
48 diff --git a/arch/arm/boot/dts/imx50-evk.dts b/arch/arm/boot/dts/imx50-evk.dts
49 index a25da415cb02e..907339bc81e54 100644
50 --- a/arch/arm/boot/dts/imx50-evk.dts
51 +++ b/arch/arm/boot/dts/imx50-evk.dts
52 @@ -59,7 +59,7 @@
53 MX50_PAD_CSPI_MISO__CSPI_MISO 0x00
54 MX50_PAD_CSPI_MOSI__CSPI_MOSI 0x00
55 MX50_PAD_CSPI_SS0__GPIO4_11 0xc4
56 - MX50_PAD_ECSPI1_MOSI__CSPI_SS1 0xf4
57 + MX50_PAD_ECSPI1_MOSI__GPIO4_13 0x84
58 >;
59 };
60
61 diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi
62 index 776bfc77f89d0..16672cbada287 100644
63 --- a/arch/arm/boot/dts/imx6qdl-udoo.dtsi
64 +++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi
65 @@ -98,7 +98,7 @@
66 &fec {
67 pinctrl-names = "default";
68 pinctrl-0 = <&pinctrl_enet>;
69 - phy-mode = "rgmii";
70 + phy-mode = "rgmii-id";
71 status = "okay";
72 };
73
74 diff --git a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
75 index 049e6ab3cf56c..73de34ae37fdc 100644
76 --- a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
77 +++ b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
78 @@ -154,7 +154,7 @@
79 pinctrl-names = "default";
80 pinctrl-0 = <&gmac_rgmii_pins>;
81 phy-handle = <&phy1>;
82 - phy-mode = "rgmii";
83 + phy-mode = "rgmii-id";
84 status = "okay";
85 };
86
87 diff --git a/arch/arm/boot/dts/sun7i-a20-bananapi-m1-plus.dts b/arch/arm/boot/dts/sun7i-a20-bananapi-m1-plus.dts
88 index 32d5d45a35c03..8945dbb114a2a 100644
89 --- a/arch/arm/boot/dts/sun7i-a20-bananapi-m1-plus.dts
90 +++ b/arch/arm/boot/dts/sun7i-a20-bananapi-m1-plus.dts
91 @@ -130,7 +130,7 @@
92 pinctrl-names = "default";
93 pinctrl-0 = <&gmac_rgmii_pins>;
94 phy-handle = <&phy1>;
95 - phy-mode = "rgmii";
96 + phy-mode = "rgmii-id";
97 phy-supply = <&reg_gmac_3v3>;
98 status = "okay";
99 };
100 diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
101 index 8c8dee6ea461a..9109ca0919ade 100644
102 --- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
103 +++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
104 @@ -151,7 +151,7 @@
105 pinctrl-names = "default";
106 pinctrl-0 = <&gmac_rgmii_pins>;
107 phy-handle = <&phy1>;
108 - phy-mode = "rgmii";
109 + phy-mode = "rgmii-id";
110 status = "okay";
111 };
112
113 diff --git a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
114 index 9d34eabba1213..431f70234d364 100644
115 --- a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
116 +++ b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
117 @@ -131,7 +131,7 @@
118 pinctrl-0 = <&emac_rgmii_pins>;
119 phy-supply = <&reg_sw>;
120 phy-handle = <&rgmii_phy>;
121 - phy-mode = "rgmii";
122 + phy-mode = "rgmii-id";
123 allwinner,rx-delay-ps = <700>;
124 allwinner,tx-delay-ps = <700>;
125 status = "okay";
126 diff --git a/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts b/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts
127 index d9be511f054f0..d8326a5c681d4 100644
128 --- a/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts
129 +++ b/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts
130 @@ -183,7 +183,7 @@
131 pinctrl-0 = <&emac_rgmii_pins>;
132 phy-supply = <&reg_dldo4>;
133 phy-handle = <&rgmii_phy>;
134 - phy-mode = "rgmii";
135 + phy-mode = "rgmii-id";
136 status = "okay";
137 };
138
139 diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts
140 index 71fb732089397..babf4cf1b2f68 100644
141 --- a/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts
142 +++ b/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts
143 @@ -53,11 +53,6 @@
144 };
145 };
146
147 -&emac {
148 - /* LEDs changed to active high on the plus */
149 - /delete-property/ allwinner,leds-active-low;
150 -};
151 -
152 &mmc1 {
153 vmmc-supply = <&reg_vcc3v3>;
154 bus-width = <4>;
155 diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts
156 index 6dbf7b2e0c13c..b6ca45d18e511 100644
157 --- a/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts
158 +++ b/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts
159 @@ -67,7 +67,7 @@
160 pinctrl-0 = <&emac_rgmii_pins>;
161 phy-supply = <&reg_gmac_3v3>;
162 phy-handle = <&ext_rgmii_phy>;
163 - phy-mode = "rgmii";
164 + phy-mode = "rgmii-id";
165 status = "okay";
166 };
167
168 diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
169 index ea15073f0c79c..7db89500f399c 100644
170 --- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
171 +++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
172 @@ -129,7 +129,7 @@
173 pinctrl-names = "default";
174 pinctrl-0 = <&gmac_rgmii_pins>;
175 phy-handle = <&phy1>;
176 - phy-mode = "rgmii";
177 + phy-mode = "rgmii-id";
178 phy-supply = <&reg_dc1sw>;
179 status = "okay";
180 };
181 diff --git a/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts b/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
182 index d3b337b043a15..484b93df20cb6 100644
183 --- a/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
184 +++ b/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
185 @@ -129,7 +129,7 @@
186 pinctrl-names = "default";
187 pinctrl-0 = <&gmac_rgmii_pins>;
188 phy-handle = <&phy1>;
189 - phy-mode = "rgmii";
190 + phy-mode = "rgmii-id";
191 phy-supply = <&reg_cldo1>;
192 status = "okay";
193 };
194 diff --git a/arch/arm/boot/dts/sun9i-a80-optimus.dts b/arch/arm/boot/dts/sun9i-a80-optimus.dts
195 index bbc6335e56314..5c3580d712e40 100644
196 --- a/arch/arm/boot/dts/sun9i-a80-optimus.dts
197 +++ b/arch/arm/boot/dts/sun9i-a80-optimus.dts
198 @@ -124,7 +124,7 @@
199 pinctrl-names = "default";
200 pinctrl-0 = <&gmac_rgmii_pins>;
201 phy-handle = <&phy1>;
202 - phy-mode = "rgmii";
203 + phy-mode = "rgmii-id";
204 phy-supply = <&reg_cldo1>;
205 status = "okay";
206 };
207 diff --git a/arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi b/arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi
208 index 39263e74fbb53..8e5cb3b3fd686 100644
209 --- a/arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi
210 +++ b/arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi
211 @@ -126,7 +126,7 @@
212 pinctrl-0 = <&emac_rgmii_pins>;
213 phy-supply = <&reg_gmac_3v3>;
214 phy-handle = <&ext_rgmii_phy>;
215 - phy-mode = "rgmii";
216 + phy-mode = "rgmii-id";
217
218 status = "okay";
219 };
220 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
221 index 208373efee494..7d1e89e5b1ae4 100644
222 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
223 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
224 @@ -127,7 +127,7 @@
225 &emac {
226 pinctrl-names = "default";
227 pinctrl-0 = <&rgmii_pins>;
228 - phy-mode = "rgmii";
229 + phy-mode = "rgmii-id";
230 phy-handle = <&ext_rgmii_phy>;
231 phy-supply = <&reg_dc1sw>;
232 status = "okay";
233 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
234 index 04446e4716c44..a0db02504b69e 100644
235 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
236 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
237 @@ -129,7 +129,7 @@
238 &emac {
239 pinctrl-names = "default";
240 pinctrl-0 = <&rgmii_pins>;
241 - phy-mode = "rgmii";
242 + phy-mode = "rgmii-id";
243 phy-handle = <&ext_rgmii_phy>;
244 phy-supply = <&reg_gmac_3v3>;
245 status = "okay";
246 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
247 index d5b6e8159a335..5d0905f0f1c1d 100644
248 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
249 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
250 @@ -52,7 +52,7 @@
251 &emac {
252 pinctrl-names = "default";
253 pinctrl-0 = <&rgmii_pins>;
254 - phy-mode = "rgmii";
255 + phy-mode = "rgmii-txid";
256 phy-handle = <&ext_rgmii_phy>;
257 status = "okay";
258 };
259 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
260 index e126c1c9f05ce..4d357b81b0c00 100644
261 --- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
262 +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
263 @@ -157,7 +157,7 @@
264 pinctrl-0 = <&emac_rgmii_pins>;
265 phy-supply = <&reg_gmac_3v3>;
266 phy-handle = <&ext_rgmii_phy>;
267 - phy-mode = "rgmii";
268 + phy-mode = "rgmii-id";
269 status = "okay";
270 };
271
272 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
273 index d9b3ed257088a..f10340339007f 100644
274 --- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
275 +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
276 @@ -164,7 +164,7 @@
277 pinctrl-0 = <&emac_rgmii_pins>;
278 phy-supply = <&reg_gmac_3v3>;
279 phy-handle = <&ext_rgmii_phy>;
280 - phy-mode = "rgmii";
281 + phy-mode = "rgmii-id";
282 status = "okay";
283 };
284
285 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts
286 index 1d05d570142fa..0a04730960fcb 100644
287 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts
288 +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts
289 @@ -83,7 +83,7 @@
290 &emac {
291 pinctrl-names = "default";
292 pinctrl-0 = <&ext_rgmii_pins>;
293 - phy-mode = "rgmii";
294 + phy-mode = "rgmii-id";
295 phy-handle = <&ext_rgmii_phy>;
296 phy-supply = <&reg_aldo2>;
297 status = "okay";
298 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts
299 index 30102daf83cc6..3f2882b36616d 100644
300 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts
301 +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts
302 @@ -66,7 +66,7 @@
303 &emac {
304 pinctrl-names = "default";
305 pinctrl-0 = <&ext_rgmii_pins>;
306 - phy-mode = "rgmii";
307 + phy-mode = "rgmii-id";
308 phy-handle = <&ext_rgmii_phy>;
309 phy-supply = <&reg_aldo2>;
310 allwinner,rx-delay-ps = <200>;
311 diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
312 index fde1849d36ca5..7b178a77cc712 100644
313 --- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi
314 +++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
315 @@ -126,7 +126,7 @@
316
317 opp-1600000000 {
318 opp-hz = /bits/ 64 <1600000000>;
319 - opp-microvolt = <900000>;
320 + opp-microvolt = <950000>;
321 opp-supported-hw = <0xc>, <0x7>;
322 clock-latency-ns = <150000>;
323 opp-suspend;
324 diff --git a/arch/arm64/boot/dts/freescale/imx8mn.dtsi b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
325 index ac3a3b333efa6..546511b373d43 100644
326 --- a/arch/arm64/boot/dts/freescale/imx8mn.dtsi
327 +++ b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
328 @@ -677,28 +677,6 @@
329 #index-cells = <1>;
330 reg = <0x32e40200 0x200>;
331 };
332 -
333 - usbotg2: usb@32e50000 {
334 - compatible = "fsl,imx8mn-usb", "fsl,imx7d-usb";
335 - reg = <0x32e50000 0x200>;
336 - interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
337 - clocks = <&clk IMX8MN_CLK_USB1_CTRL_ROOT>;
338 - clock-names = "usb1_ctrl_root_clk";
339 - assigned-clocks = <&clk IMX8MN_CLK_USB_BUS>,
340 - <&clk IMX8MN_CLK_USB_CORE_REF>;
341 - assigned-clock-parents = <&clk IMX8MN_SYS_PLL2_500M>,
342 - <&clk IMX8MN_SYS_PLL1_100M>;
343 - fsl,usbphy = <&usbphynop2>;
344 - fsl,usbmisc = <&usbmisc2 0>;
345 - status = "disabled";
346 - };
347 -
348 - usbmisc2: usbmisc@32e50200 {
349 - compatible = "fsl,imx8mn-usbmisc", "fsl,imx7d-usbmisc";
350 - #index-cells = <1>;
351 - reg = <0x32e50200 0x200>;
352 - };
353 -
354 };
355
356 dma_apbh: dma-controller@33000000 {
357 @@ -747,12 +725,4 @@
358 assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_100M>;
359 clock-names = "main_clk";
360 };
361 -
362 - usbphynop2: usbphynop2 {
363 - compatible = "usb-nop-xceiv";
364 - clocks = <&clk IMX8MN_CLK_USB_PHY_REF>;
365 - assigned-clocks = <&clk IMX8MN_CLK_USB_PHY_REF>;
366 - assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_100M>;
367 - clock-names = "main_clk";
368 - };
369 };
370 diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
371 index 10d3048dec7c2..ccae05da98a7f 100644
372 --- a/arch/arm64/include/asm/cpufeature.h
373 +++ b/arch/arm64/include/asm/cpufeature.h
374 @@ -262,6 +262,8 @@ extern struct arm64_ftr_reg arm64_ftr_reg_ctrel0;
375 /*
376 * CPU feature detected at boot time based on feature of one or more CPUs.
377 * All possible conflicts for a late CPU are ignored.
378 + * NOTE: this means that a late CPU with the feature will *not* cause the
379 + * capability to be advertised by cpus_have_*cap()!
380 */
381 #define ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE \
382 (ARM64_CPUCAP_SCOPE_LOCAL_CPU | \
383 diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
384 index 10190c4b16dc4..7d7cfa128b71b 100644
385 --- a/arch/arm64/kernel/process.c
386 +++ b/arch/arm64/kernel/process.c
387 @@ -511,14 +511,13 @@ static void erratum_1418040_thread_switch(struct task_struct *prev,
388 bool prev32, next32;
389 u64 val;
390
391 - if (!(IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040) &&
392 - cpus_have_const_cap(ARM64_WORKAROUND_1418040)))
393 + if (!IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040))
394 return;
395
396 prev32 = is_compat_thread(task_thread_info(prev));
397 next32 = is_compat_thread(task_thread_info(next));
398
399 - if (prev32 == next32)
400 + if (prev32 == next32 || !this_cpu_has_cap(ARM64_WORKAROUND_1418040))
401 return;
402
403 val = read_sysreg(cntkctl_el1);
404 diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
405 index 43ae4e0c968f6..62d2bda7adb80 100644
406 --- a/arch/arm64/kernel/psci.c
407 +++ b/arch/arm64/kernel/psci.c
408 @@ -66,7 +66,6 @@ static int cpu_psci_cpu_disable(unsigned int cpu)
409
410 static void cpu_psci_cpu_die(unsigned int cpu)
411 {
412 - int ret;
413 /*
414 * There are no known implementations of PSCI actually using the
415 * power state field, pass a sensible default for now.
416 @@ -74,9 +73,7 @@ static void cpu_psci_cpu_die(unsigned int cpu)
417 u32 state = PSCI_POWER_STATE_TYPE_POWER_DOWN <<
418 PSCI_0_2_POWER_STATE_TYPE_SHIFT;
419
420 - ret = psci_ops.cpu_off(state);
421 -
422 - pr_crit("unable to power off CPU%u (%d)\n", cpu, ret);
423 + psci_ops.cpu_off(state);
424 }
425
426 static int cpu_psci_cpu_kill(unsigned int cpu)
427 diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
428 index 426409e0d0713..987220ac4cfef 100644
429 --- a/arch/arm64/kernel/smp.c
430 +++ b/arch/arm64/kernel/smp.c
431 @@ -388,6 +388,7 @@ void cpu_die_early(void)
432
433 /* Mark this CPU absent */
434 set_cpu_present(cpu, 0);
435 + rcu_report_dead(cpu);
436
437 #ifdef CONFIG_HOTPLUG_CPU
438 update_cpu_boot_status(CPU_KILL_ME);
439 diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c
440 index a95a894aceaf1..f0c8303371047 100644
441 --- a/arch/mips/alchemy/common/clock.c
442 +++ b/arch/mips/alchemy/common/clock.c
443 @@ -152,6 +152,7 @@ static struct clk __init *alchemy_clk_setup_cpu(const char *parent_name,
444 {
445 struct clk_init_data id;
446 struct clk_hw *h;
447 + struct clk *clk;
448
449 h = kzalloc(sizeof(*h), GFP_KERNEL);
450 if (!h)
451 @@ -164,7 +165,13 @@ static struct clk __init *alchemy_clk_setup_cpu(const char *parent_name,
452 id.ops = &alchemy_clkops_cpu;
453 h->init = &id;
454
455 - return clk_register(NULL, h);
456 + clk = clk_register(NULL, h);
457 + if (IS_ERR(clk)) {
458 + pr_err("failed to register clock\n");
459 + kfree(h);
460 + }
461 +
462 + return clk;
463 }
464
465 /* AUXPLLs ************************************************************/
466 diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
467 index c13e46ced4252..60046445122b3 100644
468 --- a/arch/mips/mm/tlb-r4k.c
469 +++ b/arch/mips/mm/tlb-r4k.c
470 @@ -437,6 +437,7 @@ int has_transparent_hugepage(void)
471 }
472 return mask == PM_HUGE_MASK;
473 }
474 +EXPORT_SYMBOL(has_transparent_hugepage);
475
476 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
477
478 diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
479 index 996e447ead3a6..b83bddf35e068 100644
480 --- a/arch/s390/kernel/perf_cpum_sf.c
481 +++ b/arch/s390/kernel/perf_cpum_sf.c
482 @@ -2217,4 +2217,4 @@ out:
483 }
484
485 arch_initcall(init_cpum_sampling_pmu);
486 -core_param(cpum_sfb_size, CPUM_SF_MAX_SDB, sfb_size, 0640);
487 +core_param(cpum_sfb_size, CPUM_SF_MAX_SDB, sfb_size, 0644);
488 diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
489 index ce799cfe9434e..b224d4dae2ffb 100644
490 --- a/arch/x86/kernel/cpu/microcode/intel.c
491 +++ b/arch/x86/kernel/cpu/microcode/intel.c
492 @@ -100,53 +100,6 @@ static int has_newer_microcode(void *mc, unsigned int csig, int cpf, int new_rev
493 return find_matching_signature(mc, csig, cpf);
494 }
495
496 -/*
497 - * Given CPU signature and a microcode patch, this function finds if the
498 - * microcode patch has matching family and model with the CPU.
499 - *
500 - * %true - if there's a match
501 - * %false - otherwise
502 - */
503 -static bool microcode_matches(struct microcode_header_intel *mc_header,
504 - unsigned long sig)
505 -{
506 - unsigned long total_size = get_totalsize(mc_header);
507 - unsigned long data_size = get_datasize(mc_header);
508 - struct extended_sigtable *ext_header;
509 - unsigned int fam_ucode, model_ucode;
510 - struct extended_signature *ext_sig;
511 - unsigned int fam, model;
512 - int ext_sigcount, i;
513 -
514 - fam = x86_family(sig);
515 - model = x86_model(sig);
516 -
517 - fam_ucode = x86_family(mc_header->sig);
518 - model_ucode = x86_model(mc_header->sig);
519 -
520 - if (fam == fam_ucode && model == model_ucode)
521 - return true;
522 -
523 - /* Look for ext. headers: */
524 - if (total_size <= data_size + MC_HEADER_SIZE)
525 - return false;
526 -
527 - ext_header = (void *) mc_header + data_size + MC_HEADER_SIZE;
528 - ext_sig = (void *)ext_header + EXT_HEADER_SIZE;
529 - ext_sigcount = ext_header->count;
530 -
531 - for (i = 0; i < ext_sigcount; i++) {
532 - fam_ucode = x86_family(ext_sig->sig);
533 - model_ucode = x86_model(ext_sig->sig);
534 -
535 - if (fam == fam_ucode && model == model_ucode)
536 - return true;
537 -
538 - ext_sig++;
539 - }
540 - return false;
541 -}
542 -
543 static struct ucode_patch *memdup_patch(void *data, unsigned int size)
544 {
545 struct ucode_patch *p;
546 @@ -164,7 +117,7 @@ static struct ucode_patch *memdup_patch(void *data, unsigned int size)
547 return p;
548 }
549
550 -static void save_microcode_patch(void *data, unsigned int size)
551 +static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigned int size)
552 {
553 struct microcode_header_intel *mc_hdr, *mc_saved_hdr;
554 struct ucode_patch *iter, *tmp, *p = NULL;
555 @@ -210,6 +163,9 @@ static void save_microcode_patch(void *data, unsigned int size)
556 if (!p)
557 return;
558
559 + if (!find_matching_signature(p->data, uci->cpu_sig.sig, uci->cpu_sig.pf))
560 + return;
561 +
562 /*
563 * Save for early loading. On 32-bit, that needs to be a physical
564 * address as the APs are running from physical addresses, before
565 @@ -344,13 +300,14 @@ scan_microcode(void *data, size_t size, struct ucode_cpu_info *uci, bool save)
566
567 size -= mc_size;
568
569 - if (!microcode_matches(mc_header, uci->cpu_sig.sig)) {
570 + if (!find_matching_signature(data, uci->cpu_sig.sig,
571 + uci->cpu_sig.pf)) {
572 data += mc_size;
573 continue;
574 }
575
576 if (save) {
577 - save_microcode_patch(data, mc_size);
578 + save_microcode_patch(uci, data, mc_size);
579 goto next;
580 }
581
582 @@ -483,14 +440,14 @@ static void show_saved_mc(void)
583 * Save this microcode patch. It will be loaded early when a CPU is
584 * hot-added or resumes.
585 */
586 -static void save_mc_for_early(u8 *mc, unsigned int size)
587 +static void save_mc_for_early(struct ucode_cpu_info *uci, u8 *mc, unsigned int size)
588 {
589 /* Synchronization during CPU hotplug. */
590 static DEFINE_MUTEX(x86_cpu_microcode_mutex);
591
592 mutex_lock(&x86_cpu_microcode_mutex);
593
594 - save_microcode_patch(mc, size);
595 + save_microcode_patch(uci, mc, size);
596 show_saved_mc();
597
598 mutex_unlock(&x86_cpu_microcode_mutex);
599 @@ -934,7 +891,7 @@ static enum ucode_state generic_load_microcode(int cpu, struct iov_iter *iter)
600 * permanent memory. So it will be loaded early when a CPU is hot added
601 * or resumes.
602 */
603 - save_mc_for_early(new_mc, new_mc_size);
604 + save_mc_for_early(uci, new_mc, new_mc_size);
605
606 pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n",
607 cpu, new_rev, uci->cpu_sig.rev);
608 diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
609 index a49fe1dcb47e8..bded81591ad95 100644
610 --- a/arch/x86/kernel/tboot.c
611 +++ b/arch/x86/kernel/tboot.c
612 @@ -512,9 +512,6 @@ int tboot_force_iommu(void)
613 if (!tboot_enabled())
614 return 0;
615
616 - if (intel_iommu_tboot_noforce)
617 - return 1;
618 -
619 if (no_iommu || swiotlb || dmar_disabled)
620 pr_warning("Forcing Intel-IOMMU to enabled\n");
621
622 diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
623 index e39c930cfbd1e..5283978181103 100644
624 --- a/arch/x86/platform/efi/efi_64.c
625 +++ b/arch/x86/platform/efi/efi_64.c
626 @@ -217,28 +217,30 @@ int __init efi_alloc_page_tables(void)
627 gfp_mask = GFP_KERNEL | __GFP_ZERO;
628 efi_pgd = (pgd_t *)__get_free_pages(gfp_mask, PGD_ALLOCATION_ORDER);
629 if (!efi_pgd)
630 - return -ENOMEM;
631 + goto fail;
632
633 pgd = efi_pgd + pgd_index(EFI_VA_END);
634 p4d = p4d_alloc(&init_mm, pgd, EFI_VA_END);
635 - if (!p4d) {
636 - free_page((unsigned long)efi_pgd);
637 - return -ENOMEM;
638 - }
639 + if (!p4d)
640 + goto free_pgd;
641
642 pud = pud_alloc(&init_mm, p4d, EFI_VA_END);
643 - if (!pud) {
644 - if (pgtable_l5_enabled())
645 - free_page((unsigned long) pgd_page_vaddr(*pgd));
646 - free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER);
647 - return -ENOMEM;
648 - }
649 + if (!pud)
650 + goto free_p4d;
651
652 efi_mm.pgd = efi_pgd;
653 mm_init_cpumask(&efi_mm);
654 init_new_context(NULL, &efi_mm);
655
656 return 0;
657 +
658 +free_p4d:
659 + if (pgtable_l5_enabled())
660 + free_page((unsigned long)pgd_page_vaddr(*pgd));
661 +free_pgd:
662 + free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER);
663 +fail:
664 + return -ENOMEM;
665 }
666
667 /*
668 diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
669 index 3f7fe5a8c286d..359c7bd01f146 100644
670 --- a/arch/xtensa/include/asm/pgtable.h
671 +++ b/arch/xtensa/include/asm/pgtable.h
672 @@ -70,7 +70,7 @@
673 */
674 #define VMALLOC_START (XCHAL_KSEG_CACHED_VADDR - 0x10000000)
675 #define VMALLOC_END (VMALLOC_START + 0x07FEFFFF)
676 -#define TLBTEMP_BASE_1 (VMALLOC_END + 1)
677 +#define TLBTEMP_BASE_1 (VMALLOC_START + 0x08000000)
678 #define TLBTEMP_BASE_2 (TLBTEMP_BASE_1 + DCACHE_WAY_SIZE)
679 #if 2 * DCACHE_WAY_SIZE > ICACHE_WAY_SIZE
680 #define TLBTEMP_SIZE (2 * DCACHE_WAY_SIZE)
681 diff --git a/arch/xtensa/mm/cache.c b/arch/xtensa/mm/cache.c
682 index b27359e2a464c..f769f3f66729d 100644
683 --- a/arch/xtensa/mm/cache.c
684 +++ b/arch/xtensa/mm/cache.c
685 @@ -71,8 +71,10 @@ static inline void kmap_invalidate_coherent(struct page *page,
686 kvaddr = TLBTEMP_BASE_1 +
687 (page_to_phys(page) & DCACHE_ALIAS_MASK);
688
689 + preempt_disable();
690 __invalidate_dcache_page_alias(kvaddr,
691 page_to_phys(page));
692 + preempt_enable();
693 }
694 }
695 }
696 @@ -157,6 +159,7 @@ void flush_dcache_page(struct page *page)
697 if (!alias && !mapping)
698 return;
699
700 + preempt_disable();
701 virt = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK);
702 __flush_invalidate_dcache_page_alias(virt, phys);
703
704 @@ -167,6 +170,7 @@ void flush_dcache_page(struct page *page)
705
706 if (mapping)
707 __invalidate_icache_page_alias(virt, phys);
708 + preempt_enable();
709 }
710
711 /* There shouldn't be an entry in the cache for this page anymore. */
712 @@ -200,8 +204,10 @@ void local_flush_cache_page(struct vm_area_struct *vma, unsigned long address,
713 unsigned long phys = page_to_phys(pfn_to_page(pfn));
714 unsigned long virt = TLBTEMP_BASE_1 + (address & DCACHE_ALIAS_MASK);
715
716 + preempt_disable();
717 __flush_invalidate_dcache_page_alias(virt, phys);
718 __invalidate_icache_page_alias(virt, phys);
719 + preempt_enable();
720 }
721 EXPORT_SYMBOL(local_flush_cache_page);
722
723 @@ -228,11 +234,13 @@ update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t *ptep)
724 unsigned long phys = page_to_phys(page);
725 unsigned long tmp;
726
727 + preempt_disable();
728 tmp = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK);
729 __flush_invalidate_dcache_page_alias(tmp, phys);
730 tmp = TLBTEMP_BASE_1 + (addr & DCACHE_ALIAS_MASK);
731 __flush_invalidate_dcache_page_alias(tmp, phys);
732 __invalidate_icache_page_alias(tmp, phys);
733 + preempt_enable();
734
735 clear_bit(PG_arch_1, &page->flags);
736 }
737 @@ -266,7 +274,9 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
738
739 if (alias) {
740 unsigned long t = TLBTEMP_BASE_1 + (vaddr & DCACHE_ALIAS_MASK);
741 + preempt_disable();
742 __flush_invalidate_dcache_page_alias(t, phys);
743 + preempt_enable();
744 }
745
746 /* Copy data */
747 @@ -281,9 +291,11 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
748 if (alias) {
749 unsigned long t = TLBTEMP_BASE_1 + (vaddr & DCACHE_ALIAS_MASK);
750
751 + preempt_disable();
752 __flush_invalidate_dcache_range((unsigned long) dst, len);
753 if ((vma->vm_flags & VM_EXEC) != 0)
754 __invalidate_icache_page_alias(t, phys);
755 + preempt_enable();
756
757 } else if ((vma->vm_flags & VM_EXEC) != 0) {
758 __flush_dcache_range((unsigned long)dst,len);
759 @@ -305,7 +317,9 @@ extern void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
760
761 if (alias) {
762 unsigned long t = TLBTEMP_BASE_1 + (vaddr & DCACHE_ALIAS_MASK);
763 + preempt_disable();
764 __flush_invalidate_dcache_page_alias(t, phys);
765 + preempt_enable();
766 }
767
768 memcpy(dst, src, len);
769 diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
770 index 690bfe67e643d..ee7a7da276ddf 100644
771 --- a/drivers/acpi/button.c
772 +++ b/drivers/acpi/button.c
773 @@ -85,7 +85,18 @@ static const struct dmi_system_id lid_blacklst[] = {
774 */
775 .matches = {
776 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
777 - DMI_MATCH(DMI_PRODUCT_NAME, "E2215T MD60198"),
778 + DMI_MATCH(DMI_PRODUCT_NAME, "E2215T"),
779 + },
780 + .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
781 + },
782 + {
783 + /*
784 + * Medion Akoya E2228T, notification of the LID device only
785 + * happens on close, not on open and _LID always returns closed.
786 + */
787 + .matches = {
788 + DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
789 + DMI_MATCH(DMI_PRODUCT_NAME, "E2228T"),
790 },
791 .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
792 },
793 diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
794 index 8db8c0fb5e2da..bb9835c626415 100644
795 --- a/drivers/atm/nicstar.c
796 +++ b/drivers/atm/nicstar.c
797 @@ -1706,6 +1706,8 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
798
799 if (push_scqe(card, vc, scq, &scqe, skb) != 0) {
800 atomic_inc(&vcc->stats->tx_err);
801 + dma_unmap_single(&card->pcidev->dev, NS_PRV_DMA(skb), skb->len,
802 + DMA_TO_DEVICE);
803 dev_kfree_skb_any(skb);
804 return -EIO;
805 }
806 diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c b/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c
807 index 5db29bf582d31..70370b282f91a 100644
808 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c
809 +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c
810 @@ -299,8 +299,8 @@ irq_source_info_dcn20[DAL_IRQ_SOURCES_NUMBER] = {
811 pflip_int_entry(1),
812 pflip_int_entry(2),
813 pflip_int_entry(3),
814 - [DC_IRQ_SOURCE_PFLIP5] = dummy_irq_entry(),
815 - [DC_IRQ_SOURCE_PFLIP6] = dummy_irq_entry(),
816 + pflip_int_entry(4),
817 + pflip_int_entry(5),
818 [DC_IRQ_SOURCE_PFLIP_UNDERLAY0] = dummy_irq_entry(),
819 gpio_pad_int_entry(0),
820 gpio_pad_int_entry(1),
821 diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
822 index ae31836aa4ee4..4e1c228b9e999 100644
823 --- a/drivers/gpu/drm/i915/display/intel_display.c
824 +++ b/drivers/gpu/drm/i915/display/intel_display.c
825 @@ -11893,10 +11893,11 @@ compute_sink_pipe_bpp(const struct drm_connector_state *conn_state,
826 case 10 ... 11:
827 bpp = 10 * 3;
828 break;
829 - case 12:
830 + case 12 ... 16:
831 bpp = 12 * 3;
832 break;
833 default:
834 + MISSING_CASE(conn_state->max_bpc);
835 return -EINVAL;
836 }
837
838 diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
839 index a44dca4b0219e..12fe241956213 100644
840 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
841 +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
842 @@ -209,6 +209,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
843 phy_node = of_parse_phandle(dev->of_node, "phys", 0);
844 if (!phy_node) {
845 dev_err(dev, "Can't found PHY phandle\n");
846 + ret = -EINVAL;
847 goto err_disable_clk_tmds;
848 }
849
850 diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
851 index bb50d6e7745bc..54d811fdcdb44 100644
852 --- a/drivers/hid/hid-logitech-dj.c
853 +++ b/drivers/hid/hid-logitech-dj.c
854 @@ -328,7 +328,7 @@ static const char mse_bluetooth_descriptor[] = {
855 0x25, 0x01, /* LOGICAL_MAX (1) */
856 0x75, 0x01, /* REPORT_SIZE (1) */
857 0x95, 0x04, /* REPORT_COUNT (4) */
858 - 0x81, 0x06, /* INPUT */
859 + 0x81, 0x02, /* INPUT (Data,Var,Abs) */
860 0xC0, /* END_COLLECTION */
861 0xC0, /* END_COLLECTION */
862 };
863 @@ -866,11 +866,24 @@ static void logi_dj_recv_queue_notification(struct dj_receiver_dev *djrcv_dev,
864 schedule_work(&djrcv_dev->work);
865 }
866
867 +/*
868 + * Some quad/bluetooth keyboards have a builtin touchpad in this case we see
869 + * only 1 paired device with a device_type of REPORT_TYPE_KEYBOARD. For the
870 + * touchpad to work we must also forward mouse input reports to the dj_hiddev
871 + * created for the keyboard (instead of forwarding them to a second paired
872 + * device with a device_type of REPORT_TYPE_MOUSE as we normally would).
873 + */
874 +static const u16 kbd_builtin_touchpad_ids[] = {
875 + 0xb309, /* Dinovo Edge */
876 + 0xb30c, /* Dinovo Mini */
877 +};
878 +
879 static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
880 struct hidpp_event *hidpp_report,
881 struct dj_workitem *workitem)
882 {
883 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
884 + int i, id;
885
886 workitem->type = WORKITEM_TYPE_PAIRED;
887 workitem->device_type = hidpp_report->params[HIDPP_PARAM_DEVICE_INFO] &
888 @@ -882,6 +895,13 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
889 workitem->reports_supported |= STD_KEYBOARD | MULTIMEDIA |
890 POWER_KEYS | MEDIA_CENTER |
891 HIDPP;
892 + id = (workitem->quad_id_msb << 8) | workitem->quad_id_lsb;
893 + for (i = 0; i < ARRAY_SIZE(kbd_builtin_touchpad_ids); i++) {
894 + if (id == kbd_builtin_touchpad_ids[i]) {
895 + workitem->reports_supported |= STD_MOUSE;
896 + break;
897 + }
898 + }
899 break;
900 case REPORT_TYPE_MOUSE:
901 workitem->reports_supported |= STD_MOUSE | HIDPP;
902 diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
903 index 60cf806062821..e49d36de07968 100644
904 --- a/drivers/hid/hid-logitech-hidpp.c
905 +++ b/drivers/hid/hid-logitech-hidpp.c
906 @@ -88,6 +88,8 @@ MODULE_PARM_DESC(disable_tap_to_click,
907 #define HIDPP_CAPABILITY_BATTERY_MILEAGE BIT(2)
908 #define HIDPP_CAPABILITY_BATTERY_LEVEL_STATUS BIT(3)
909
910 +#define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c))
911 +
912 /*
913 * There are two hidpp protocols in use, the first version hidpp10 is known
914 * as register access protocol or RAP, the second version hidpp20 is known as
915 @@ -2768,6 +2770,26 @@ static int g920_get_config(struct hidpp_device *hidpp,
916 return g920_ff_set_autocenter(hidpp, data);
917 }
918
919 +/* -------------------------------------------------------------------------- */
920 +/* Logitech Dinovo Mini keyboard with builtin touchpad */
921 +/* -------------------------------------------------------------------------- */
922 +#define DINOVO_MINI_PRODUCT_ID 0xb30c
923 +
924 +static int lg_dinovo_input_mapping(struct hid_device *hdev, struct hid_input *hi,
925 + struct hid_field *field, struct hid_usage *usage,
926 + unsigned long **bit, int *max)
927 +{
928 + if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
929 + return 0;
930 +
931 + switch (usage->hid & HID_USAGE) {
932 + case 0x00d: lg_map_key_clear(KEY_MEDIA); break;
933 + default:
934 + return 0;
935 + }
936 + return 1;
937 +}
938 +
939 /* -------------------------------------------------------------------------- */
940 /* HID++1.0 devices which use HID++ reports for their wheels */
941 /* -------------------------------------------------------------------------- */
942 @@ -3003,6 +3025,9 @@ static int hidpp_input_mapping(struct hid_device *hdev, struct hid_input *hi,
943 field->application != HID_GD_MOUSE)
944 return m560_input_mapping(hdev, hi, field, usage, bit, max);
945
946 + if (hdev->product == DINOVO_MINI_PRODUCT_ID)
947 + return lg_dinovo_input_mapping(hdev, hi, field, usage, bit, max);
948 +
949 return 0;
950 }
951
952 @@ -3741,6 +3766,7 @@ static const struct hid_device_id hidpp_devices[] = {
953 LDJ_DEVICE(0x405e), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 },
954 { /* Mouse Logitech MX Anywhere 2 */
955 LDJ_DEVICE(0x404a), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 },
956 + { LDJ_DEVICE(0x4072), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 },
957 { LDJ_DEVICE(0xb013), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 },
958 { LDJ_DEVICE(0xb018), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 },
959 { LDJ_DEVICE(0xb01f), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 },
960 diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
961 index d6320022af150..f849a1a89fb4b 100644
962 --- a/drivers/hv/hv.c
963 +++ b/drivers/hv/hv.c
964 @@ -251,9 +251,13 @@ int hv_synic_cleanup(unsigned int cpu)
965
966 /*
967 * Hyper-V does not provide a way to change the connect CPU once
968 - * it is set; we must prevent the connect CPU from going offline.
969 + * it is set; we must prevent the connect CPU from going offline
970 + * while the VM is running normally. But in the panic or kexec()
971 + * path where the vmbus is already disconnected, the CPU must be
972 + * allowed to shut down.
973 */
974 - if (cpu == VMBUS_CONNECT_CPU)
975 + if (cpu == VMBUS_CONNECT_CPU &&
976 + vmbus_connection.conn_state == CONNECTED)
977 return -EBUSY;
978
979 /*
980 diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
981 index 42ffd2e5182d5..c88ce77fe6763 100644
982 --- a/drivers/hwmon/pwm-fan.c
983 +++ b/drivers/hwmon/pwm-fan.c
984 @@ -54,16 +54,18 @@ static irqreturn_t pulse_handler(int irq, void *dev_id)
985 static void sample_timer(struct timer_list *t)
986 {
987 struct pwm_fan_ctx *ctx = from_timer(ctx, t, rpm_timer);
988 + unsigned int delta = ktime_ms_delta(ktime_get(), ctx->sample_start);
989 int pulses;
990 - u64 tmp;
991
992 - pulses = atomic_read(&ctx->pulses);
993 - atomic_sub(pulses, &ctx->pulses);
994 - tmp = (u64)pulses * ktime_ms_delta(ktime_get(), ctx->sample_start) * 60;
995 - do_div(tmp, ctx->pulses_per_revolution * 1000);
996 - ctx->rpm = tmp;
997 + if (delta) {
998 + pulses = atomic_read(&ctx->pulses);
999 + atomic_sub(pulses, &ctx->pulses);
1000 + ctx->rpm = (unsigned int)(pulses * 1000 * 60) /
1001 + (ctx->pulses_per_revolution * delta);
1002 +
1003 + ctx->sample_start = ktime_get();
1004 + }
1005
1006 - ctx->sample_start = ktime_get();
1007 mod_timer(&ctx->rpm_timer, jiffies + HZ);
1008 }
1009
1010 diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
1011 index fee535d6e45b0..da9452e811056 100644
1012 --- a/drivers/iio/accel/kxcjk-1013.c
1013 +++ b/drivers/iio/accel/kxcjk-1013.c
1014 @@ -126,6 +126,12 @@ enum kx_chipset {
1015 KX_MAX_CHIPS /* this must be last */
1016 };
1017
1018 +enum kx_acpi_type {
1019 + ACPI_GENERIC,
1020 + ACPI_SMO8500,
1021 + ACPI_KIOX010A,
1022 +};
1023 +
1024 struct kxcjk1013_data {
1025 struct i2c_client *client;
1026 struct iio_trigger *dready_trig;
1027 @@ -142,7 +148,7 @@ struct kxcjk1013_data {
1028 bool motion_trigger_on;
1029 int64_t timestamp;
1030 enum kx_chipset chipset;
1031 - bool is_smo8500_device;
1032 + enum kx_acpi_type acpi_type;
1033 };
1034
1035 enum kxcjk1013_axis {
1036 @@ -269,6 +275,32 @@ static const struct {
1037 {19163, 1, 0},
1038 {38326, 0, 1} };
1039
1040 +#ifdef CONFIG_ACPI
1041 +enum kiox010a_fn_index {
1042 + KIOX010A_SET_LAPTOP_MODE = 1,
1043 + KIOX010A_SET_TABLET_MODE = 2,
1044 +};
1045 +
1046 +static int kiox010a_dsm(struct device *dev, int fn_index)
1047 +{
1048 + acpi_handle handle = ACPI_HANDLE(dev);
1049 + guid_t kiox010a_dsm_guid;
1050 + union acpi_object *obj;
1051 +
1052 + if (!handle)
1053 + return -ENODEV;
1054 +
1055 + guid_parse("1f339696-d475-4e26-8cad-2e9f8e6d7a91", &kiox010a_dsm_guid);
1056 +
1057 + obj = acpi_evaluate_dsm(handle, &kiox010a_dsm_guid, 1, fn_index, NULL);
1058 + if (!obj)
1059 + return -EIO;
1060 +
1061 + ACPI_FREE(obj);
1062 + return 0;
1063 +}
1064 +#endif
1065 +
1066 static int kxcjk1013_set_mode(struct kxcjk1013_data *data,
1067 enum kxcjk1013_mode mode)
1068 {
1069 @@ -346,6 +378,13 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *data)
1070 {
1071 int ret;
1072
1073 +#ifdef CONFIG_ACPI
1074 + if (data->acpi_type == ACPI_KIOX010A) {
1075 + /* Make sure the kbd and touchpad on 2-in-1s using 2 KXCJ91008-s work */
1076 + kiox010a_dsm(&data->client->dev, KIOX010A_SET_LAPTOP_MODE);
1077 + }
1078 +#endif
1079 +
1080 ret = i2c_smbus_read_byte_data(data->client, KXCJK1013_REG_WHO_AM_I);
1081 if (ret < 0) {
1082 dev_err(&data->client->dev, "Error reading who_am_i\n");
1083 @@ -1233,7 +1272,7 @@ static irqreturn_t kxcjk1013_data_rdy_trig_poll(int irq, void *private)
1084
1085 static const char *kxcjk1013_match_acpi_device(struct device *dev,
1086 enum kx_chipset *chipset,
1087 - bool *is_smo8500_device)
1088 + enum kx_acpi_type *acpi_type)
1089 {
1090 const struct acpi_device_id *id;
1091
1092 @@ -1242,7 +1281,9 @@ static const char *kxcjk1013_match_acpi_device(struct device *dev,
1093 return NULL;
1094
1095 if (strcmp(id->id, "SMO8500") == 0)
1096 - *is_smo8500_device = true;
1097 + *acpi_type = ACPI_SMO8500;
1098 + else if (strcmp(id->id, "KIOX010A") == 0)
1099 + *acpi_type = ACPI_KIOX010A;
1100
1101 *chipset = (enum kx_chipset)id->driver_data;
1102
1103 @@ -1278,7 +1319,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
1104 } else if (ACPI_HANDLE(&client->dev)) {
1105 name = kxcjk1013_match_acpi_device(&client->dev,
1106 &data->chipset,
1107 - &data->is_smo8500_device);
1108 + &data->acpi_type);
1109 } else
1110 return -ENODEV;
1111
1112 @@ -1296,7 +1337,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
1113 indio_dev->modes = INDIO_DIRECT_MODE;
1114 indio_dev->info = &kxcjk1013_info;
1115
1116 - if (client->irq > 0 && !data->is_smo8500_device) {
1117 + if (client->irq > 0 && data->acpi_type != ACPI_SMO8500) {
1118 ret = devm_request_threaded_irq(&client->dev, client->irq,
1119 kxcjk1013_data_rdy_trig_poll,
1120 kxcjk1013_event_handler,
1121 diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
1122 index 7bbb64ca3b324..2449d91e47665 100644
1123 --- a/drivers/iio/adc/mt6577_auxadc.c
1124 +++ b/drivers/iio/adc/mt6577_auxadc.c
1125 @@ -9,9 +9,9 @@
1126 #include <linux/err.h>
1127 #include <linux/kernel.h>
1128 #include <linux/module.h>
1129 -#include <linux/of.h>
1130 -#include <linux/of_device.h>
1131 +#include <linux/mod_devicetable.h>
1132 #include <linux/platform_device.h>
1133 +#include <linux/property.h>
1134 #include <linux/iopoll.h>
1135 #include <linux/io.h>
1136 #include <linux/iio/iio.h>
1137 @@ -279,6 +279,8 @@ static int mt6577_auxadc_probe(struct platform_device *pdev)
1138 goto err_disable_clk;
1139 }
1140
1141 + adc_dev->dev_comp = device_get_match_data(&pdev->dev);
1142 +
1143 mutex_init(&adc_dev->lock);
1144
1145 mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC,
1146 diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig
1147 index 4a1a883dc0612..42b64b85d06cf 100644
1148 --- a/drivers/iio/light/Kconfig
1149 +++ b/drivers/iio/light/Kconfig
1150 @@ -485,6 +485,7 @@ config VCNL4000
1151
1152 config VCNL4035
1153 tristate "VCNL4035 combined ALS and proximity sensor"
1154 + select IIO_BUFFER
1155 select IIO_TRIGGERED_BUFFER
1156 select REGMAP_I2C
1157 depends on I2C
1158 diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
1159 index b44b1c322ec82..786ee0e4e8855 100644
1160 --- a/drivers/infiniband/Kconfig
1161 +++ b/drivers/infiniband/Kconfig
1162 @@ -80,6 +80,9 @@ config INFINIBAND_ADDR_TRANS_CONFIGFS
1163 This allows the user to config the default GID type that the CM
1164 uses for each device, when initiaing new connections.
1165
1166 +config INFINIBAND_VIRT_DMA
1167 + def_bool !HIGHMEM
1168 +
1169 if INFINIBAND_USER_ACCESS || !INFINIBAND_USER_ACCESS
1170 source "drivers/infiniband/hw/mthca/Kconfig"
1171 source "drivers/infiniband/hw/qib/Kconfig"
1172 diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
1173 index 780fd2dfc07eb..10e67283b9db7 100644
1174 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
1175 +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
1176 @@ -266,7 +266,7 @@ static int pvrdma_register_device(struct pvrdma_dev *dev)
1177 }
1178 ret = ib_device_set_netdev(&dev->ib_dev, dev->netdev, 1);
1179 if (ret)
1180 - return ret;
1181 + goto err_srq_free;
1182 spin_lock_init(&dev->srq_tbl_lock);
1183 rdma_set_device_sysfs_group(&dev->ib_dev, &pvrdma_attr_group);
1184
1185 diff --git a/drivers/infiniband/sw/rdmavt/Kconfig b/drivers/infiniband/sw/rdmavt/Kconfig
1186 index 1f2759c72108a..a297f13eb6664 100644
1187 --- a/drivers/infiniband/sw/rdmavt/Kconfig
1188 +++ b/drivers/infiniband/sw/rdmavt/Kconfig
1189 @@ -1,7 +1,8 @@
1190 # SPDX-License-Identifier: GPL-2.0-only
1191 config INFINIBAND_RDMAVT
1192 tristate "RDMA verbs transport library"
1193 - depends on X86_64 && ARCH_DMA_ADDR_T_64BIT
1194 + depends on INFINIBAND_VIRT_DMA
1195 + depends on X86_64
1196 depends on PCI
1197 select DMA_VIRT_OPS
1198 ---help---
1199 diff --git a/drivers/infiniband/sw/rxe/Kconfig b/drivers/infiniband/sw/rxe/Kconfig
1200 index d9bcfe7405888..71a773f607bbc 100644
1201 --- a/drivers/infiniband/sw/rxe/Kconfig
1202 +++ b/drivers/infiniband/sw/rxe/Kconfig
1203 @@ -2,7 +2,7 @@
1204 config RDMA_RXE
1205 tristate "Software RDMA over Ethernet (RoCE) driver"
1206 depends on INET && PCI && INFINIBAND
1207 - depends on !64BIT || ARCH_DMA_ADDR_T_64BIT
1208 + depends on INFINIBAND_VIRT_DMA
1209 select NET_UDP_TUNNEL
1210 select CRYPTO_CRC32
1211 select DMA_VIRT_OPS
1212 diff --git a/drivers/infiniband/sw/siw/Kconfig b/drivers/infiniband/sw/siw/Kconfig
1213 index b622fc62f2cd6..3450ba5081df5 100644
1214 --- a/drivers/infiniband/sw/siw/Kconfig
1215 +++ b/drivers/infiniband/sw/siw/Kconfig
1216 @@ -1,6 +1,7 @@
1217 config RDMA_SIW
1218 tristate "Software RDMA over TCP/IP (iWARP) driver"
1219 depends on INET && INFINIBAND && LIBCRC32C
1220 + depends on INFINIBAND_VIRT_DMA
1221 select DMA_VIRT_OPS
1222 help
1223 This driver implements the iWARP RDMA transport over
1224 diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
1225 index 5fe92d4ba3f0c..4cc4e8ff42b33 100644
1226 --- a/drivers/input/misc/adxl34x.c
1227 +++ b/drivers/input/misc/adxl34x.c
1228 @@ -696,7 +696,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
1229 struct input_dev *input_dev;
1230 const struct adxl34x_platform_data *pdata;
1231 int err, range, i;
1232 - unsigned char revid;
1233 + int revid;
1234
1235 if (!irq) {
1236 dev_err(dev, "no IRQ?\n");
1237 diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
1238 index 46ad9090493bb..1e812a193ce7a 100644
1239 --- a/drivers/input/touchscreen/Kconfig
1240 +++ b/drivers/input/touchscreen/Kconfig
1241 @@ -96,6 +96,7 @@ config TOUCHSCREEN_AD7879_SPI
1242 config TOUCHSCREEN_ADC
1243 tristate "Generic ADC based resistive touchscreen"
1244 depends on IIO
1245 + select IIO_BUFFER
1246 select IIO_BUFFER_CB
1247 help
1248 Say Y here if you want to use the generic ADC
1249 diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
1250 index 1147626f0d253..984c7a6ea4fe8 100644
1251 --- a/drivers/iommu/intel-iommu.c
1252 +++ b/drivers/iommu/intel-iommu.c
1253 @@ -179,7 +179,7 @@ static int rwbf_quirk;
1254 * (used when kernel is launched w/ TXT)
1255 */
1256 static int force_on = 0;
1257 -int intel_iommu_tboot_noforce;
1258 +static int intel_iommu_tboot_noforce;
1259 static int no_platform_optin;
1260
1261 #define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry))
1262 @@ -4927,7 +4927,8 @@ int __init intel_iommu_init(void)
1263 * Intel IOMMU is required for a TXT/tboot launch or platform
1264 * opt in, so enforce that.
1265 */
1266 - force_on = tboot_force_iommu() || platform_optin_force_iommu();
1267 + force_on = (!intel_iommu_tboot_noforce && tboot_force_iommu()) ||
1268 + platform_optin_force_iommu();
1269
1270 if (iommu_init_mempool()) {
1271 if (force_on)
1272 diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
1273 index ddea4621cda10..afbccfceaaf85 100644
1274 --- a/drivers/mmc/host/sdhci-pci-core.c
1275 +++ b/drivers/mmc/host/sdhci-pci-core.c
1276 @@ -669,6 +669,15 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,
1277 }
1278 }
1279
1280 +static void sdhci_intel_set_uhs_signaling(struct sdhci_host *host,
1281 + unsigned int timing)
1282 +{
1283 + /* Set UHS timing to SDR25 for High Speed mode */
1284 + if (timing == MMC_TIMING_MMC_HS || timing == MMC_TIMING_SD_HS)
1285 + timing = MMC_TIMING_UHS_SDR25;
1286 + sdhci_set_uhs_signaling(host, timing);
1287 +}
1288 +
1289 #define INTEL_HS400_ES_REG 0x78
1290 #define INTEL_HS400_ES_BIT BIT(0)
1291
1292 @@ -725,7 +734,7 @@ static const struct sdhci_ops sdhci_intel_byt_ops = {
1293 .enable_dma = sdhci_pci_enable_dma,
1294 .set_bus_width = sdhci_set_bus_width,
1295 .reset = sdhci_reset,
1296 - .set_uhs_signaling = sdhci_set_uhs_signaling,
1297 + .set_uhs_signaling = sdhci_intel_set_uhs_signaling,
1298 .hw_reset = sdhci_pci_hw_reset,
1299 };
1300
1301 @@ -735,7 +744,7 @@ static const struct sdhci_ops sdhci_intel_glk_ops = {
1302 .enable_dma = sdhci_pci_enable_dma,
1303 .set_bus_width = sdhci_set_bus_width,
1304 .reset = sdhci_cqhci_reset,
1305 - .set_uhs_signaling = sdhci_set_uhs_signaling,
1306 + .set_uhs_signaling = sdhci_intel_set_uhs_signaling,
1307 .hw_reset = sdhci_pci_hw_reset,
1308 .irq = sdhci_cqhci_irq,
1309 };
1310 diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
1311 index 448d1548cca39..5b8791135de13 100644
1312 --- a/drivers/net/can/dev.c
1313 +++ b/drivers/net/can/dev.c
1314 @@ -567,7 +567,7 @@ static void can_restart(struct net_device *dev)
1315 }
1316 cf->can_id |= CAN_ERR_RESTARTED;
1317
1318 - netif_rx(skb);
1319 + netif_rx_ni(skb);
1320
1321 stats->rx_packets++;
1322 stats->rx_bytes += cf->can_dlc;
1323 diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
1324 index 130f3022d3396..1bd955e4c7d66 100644
1325 --- a/drivers/net/can/flexcan.c
1326 +++ b/drivers/net/can/flexcan.c
1327 @@ -614,8 +614,10 @@ static int flexcan_get_berr_counter(const struct net_device *dev,
1328 int err;
1329
1330 err = pm_runtime_get_sync(priv->dev);
1331 - if (err < 0)
1332 + if (err < 0) {
1333 + pm_runtime_put_noidle(priv->dev);
1334 return err;
1335 + }
1336
1337 err = __flexcan_get_berr_counter(dev, bec);
1338
1339 @@ -1200,14 +1202,10 @@ static int flexcan_chip_start(struct net_device *dev)
1340 priv->write(reg_mecr, &regs->mecr);
1341 }
1342
1343 - err = flexcan_transceiver_enable(priv);
1344 - if (err)
1345 - goto out_chip_disable;
1346 -
1347 /* synchronize with the can bus */
1348 err = flexcan_chip_unfreeze(priv);
1349 if (err)
1350 - goto out_transceiver_disable;
1351 + goto out_chip_disable;
1352
1353 priv->can.state = CAN_STATE_ERROR_ACTIVE;
1354
1355 @@ -1224,8 +1222,6 @@ static int flexcan_chip_start(struct net_device *dev)
1356
1357 return 0;
1358
1359 - out_transceiver_disable:
1360 - flexcan_transceiver_disable(priv);
1361 out_chip_disable:
1362 flexcan_chip_disable(priv);
1363 return err;
1364 @@ -1255,7 +1251,6 @@ static int __flexcan_chip_stop(struct net_device *dev, bool disable_on_error)
1365 priv->write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL,
1366 &regs->ctrl);
1367
1368 - flexcan_transceiver_disable(priv);
1369 priv->can.state = CAN_STATE_STOPPED;
1370
1371 return 0;
1372 @@ -1282,17 +1277,23 @@ static int flexcan_open(struct net_device *dev)
1373 int err;
1374
1375 err = pm_runtime_get_sync(priv->dev);
1376 - if (err < 0)
1377 + if (err < 0) {
1378 + pm_runtime_put_noidle(priv->dev);
1379 return err;
1380 + }
1381
1382 err = open_candev(dev);
1383 if (err)
1384 goto out_runtime_put;
1385
1386 - err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev);
1387 + err = flexcan_transceiver_enable(priv);
1388 if (err)
1389 goto out_close;
1390
1391 + err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev);
1392 + if (err)
1393 + goto out_transceiver_disable;
1394 +
1395 priv->mb_size = sizeof(struct flexcan_mb) + CAN_MAX_DLEN;
1396 priv->mb_count = (sizeof(priv->regs->mb[0]) / priv->mb_size) +
1397 (sizeof(priv->regs->mb[1]) / priv->mb_size);
1398 @@ -1348,6 +1349,8 @@ static int flexcan_open(struct net_device *dev)
1399 can_rx_offload_del(&priv->offload);
1400 out_free_irq:
1401 free_irq(dev->irq, dev);
1402 + out_transceiver_disable:
1403 + flexcan_transceiver_disable(priv);
1404 out_close:
1405 close_candev(dev);
1406 out_runtime_put:
1407 @@ -1366,6 +1369,7 @@ static int flexcan_close(struct net_device *dev)
1408
1409 can_rx_offload_del(&priv->offload);
1410 free_irq(dev->irq, dev);
1411 + flexcan_transceiver_disable(priv);
1412
1413 close_candev(dev);
1414 pm_runtime_put(priv->dev);
1415 diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c
1416 index 6f766918211a4..72acd1ba162d2 100644
1417 --- a/drivers/net/can/kvaser_pciefd.c
1418 +++ b/drivers/net/can/kvaser_pciefd.c
1419 @@ -287,12 +287,12 @@ struct kvaser_pciefd_tx_packet {
1420 static const struct can_bittiming_const kvaser_pciefd_bittiming_const = {
1421 .name = KVASER_PCIEFD_DRV_NAME,
1422 .tseg1_min = 1,
1423 - .tseg1_max = 255,
1424 + .tseg1_max = 512,
1425 .tseg2_min = 1,
1426 .tseg2_max = 32,
1427 .sjw_max = 16,
1428 .brp_min = 1,
1429 - .brp_max = 4096,
1430 + .brp_max = 8192,
1431 .brp_inc = 1,
1432 };
1433
1434 diff --git a/drivers/net/can/m_can/Kconfig b/drivers/net/can/m_can/Kconfig
1435 index 1ff0b7fe81d6a..c10932a7f1fe3 100644
1436 --- a/drivers/net/can/m_can/Kconfig
1437 +++ b/drivers/net/can/m_can/Kconfig
1438 @@ -16,7 +16,8 @@ config CAN_M_CAN_PLATFORM
1439
1440 config CAN_M_CAN_TCAN4X5X
1441 depends on CAN_M_CAN
1442 - depends on REGMAP_SPI
1443 + depends on SPI
1444 + select REGMAP_SPI
1445 tristate "TCAN4X5X M_CAN device"
1446 ---help---
1447 Say Y here if you want support for Texas Instruments TCAN4x5x
1448 diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
1449 index 562c8317e3aa8..246fa2657d744 100644
1450 --- a/drivers/net/can/m_can/m_can.c
1451 +++ b/drivers/net/can/m_can/m_can.c
1452 @@ -664,7 +664,7 @@ static int m_can_handle_state_change(struct net_device *dev,
1453 unsigned int ecr;
1454
1455 switch (new_state) {
1456 - case CAN_STATE_ERROR_ACTIVE:
1457 + case CAN_STATE_ERROR_WARNING:
1458 /* error warning state */
1459 cdev->can.can_stats.error_warning++;
1460 cdev->can.state = CAN_STATE_ERROR_WARNING;
1461 @@ -693,7 +693,7 @@ static int m_can_handle_state_change(struct net_device *dev,
1462 __m_can_get_berr_counter(dev, &bec);
1463
1464 switch (new_state) {
1465 - case CAN_STATE_ERROR_ACTIVE:
1466 + case CAN_STATE_ERROR_WARNING:
1467 /* error warning state */
1468 cf->can_id |= CAN_ERR_CRTL;
1469 cf->data[1] = (bec.txerr > bec.rxerr) ?
1470 @@ -913,6 +913,8 @@ static irqreturn_t m_can_isr(int irq, void *dev_id)
1471 struct net_device_stats *stats = &dev->stats;
1472 u32 ir;
1473
1474 + if (pm_runtime_suspended(cdev->dev))
1475 + return IRQ_NONE;
1476 ir = m_can_read(cdev, M_CAN_IR);
1477 if (!ir)
1478 return IRQ_NONE;
1479 @@ -1366,6 +1368,9 @@ static void m_can_stop(struct net_device *dev)
1480 /* disable all interrupts */
1481 m_can_disable_all_interrupts(cdev);
1482
1483 + /* Set init mode to disengage from the network */
1484 + m_can_config_endisable(cdev, true);
1485 +
1486 /* set the state as STOPPED */
1487 cdev->can.state = CAN_STATE_STOPPED;
1488 }
1489 @@ -1764,6 +1769,12 @@ out:
1490 }
1491 EXPORT_SYMBOL_GPL(m_can_class_allocate_dev);
1492
1493 +void m_can_class_free_dev(struct net_device *net)
1494 +{
1495 + free_candev(net);
1496 +}
1497 +EXPORT_SYMBOL_GPL(m_can_class_free_dev);
1498 +
1499 int m_can_class_register(struct m_can_classdev *m_can_dev)
1500 {
1501 int ret;
1502 diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h
1503 index 49f42b50627a1..b2699a7c99973 100644
1504 --- a/drivers/net/can/m_can/m_can.h
1505 +++ b/drivers/net/can/m_can/m_can.h
1506 @@ -99,6 +99,7 @@ struct m_can_classdev {
1507 };
1508
1509 struct m_can_classdev *m_can_class_allocate_dev(struct device *dev);
1510 +void m_can_class_free_dev(struct net_device *net);
1511 int m_can_class_register(struct m_can_classdev *cdev);
1512 void m_can_class_unregister(struct m_can_classdev *cdev);
1513 int m_can_class_get_clocks(struct m_can_classdev *cdev);
1514 diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c
1515 index b233756345f83..681bb861de05e 100644
1516 --- a/drivers/net/can/m_can/tcan4x5x.c
1517 +++ b/drivers/net/can/m_can/tcan4x5x.c
1518 @@ -467,6 +467,10 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
1519
1520 priv->regmap = devm_regmap_init(&spi->dev, &tcan4x5x_bus,
1521 &spi->dev, &tcan4x5x_regmap);
1522 + if (IS_ERR(priv->regmap)) {
1523 + ret = PTR_ERR(priv->regmap);
1524 + goto out_clk;
1525 + }
1526
1527 tcan4x5x_power_enable(priv->power, 1);
1528
1529 @@ -497,10 +501,10 @@ static int tcan4x5x_can_remove(struct spi_device *spi)
1530 {
1531 struct tcan4x5x_priv *priv = spi_get_drvdata(spi);
1532
1533 - tcan4x5x_power_enable(priv->power, 0);
1534 -
1535 m_can_class_unregister(priv->mcan_dev);
1536
1537 + tcan4x5x_power_enable(priv->power, 0);
1538 +
1539 return 0;
1540 }
1541
1542 diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
1543 index d3a7631eecaf2..d0a05fc5cc32f 100644
1544 --- a/drivers/net/can/ti_hecc.c
1545 +++ b/drivers/net/can/ti_hecc.c
1546 @@ -873,7 +873,8 @@ static int ti_hecc_probe(struct platform_device *pdev)
1547 priv->base = devm_ioremap_resource(&pdev->dev, res);
1548 if (IS_ERR(priv->base)) {
1549 dev_err(&pdev->dev, "hecc ioremap failed\n");
1550 - return PTR_ERR(priv->base);
1551 + err = PTR_ERR(priv->base);
1552 + goto probe_exit_candev;
1553 }
1554
1555 /* handle hecc-ram memory */
1556 @@ -886,7 +887,8 @@ static int ti_hecc_probe(struct platform_device *pdev)
1557 priv->hecc_ram = devm_ioremap_resource(&pdev->dev, res);
1558 if (IS_ERR(priv->hecc_ram)) {
1559 dev_err(&pdev->dev, "hecc-ram ioremap failed\n");
1560 - return PTR_ERR(priv->hecc_ram);
1561 + err = PTR_ERR(priv->hecc_ram);
1562 + goto probe_exit_candev;
1563 }
1564
1565 /* handle mbx memory */
1566 @@ -899,13 +901,14 @@ static int ti_hecc_probe(struct platform_device *pdev)
1567 priv->mbx = devm_ioremap_resource(&pdev->dev, res);
1568 if (IS_ERR(priv->mbx)) {
1569 dev_err(&pdev->dev, "mbx ioremap failed\n");
1570 - return PTR_ERR(priv->mbx);
1571 + err = PTR_ERR(priv->mbx);
1572 + goto probe_exit_candev;
1573 }
1574
1575 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1576 if (!irq) {
1577 dev_err(&pdev->dev, "No irq resource\n");
1578 - goto probe_exit;
1579 + goto probe_exit_candev;
1580 }
1581
1582 priv->ndev = ndev;
1583 @@ -969,7 +972,7 @@ probe_exit_release_clk:
1584 clk_put(priv->clk);
1585 probe_exit_candev:
1586 free_candev(ndev);
1587 -probe_exit:
1588 +
1589 return err;
1590 }
1591
1592 diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
1593 index 7ab87a7587545..218fadc911558 100644
1594 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
1595 +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
1596 @@ -367,7 +367,7 @@ static const struct can_bittiming_const kvaser_usb_hydra_kcan_bittiming_c = {
1597 .tseg2_max = 32,
1598 .sjw_max = 16,
1599 .brp_min = 1,
1600 - .brp_max = 4096,
1601 + .brp_max = 8192,
1602 .brp_inc = 1,
1603 };
1604
1605 diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c
1606 index 21faa2ec46327..8f785c199e220 100644
1607 --- a/drivers/net/can/usb/mcba_usb.c
1608 +++ b/drivers/net/can/usb/mcba_usb.c
1609 @@ -326,8 +326,6 @@ static netdev_tx_t mcba_usb_start_xmit(struct sk_buff *skb,
1610 if (!ctx)
1611 return NETDEV_TX_BUSY;
1612
1613 - can_put_echo_skb(skb, priv->netdev, ctx->ndx);
1614 -
1615 if (cf->can_id & CAN_EFF_FLAG) {
1616 /* SIDH | SIDL | EIDH | EIDL
1617 * 28 - 21 | 20 19 18 x x x 17 16 | 15 - 8 | 7 - 0
1618 @@ -357,6 +355,8 @@ static netdev_tx_t mcba_usb_start_xmit(struct sk_buff *skb,
1619 if (cf->can_id & CAN_RTR_FLAG)
1620 usb_msg.dlc |= MCBA_DLC_RTR_MASK;
1621
1622 + can_put_echo_skb(skb, priv->netdev, ctx->ndx);
1623 +
1624 err = mcba_usb_xmit(priv, (struct mcba_usb_msg *)&usb_msg, ctx);
1625 if (err)
1626 goto xmit_failed;
1627 diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
1628 index c844c6abe5fcd..f22089101cdda 100644
1629 --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
1630 +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
1631 @@ -156,7 +156,7 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time)
1632 if (time_ref->ts_dev_1 < time_ref->ts_dev_2) {
1633 /* case when event time (tsw) wraps */
1634 if (ts < time_ref->ts_dev_1)
1635 - delta_ts = 1 << time_ref->adapter->ts_used_bits;
1636 + delta_ts = BIT_ULL(time_ref->adapter->ts_used_bits);
1637
1638 /* Otherwise, sync time counter (ts_dev_2) has wrapped:
1639 * handle case when event time (tsn) hasn't.
1640 @@ -168,7 +168,7 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time)
1641 * tsn ts
1642 */
1643 } else if (time_ref->ts_dev_1 < ts) {
1644 - delta_ts = -(1 << time_ref->adapter->ts_used_bits);
1645 + delta_ts = -BIT_ULL(time_ref->adapter->ts_used_bits);
1646 }
1647
1648 /* add delay between last sync and event timestamps */
1649 diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
1650 index 636966e93517e..ef5d5cc529693 100644
1651 --- a/drivers/net/dsa/lantiq_gswip.c
1652 +++ b/drivers/net/dsa/lantiq_gswip.c
1653 @@ -26,6 +26,7 @@
1654 */
1655
1656 #include <linux/clk.h>
1657 +#include <linux/delay.h>
1658 #include <linux/etherdevice.h>
1659 #include <linux/firmware.h>
1660 #include <linux/if_bridge.h>
1661 @@ -1818,6 +1819,16 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv,
1662 i++;
1663 }
1664
1665 + /* The standalone PHY11G requires 300ms to be fully
1666 + * initialized and ready for any MDIO communication after being
1667 + * taken out of reset. For the SoC-internal GPHY variant there
1668 + * is no (known) documentation for the minimum time after a
1669 + * reset. Use the same value as for the standalone variant as
1670 + * some users have reported internal PHYs not being detected
1671 + * without any delay.
1672 + */
1673 + msleep(300);
1674 +
1675 return 0;
1676
1677 remove_gphy:
1678 diff --git a/drivers/net/dsa/mv88e6xxx/global1_vtu.c b/drivers/net/dsa/mv88e6xxx/global1_vtu.c
1679 index 33056a609e960..c51c01345223d 100644
1680 --- a/drivers/net/dsa/mv88e6xxx/global1_vtu.c
1681 +++ b/drivers/net/dsa/mv88e6xxx/global1_vtu.c
1682 @@ -125,11 +125,9 @@ static int mv88e6xxx_g1_vtu_vid_write(struct mv88e6xxx_chip *chip,
1683 * Offset 0x08: VTU/STU Data Register 2
1684 * Offset 0x09: VTU/STU Data Register 3
1685 */
1686 -
1687 -static int mv88e6185_g1_vtu_data_read(struct mv88e6xxx_chip *chip,
1688 - struct mv88e6xxx_vtu_entry *entry)
1689 +static int mv88e6185_g1_vtu_stu_data_read(struct mv88e6xxx_chip *chip,
1690 + u16 *regs)
1691 {
1692 - u16 regs[3];
1693 int i;
1694
1695 /* Read all 3 VTU/STU Data registers */
1696 @@ -142,12 +140,45 @@ static int mv88e6185_g1_vtu_data_read(struct mv88e6xxx_chip *chip,
1697 return err;
1698 }
1699
1700 - /* Extract MemberTag and PortState data */
1701 + return 0;
1702 +}
1703 +
1704 +static int mv88e6185_g1_vtu_data_read(struct mv88e6xxx_chip *chip,
1705 + struct mv88e6xxx_vtu_entry *entry)
1706 +{
1707 + u16 regs[3];
1708 + int err;
1709 + int i;
1710 +
1711 + err = mv88e6185_g1_vtu_stu_data_read(chip, regs);
1712 + if (err)
1713 + return err;
1714 +
1715 + /* Extract MemberTag data */
1716 for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) {
1717 unsigned int member_offset = (i % 4) * 4;
1718 - unsigned int state_offset = member_offset + 2;
1719
1720 entry->member[i] = (regs[i / 4] >> member_offset) & 0x3;
1721 + }
1722 +
1723 + return 0;
1724 +}
1725 +
1726 +static int mv88e6185_g1_stu_data_read(struct mv88e6xxx_chip *chip,
1727 + struct mv88e6xxx_vtu_entry *entry)
1728 +{
1729 + u16 regs[3];
1730 + int err;
1731 + int i;
1732 +
1733 + err = mv88e6185_g1_vtu_stu_data_read(chip, regs);
1734 + if (err)
1735 + return err;
1736 +
1737 + /* Extract PortState data */
1738 + for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) {
1739 + unsigned int state_offset = (i % 4) * 4 + 2;
1740 +
1741 entry->state[i] = (regs[i / 4] >> state_offset) & 0x3;
1742 }
1743
1744 @@ -349,6 +380,10 @@ int mv88e6185_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
1745 if (err)
1746 return err;
1747
1748 + err = mv88e6185_g1_stu_data_read(chip, entry);
1749 + if (err)
1750 + return err;
1751 +
1752 /* VTU DBNum[3:0] are located in VTU Operation 3:0
1753 * VTU DBNum[7:4] are located in VTU Operation 11:8
1754 */
1755 @@ -374,16 +409,20 @@ int mv88e6352_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
1756 return err;
1757
1758 if (entry->valid) {
1759 - /* Fetch (and mask) VLAN PortState data from the STU */
1760 - err = mv88e6xxx_g1_vtu_stu_get(chip, entry);
1761 + err = mv88e6185_g1_vtu_data_read(chip, entry);
1762 if (err)
1763 return err;
1764
1765 - err = mv88e6185_g1_vtu_data_read(chip, entry);
1766 + err = mv88e6xxx_g1_vtu_fid_read(chip, entry);
1767 if (err)
1768 return err;
1769
1770 - err = mv88e6xxx_g1_vtu_fid_read(chip, entry);
1771 + /* Fetch VLAN PortState data from the STU */
1772 + err = mv88e6xxx_g1_vtu_stu_get(chip, entry);
1773 + if (err)
1774 + return err;
1775 +
1776 + err = mv88e6185_g1_stu_data_read(chip, entry);
1777 if (err)
1778 return err;
1779 }
1780 diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
1781 index 1a7710c399d74..3e8bd454ec506 100644
1782 --- a/drivers/net/ethernet/broadcom/b44.c
1783 +++ b/drivers/net/ethernet/broadcom/b44.c
1784 @@ -2391,7 +2391,8 @@ static int b44_init_one(struct ssb_device *sdev,
1785 goto err_out_free_dev;
1786 }
1787
1788 - if (dma_set_mask_and_coherent(sdev->dma_dev, DMA_BIT_MASK(30))) {
1789 + err = dma_set_mask_and_coherent(sdev->dma_dev, DMA_BIT_MASK(30));
1790 + if (err) {
1791 dev_err(sdev->dev,
1792 "Required 30BIT DMA mask unsupported by the system\n");
1793 goto err_out_powerdown;
1794 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
1795 index 1d15ff08f176b..2118523782246 100644
1796 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
1797 +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
1798 @@ -2584,7 +2584,7 @@ static int bnxt_get_module_eeprom(struct net_device *dev,
1799 /* Read A2 portion of the EEPROM */
1800 if (length) {
1801 start -= ETH_MODULE_SFF_8436_LEN;
1802 - rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 1,
1803 + rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 0,
1804 start, length, data);
1805 }
1806 return rc;
1807 diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
1808 index 1fbc243fc3f4c..1aea22d2540fb 100644
1809 --- a/drivers/net/ethernet/faraday/ftgmac100.c
1810 +++ b/drivers/net/ethernet/faraday/ftgmac100.c
1811 @@ -1891,6 +1891,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
1812 return 0;
1813
1814 err_ncsi_dev:
1815 + if (priv->ndev)
1816 + ncsi_unregister_dev(priv->ndev);
1817 err_register_netdev:
1818 ftgmac100_destroy_mdio(netdev);
1819 err_setup_mdio:
1820 @@ -1911,6 +1913,8 @@ static int ftgmac100_remove(struct platform_device *pdev)
1821 netdev = platform_get_drvdata(pdev);
1822 priv = netdev_priv(netdev);
1823
1824 + if (priv->ndev)
1825 + ncsi_unregister_dev(priv->ndev);
1826 unregister_netdev(netdev);
1827
1828 clk_disable_unprepare(priv->clk);
1829 diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
1830 index f6ff9620a1377..f6cfec81ccc3b 100644
1831 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c
1832 +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
1833 @@ -1864,8 +1864,8 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param)
1834 #define INIT_HCA_LOG_RD_OFFSET (INIT_HCA_QPC_OFFSET + 0x77)
1835 #define INIT_HCA_MCAST_OFFSET 0x0c0
1836 #define INIT_HCA_MC_BASE_OFFSET (INIT_HCA_MCAST_OFFSET + 0x00)
1837 -#define INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x12)
1838 -#define INIT_HCA_LOG_MC_HASH_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x16)
1839 +#define INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x13)
1840 +#define INIT_HCA_LOG_MC_HASH_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x17)
1841 #define INIT_HCA_UC_STEERING_OFFSET (INIT_HCA_MCAST_OFFSET + 0x18)
1842 #define INIT_HCA_LOG_MC_TABLE_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x1b)
1843 #define INIT_HCA_DEVICE_MANAGED_FLOW_STEERING_EN 0x6
1844 @@ -1873,7 +1873,7 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param)
1845 #define INIT_HCA_DRIVER_VERSION_SZ 0x40
1846 #define INIT_HCA_FS_PARAM_OFFSET 0x1d0
1847 #define INIT_HCA_FS_BASE_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x00)
1848 -#define INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x12)
1849 +#define INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x13)
1850 #define INIT_HCA_FS_A0_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x18)
1851 #define INIT_HCA_FS_LOG_TABLE_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x1b)
1852 #define INIT_HCA_FS_ETH_BITS_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x21)
1853 diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.h b/drivers/net/ethernet/mellanox/mlx4/fw.h
1854 index 650ae08c71def..8f020f26ebf5f 100644
1855 --- a/drivers/net/ethernet/mellanox/mlx4/fw.h
1856 +++ b/drivers/net/ethernet/mellanox/mlx4/fw.h
1857 @@ -182,8 +182,8 @@ struct mlx4_init_hca_param {
1858 u64 cmpt_base;
1859 u64 mtt_base;
1860 u64 global_caps;
1861 - u16 log_mc_entry_sz;
1862 - u16 log_mc_hash_sz;
1863 + u8 log_mc_entry_sz;
1864 + u8 log_mc_hash_sz;
1865 u16 hca_core_clock; /* Internal Clock Frequency (in MHz) */
1866 u8 log_num_qps;
1867 u8 log_num_srqs;
1868 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
1869 index 8e6ab82019398..009d383d83f4b 100644
1870 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
1871 +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
1872 @@ -1592,6 +1592,10 @@ int mlx5_esw_modify_vport_rate(struct mlx5_eswitch *esw, u16 vport_num,
1873 struct mlx5_vport *vport;
1874
1875 vport = mlx5_eswitch_get_vport(esw, vport_num);
1876 +
1877 + if (!vport->qos.enabled)
1878 + return -EOPNOTSUPP;
1879 +
1880 MLX5_SET(scheduling_context, ctx, max_average_bw, rate_mbps);
1881
1882 return mlx5_modify_scheduling_element_cmd(esw->dev,
1883 @@ -2369,12 +2373,15 @@ static u32 calculate_vports_min_rate_divider(struct mlx5_eswitch *esw)
1884 max_guarantee = evport->info.min_rate;
1885 }
1886
1887 - return max_t(u32, max_guarantee / fw_max_bw_share, 1);
1888 + if (max_guarantee)
1889 + return max_t(u32, max_guarantee / fw_max_bw_share, 1);
1890 + return 0;
1891 }
1892
1893 -static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider)
1894 +static int normalize_vports_min_rate(struct mlx5_eswitch *esw)
1895 {
1896 u32 fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share);
1897 + u32 divider = calculate_vports_min_rate_divider(esw);
1898 struct mlx5_vport *evport;
1899 u32 vport_max_rate;
1900 u32 vport_min_rate;
1901 @@ -2387,9 +2394,9 @@ static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider)
1902 continue;
1903 vport_min_rate = evport->info.min_rate;
1904 vport_max_rate = evport->info.max_rate;
1905 - bw_share = MLX5_MIN_BW_SHARE;
1906 + bw_share = 0;
1907
1908 - if (vport_min_rate)
1909 + if (divider)
1910 bw_share = MLX5_RATE_TO_BW_SHARE(vport_min_rate,
1911 divider,
1912 fw_max_bw_share);
1913 @@ -2414,7 +2421,6 @@ int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, u16 vport,
1914 struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
1915 u32 fw_max_bw_share;
1916 u32 previous_min_rate;
1917 - u32 divider;
1918 bool min_rate_supported;
1919 bool max_rate_supported;
1920 int err = 0;
1921 @@ -2439,8 +2445,7 @@ int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, u16 vport,
1922
1923 previous_min_rate = evport->info.min_rate;
1924 evport->info.min_rate = min_rate;
1925 - divider = calculate_vports_min_rate_divider(esw);
1926 - err = normalize_vports_min_rate(esw, divider);
1927 + err = normalize_vports_min_rate(esw);
1928 if (err) {
1929 evport->info.min_rate = previous_min_rate;
1930 goto unlock;
1931 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
1932 index 16511f6485531..2eceb72f0f647 100644
1933 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
1934 +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
1935 @@ -496,6 +496,13 @@ static void del_sw_hw_rule(struct fs_node *node)
1936 goto out;
1937 }
1938
1939 + if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_PORT &&
1940 + --fte->dests_size) {
1941 + fte->modify_mask |= BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION);
1942 + fte->action.action &= ~MLX5_FLOW_CONTEXT_ACTION_ALLOW;
1943 + goto out;
1944 + }
1945 +
1946 if ((fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) &&
1947 --fte->dests_size) {
1948 fte->modify_mask |=
1949 diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
1950 index 8f0eec9fb17bd..2d39bade89e33 100644
1951 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c
1952 +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
1953 @@ -444,7 +444,8 @@ static void mlxsw_emad_trans_timeout_schedule(struct mlxsw_reg_trans *trans)
1954 if (trans->core->fw_flash_in_progress)
1955 timeout = msecs_to_jiffies(MLXSW_EMAD_TIMEOUT_DURING_FW_FLASH_MS);
1956
1957 - queue_delayed_work(trans->core->emad_wq, &trans->timeout_dw, timeout);
1958 + queue_delayed_work(trans->core->emad_wq, &trans->timeout_dw,
1959 + timeout << trans->retries);
1960 }
1961
1962 static int mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core,
1963 diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
1964 index b8e0e08b79de2..7526af27a59da 100644
1965 --- a/drivers/net/ethernet/microchip/lan743x_main.c
1966 +++ b/drivers/net/ethernet/microchip/lan743x_main.c
1967 @@ -145,7 +145,8 @@ static void lan743x_intr_software_isr(void *context)
1968
1969 int_sts = lan743x_csr_read(adapter, INT_STS);
1970 if (int_sts & INT_BIT_SW_GP_) {
1971 - lan743x_csr_write(adapter, INT_STS, INT_BIT_SW_GP_);
1972 + /* disable the interrupt to prevent repeated re-triggering */
1973 + lan743x_csr_write(adapter, INT_EN_CLR, INT_BIT_SW_GP_);
1974 intr->software_isr_flag = 1;
1975 }
1976 }
1977 @@ -1242,13 +1243,13 @@ clean_up_data_descriptor:
1978 goto clear_active;
1979
1980 if (!(buffer_info->flags & TX_BUFFER_INFO_FLAG_TIMESTAMP_REQUESTED)) {
1981 - dev_kfree_skb(buffer_info->skb);
1982 + dev_kfree_skb_any(buffer_info->skb);
1983 goto clear_skb;
1984 }
1985
1986 if (cleanup) {
1987 lan743x_ptp_unrequest_tx_timestamp(tx->adapter);
1988 - dev_kfree_skb(buffer_info->skb);
1989 + dev_kfree_skb_any(buffer_info->skb);
1990 } else {
1991 ignore_sync = (buffer_info->flags &
1992 TX_BUFFER_INFO_FLAG_IGNORE_SYNC) != 0;
1993 @@ -1558,7 +1559,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx,
1994 if (required_number_of_descriptors >
1995 lan743x_tx_get_avail_desc(tx)) {
1996 if (required_number_of_descriptors > (tx->ring_size - 1)) {
1997 - dev_kfree_skb(skb);
1998 + dev_kfree_skb_irq(skb);
1999 } else {
2000 /* save to overflow buffer */
2001 tx->overflow_skb = skb;
2002 @@ -1591,7 +1592,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx,
2003 start_frame_length,
2004 do_timestamp,
2005 skb->ip_summed == CHECKSUM_PARTIAL)) {
2006 - dev_kfree_skb(skb);
2007 + dev_kfree_skb_irq(skb);
2008 goto unlock;
2009 }
2010
2011 @@ -1610,7 +1611,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx,
2012 * frame assembler clean up was performed inside
2013 * lan743x_tx_frame_add_fragment
2014 */
2015 - dev_kfree_skb(skb);
2016 + dev_kfree_skb_irq(skb);
2017 goto unlock;
2018 }
2019 }
2020 diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
2021 index 2b3102a2fe5c9..9adbaccd0c5ed 100644
2022 --- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
2023 +++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
2024 @@ -2742,14 +2742,18 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
2025 iwarp_info->partial_fpdus = kcalloc((u16)p_hwfn->p_rdma_info->num_qps,
2026 sizeof(*iwarp_info->partial_fpdus),
2027 GFP_KERNEL);
2028 - if (!iwarp_info->partial_fpdus)
2029 + if (!iwarp_info->partial_fpdus) {
2030 + rc = -ENOMEM;
2031 goto err;
2032 + }
2033
2034 iwarp_info->max_num_partial_fpdus = (u16)p_hwfn->p_rdma_info->num_qps;
2035
2036 iwarp_info->mpa_intermediate_buf = kzalloc(buff_size, GFP_KERNEL);
2037 - if (!iwarp_info->mpa_intermediate_buf)
2038 + if (!iwarp_info->mpa_intermediate_buf) {
2039 + rc = -ENOMEM;
2040 goto err;
2041 + }
2042
2043 /* The mpa_bufs array serves for pending RX packets received on the
2044 * mpa ll2 that don't have place on the tx ring and require later
2045 @@ -2759,8 +2763,10 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
2046 iwarp_info->mpa_bufs = kcalloc(data.input.rx_num_desc,
2047 sizeof(*iwarp_info->mpa_bufs),
2048 GFP_KERNEL);
2049 - if (!iwarp_info->mpa_bufs)
2050 + if (!iwarp_info->mpa_bufs) {
2051 + rc = -ENOMEM;
2052 goto err;
2053 + }
2054
2055 INIT_LIST_HEAD(&iwarp_info->mpa_buf_pending_list);
2056 INIT_LIST_HEAD(&iwarp_info->mpa_buf_list);
2057 diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
2058 index cda5b0a9e9489..10286215092f6 100644
2059 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
2060 +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
2061 @@ -2251,7 +2251,8 @@ static int qlcnic_83xx_restart_hw(struct qlcnic_adapter *adapter)
2062
2063 /* Boot either flash image or firmware image from host file system */
2064 if (qlcnic_load_fw_file == 1) {
2065 - if (qlcnic_83xx_load_fw_image_from_host(adapter))
2066 + err = qlcnic_83xx_load_fw_image_from_host(adapter);
2067 + if (err)
2068 return err;
2069 } else {
2070 QLC_SHARED_REG_WR32(adapter, QLCNIC_FW_IMG_VALID,
2071 diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
2072 index 29a7bfa2584dc..3d7d3ab383f85 100644
2073 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
2074 +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
2075 @@ -188,6 +188,11 @@ rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb)
2076
2077 dev = skb->dev;
2078 port = rmnet_get_port_rcu(dev);
2079 + if (unlikely(!port)) {
2080 + atomic_long_inc(&skb->dev->rx_nohandler);
2081 + kfree_skb(skb);
2082 + goto done;
2083 + }
2084
2085 switch (port->rmnet_mode) {
2086 case RMNET_EPMODE_VND:
2087 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
2088 index e7b4d93e3f288..33eca554424a5 100644
2089 --- a/drivers/net/ethernet/ti/cpsw.c
2090 +++ b/drivers/net/ethernet/ti/cpsw.c
2091 @@ -2876,6 +2876,7 @@ static int cpsw_probe(struct platform_device *pdev)
2092 CPSW_MAX_QUEUES, CPSW_MAX_QUEUES);
2093 if (!ndev) {
2094 dev_err(dev, "error allocating net_device\n");
2095 + ret = -ENOMEM;
2096 goto clean_cpts;
2097 }
2098
2099 diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
2100 index fcb7a6b4cc02a..c7ec3d24eabc8 100644
2101 --- a/drivers/net/geneve.c
2102 +++ b/drivers/net/geneve.c
2103 @@ -221,8 +221,7 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs,
2104 if (ip_tunnel_collect_metadata() || gs->collect_md) {
2105 __be16 flags;
2106
2107 - flags = TUNNEL_KEY | TUNNEL_GENEVE_OPT |
2108 - (gnvh->oam ? TUNNEL_OAM : 0) |
2109 + flags = TUNNEL_KEY | (gnvh->oam ? TUNNEL_OAM : 0) |
2110 (gnvh->critical ? TUNNEL_CRIT_OPT : 0);
2111
2112 tun_dst = udp_tun_rx_dst(skb, geneve_get_sk_family(gs), flags,
2113 diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
2114 index 868acb4101412..74de621fa3504 100644
2115 --- a/drivers/net/usb/qmi_wwan.c
2116 +++ b/drivers/net/usb/qmi_wwan.c
2117 @@ -1092,7 +1092,7 @@ static const struct usb_device_id products[] = {
2118 {QMI_FIXED_INTF(0x05c6, 0x9011, 4)},
2119 {QMI_FIXED_INTF(0x05c6, 0x9021, 1)},
2120 {QMI_FIXED_INTF(0x05c6, 0x9022, 2)},
2121 - {QMI_FIXED_INTF(0x05c6, 0x9025, 4)}, /* Alcatel-sbell ASB TL131 TDD LTE (China Mobile) */
2122 + {QMI_QUIRK_SET_DTR(0x05c6, 0x9025, 4)}, /* Alcatel-sbell ASB TL131 TDD LTE (China Mobile) */
2123 {QMI_FIXED_INTF(0x05c6, 0x9026, 3)},
2124 {QMI_FIXED_INTF(0x05c6, 0x902e, 5)},
2125 {QMI_FIXED_INTF(0x05c6, 0x9031, 5)},
2126 diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
2127 index 1bd8840e11a6e..930edfc32f597 100644
2128 --- a/drivers/pinctrl/pinctrl-rockchip.c
2129 +++ b/drivers/pinctrl/pinctrl-rockchip.c
2130 @@ -2811,7 +2811,9 @@ static int rockchip_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
2131 if (!bank->domain)
2132 return -ENXIO;
2133
2134 + clk_enable(bank->clk);
2135 virq = irq_create_mapping(bank->domain, offset);
2136 + clk_disable(bank->clk);
2137
2138 return (virq) ? : -ENXIO;
2139 }
2140 diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
2141 index 4da2d6ad22b0b..c9b8613e69db2 100644
2142 --- a/drivers/regulator/core.c
2143 +++ b/drivers/regulator/core.c
2144 @@ -1275,7 +1275,6 @@ static int _regulator_do_enable(struct regulator_dev *rdev);
2145 /**
2146 * set_machine_constraints - sets regulator constraints
2147 * @rdev: regulator source
2148 - * @constraints: constraints to apply
2149 *
2150 * Allows platform initialisation code to define and constrain
2151 * regulator circuits e.g. valid voltage/current ranges, etc. NOTE:
2152 @@ -1283,21 +1282,11 @@ static int _regulator_do_enable(struct regulator_dev *rdev);
2153 * regulator operations to proceed i.e. set_voltage, set_current_limit,
2154 * set_mode.
2155 */
2156 -static int set_machine_constraints(struct regulator_dev *rdev,
2157 - const struct regulation_constraints *constraints)
2158 +static int set_machine_constraints(struct regulator_dev *rdev)
2159 {
2160 int ret = 0;
2161 const struct regulator_ops *ops = rdev->desc->ops;
2162
2163 - if (constraints)
2164 - rdev->constraints = kmemdup(constraints, sizeof(*constraints),
2165 - GFP_KERNEL);
2166 - else
2167 - rdev->constraints = kzalloc(sizeof(*constraints),
2168 - GFP_KERNEL);
2169 - if (!rdev->constraints)
2170 - return -ENOMEM;
2171 -
2172 ret = machine_constraints_voltage(rdev, rdev->constraints);
2173 if (ret != 0)
2174 return ret;
2175 @@ -1811,6 +1800,15 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
2176 }
2177 }
2178
2179 + if (r == rdev) {
2180 + dev_err(dev, "Supply for %s (%s) resolved to itself\n",
2181 + rdev->desc->name, rdev->supply_name);
2182 + if (!have_full_constraints())
2183 + return -EINVAL;
2184 + r = dummy_regulator_rdev;
2185 + get_device(&r->dev);
2186 + }
2187 +
2188 /*
2189 * If the supply's parent device is not the same as the
2190 * regulator's parent device, then ensure the parent device
2191 @@ -5014,7 +5012,6 @@ struct regulator_dev *
2192 regulator_register(const struct regulator_desc *regulator_desc,
2193 const struct regulator_config *cfg)
2194 {
2195 - const struct regulation_constraints *constraints = NULL;
2196 const struct regulator_init_data *init_data;
2197 struct regulator_config *config = NULL;
2198 static atomic_t regulator_no = ATOMIC_INIT(-1);
2199 @@ -5153,14 +5150,23 @@ regulator_register(const struct regulator_desc *regulator_desc,
2200
2201 /* set regulator constraints */
2202 if (init_data)
2203 - constraints = &init_data->constraints;
2204 + rdev->constraints = kmemdup(&init_data->constraints,
2205 + sizeof(*rdev->constraints),
2206 + GFP_KERNEL);
2207 + else
2208 + rdev->constraints = kzalloc(sizeof(*rdev->constraints),
2209 + GFP_KERNEL);
2210 + if (!rdev->constraints) {
2211 + ret = -ENOMEM;
2212 + goto wash;
2213 + }
2214
2215 if (init_data && init_data->supply_regulator)
2216 rdev->supply_name = init_data->supply_regulator;
2217 else if (regulator_desc->supply_name)
2218 rdev->supply_name = regulator_desc->supply_name;
2219
2220 - ret = set_machine_constraints(rdev, constraints);
2221 + ret = set_machine_constraints(rdev);
2222 if (ret == -EPROBE_DEFER) {
2223 /* Regulator might be in bypass mode and so needs its supply
2224 * to set the constraints */
2225 @@ -5169,7 +5175,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
2226 * that is just being created */
2227 ret = regulator_resolve_supply(rdev);
2228 if (!ret)
2229 - ret = set_machine_constraints(rdev, constraints);
2230 + ret = set_machine_constraints(rdev);
2231 else
2232 rdev_dbg(rdev, "unable to resolve supply early: %pe\n",
2233 ERR_PTR(ret));
2234 diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c
2235 index 4c8e8b4722872..44b1da7cc3744 100644
2236 --- a/drivers/regulator/pfuze100-regulator.c
2237 +++ b/drivers/regulator/pfuze100-regulator.c
2238 @@ -833,11 +833,14 @@ static int pfuze100_regulator_probe(struct i2c_client *client,
2239 * the switched regulator till yet.
2240 */
2241 if (pfuze_chip->flags & PFUZE_FLAG_DISABLE_SW) {
2242 - if (pfuze_chip->regulator_descs[i].sw_reg) {
2243 - desc->ops = &pfuze100_sw_disable_regulator_ops;
2244 - desc->enable_val = 0x8;
2245 - desc->disable_val = 0x0;
2246 - desc->enable_time = 500;
2247 + if (pfuze_chip->chip_id == PFUZE100 ||
2248 + pfuze_chip->chip_id == PFUZE200) {
2249 + if (pfuze_chip->regulator_descs[i].sw_reg) {
2250 + desc->ops = &pfuze100_sw_disable_regulator_ops;
2251 + desc->enable_val = 0x8;
2252 + desc->disable_val = 0x0;
2253 + desc->enable_time = 500;
2254 + }
2255 }
2256 }
2257
2258 diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
2259 index 89b9314d64c9d..016330f909c09 100644
2260 --- a/drivers/regulator/ti-abb-regulator.c
2261 +++ b/drivers/regulator/ti-abb-regulator.c
2262 @@ -342,8 +342,17 @@ static int ti_abb_set_voltage_sel(struct regulator_dev *rdev, unsigned sel)
2263 return ret;
2264 }
2265
2266 - /* If data is exactly the same, then just update index, no change */
2267 info = &abb->info[sel];
2268 + /*
2269 + * When Linux kernel is starting up, we are'nt sure of the
2270 + * Bias configuration that bootloader has configured.
2271 + * So, we get to know the actual setting the first time
2272 + * we are asked to transition.
2273 + */
2274 + if (abb->current_info_idx == -EINVAL)
2275 + goto just_set_abb;
2276 +
2277 + /* If data is exactly the same, then just update index, no change */
2278 oinfo = &abb->info[abb->current_info_idx];
2279 if (!memcmp(info, oinfo, sizeof(*info))) {
2280 dev_dbg(dev, "%s: Same data new idx=%d, old idx=%d\n", __func__,
2281 @@ -351,6 +360,7 @@ static int ti_abb_set_voltage_sel(struct regulator_dev *rdev, unsigned sel)
2282 goto out;
2283 }
2284
2285 +just_set_abb:
2286 ret = ti_abb_set_opp(rdev, abb, info);
2287
2288 out:
2289 diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
2290 index cf87eb27879f0..a0ebc2e603949 100644
2291 --- a/drivers/s390/block/dasd.c
2292 +++ b/drivers/s390/block/dasd.c
2293 @@ -2980,6 +2980,12 @@ static int _dasd_requeue_request(struct dasd_ccw_req *cqr)
2294
2295 if (!block)
2296 return -EINVAL;
2297 + /*
2298 + * If the request is an ERP request there is nothing to requeue.
2299 + * This will be done with the remaining original request.
2300 + */
2301 + if (cqr->refers)
2302 + return 0;
2303 spin_lock_irq(&cqr->dq->lock);
2304 req = (struct request *) cqr->callback_data;
2305 blk_mq_requeue_request(req, false);
2306 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
2307 index d538b3d4f74a5..0772327f87d93 100644
2308 --- a/drivers/scsi/ufs/ufshcd.c
2309 +++ b/drivers/scsi/ufs/ufshcd.c
2310 @@ -1569,12 +1569,12 @@ start:
2311 */
2312 /* fallthrough */
2313 case CLKS_OFF:
2314 - ufshcd_scsi_block_requests(hba);
2315 hba->clk_gating.state = REQ_CLKS_ON;
2316 trace_ufshcd_clk_gating(dev_name(hba->dev),
2317 hba->clk_gating.state);
2318 - queue_work(hba->clk_gating.clk_gating_workq,
2319 - &hba->clk_gating.ungate_work);
2320 + if (queue_work(hba->clk_gating.clk_gating_workq,
2321 + &hba->clk_gating.ungate_work))
2322 + ufshcd_scsi_block_requests(hba);
2323 /*
2324 * fall through to check if we should wait for this
2325 * work to be done or not.
2326 diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c
2327 index c331efd6e86b2..1e5aac1581aa4 100644
2328 --- a/drivers/spi/spi-bcm2835aux.c
2329 +++ b/drivers/spi/spi-bcm2835aux.c
2330 @@ -494,7 +494,7 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
2331 unsigned long clk_hz;
2332 int err;
2333
2334 - master = spi_alloc_master(&pdev->dev, sizeof(*bs));
2335 + master = devm_spi_alloc_master(&pdev->dev, sizeof(*bs));
2336 if (!master)
2337 return -ENOMEM;
2338
2339 @@ -524,29 +524,24 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
2340
2341 /* the main area */
2342 bs->regs = devm_platform_ioremap_resource(pdev, 0);
2343 - if (IS_ERR(bs->regs)) {
2344 - err = PTR_ERR(bs->regs);
2345 - goto out_master_put;
2346 - }
2347 + if (IS_ERR(bs->regs))
2348 + return PTR_ERR(bs->regs);
2349
2350 bs->clk = devm_clk_get(&pdev->dev, NULL);
2351 if (IS_ERR(bs->clk)) {
2352 - err = PTR_ERR(bs->clk);
2353 dev_err(&pdev->dev, "could not get clk: %d\n", err);
2354 - goto out_master_put;
2355 + return PTR_ERR(bs->clk);
2356 }
2357
2358 bs->irq = platform_get_irq(pdev, 0);
2359 - if (bs->irq <= 0) {
2360 - err = bs->irq ? bs->irq : -ENODEV;
2361 - goto out_master_put;
2362 - }
2363 + if (bs->irq <= 0)
2364 + return bs->irq ? bs->irq : -ENODEV;
2365
2366 /* this also enables the HW block */
2367 err = clk_prepare_enable(bs->clk);
2368 if (err) {
2369 dev_err(&pdev->dev, "could not prepare clock: %d\n", err);
2370 - goto out_master_put;
2371 + return err;
2372 }
2373
2374 /* just checking if the clock returns a sane value */
2375 @@ -581,8 +576,6 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
2376
2377 out_clk_disable:
2378 clk_disable_unprepare(bs->clk);
2379 -out_master_put:
2380 - spi_master_put(master);
2381 return err;
2382 }
2383
2384 diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
2385 index 92e460d4f3d10..ecb4396707cfc 100644
2386 --- a/drivers/spi/spi-fsl-lpspi.c
2387 +++ b/drivers/spi/spi-fsl-lpspi.c
2388 @@ -973,9 +973,6 @@ static int fsl_lpspi_remove(struct platform_device *pdev)
2389 spi_controller_get_devdata(controller);
2390
2391 pm_runtime_disable(fsl_lpspi->dev);
2392 -
2393 - spi_master_put(controller);
2394 -
2395 return 0;
2396 }
2397
2398 diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c
2399 index cb52fd8008d0e..5ed7c9e017fb1 100644
2400 --- a/drivers/spi/spi-npcm-fiu.c
2401 +++ b/drivers/spi/spi-npcm-fiu.c
2402 @@ -680,7 +680,7 @@ static int npcm_fiu_probe(struct platform_device *pdev)
2403 int ret;
2404 int id;
2405
2406 - ctrl = spi_alloc_master(dev, sizeof(*fiu));
2407 + ctrl = devm_spi_alloc_master(dev, sizeof(*fiu));
2408 if (!ctrl)
2409 return -ENOMEM;
2410
2411 diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
2412 index 982753ac1bf6c..4c96c7c9e335e 100644
2413 --- a/drivers/spi/spi.c
2414 +++ b/drivers/spi/spi.c
2415 @@ -2257,6 +2257,49 @@ struct spi_controller *__spi_alloc_controller(struct device *dev,
2416 }
2417 EXPORT_SYMBOL_GPL(__spi_alloc_controller);
2418
2419 +static void devm_spi_release_controller(struct device *dev, void *ctlr)
2420 +{
2421 + spi_controller_put(*(struct spi_controller **)ctlr);
2422 +}
2423 +
2424 +/**
2425 + * __devm_spi_alloc_controller - resource-managed __spi_alloc_controller()
2426 + * @dev: physical device of SPI controller
2427 + * @size: how much zeroed driver-private data to allocate
2428 + * @slave: whether to allocate an SPI master (false) or SPI slave (true)
2429 + * Context: can sleep
2430 + *
2431 + * Allocate an SPI controller and automatically release a reference on it
2432 + * when @dev is unbound from its driver. Drivers are thus relieved from
2433 + * having to call spi_controller_put().
2434 + *
2435 + * The arguments to this function are identical to __spi_alloc_controller().
2436 + *
2437 + * Return: the SPI controller structure on success, else NULL.
2438 + */
2439 +struct spi_controller *__devm_spi_alloc_controller(struct device *dev,
2440 + unsigned int size,
2441 + bool slave)
2442 +{
2443 + struct spi_controller **ptr, *ctlr;
2444 +
2445 + ptr = devres_alloc(devm_spi_release_controller, sizeof(*ptr),
2446 + GFP_KERNEL);
2447 + if (!ptr)
2448 + return NULL;
2449 +
2450 + ctlr = __spi_alloc_controller(dev, size, slave);
2451 + if (ctlr) {
2452 + *ptr = ctlr;
2453 + devres_add(dev, ptr);
2454 + } else {
2455 + devres_free(ptr);
2456 + }
2457 +
2458 + return ctlr;
2459 +}
2460 +EXPORT_SYMBOL_GPL(__devm_spi_alloc_controller);
2461 +
2462 #ifdef CONFIG_OF
2463 static int of_spi_get_gpio_numbers(struct spi_controller *ctlr)
2464 {
2465 @@ -2576,6 +2619,11 @@ int devm_spi_register_controller(struct device *dev,
2466 }
2467 EXPORT_SYMBOL_GPL(devm_spi_register_controller);
2468
2469 +static int devm_spi_match_controller(struct device *dev, void *res, void *ctlr)
2470 +{
2471 + return *(struct spi_controller **)res == ctlr;
2472 +}
2473 +
2474 static int __unregister(struct device *dev, void *null)
2475 {
2476 spi_unregister_device(to_spi_device(dev));
2477 @@ -2617,7 +2665,15 @@ void spi_unregister_controller(struct spi_controller *ctlr)
2478 list_del(&ctlr->list);
2479 mutex_unlock(&board_lock);
2480
2481 - device_unregister(&ctlr->dev);
2482 + device_del(&ctlr->dev);
2483 +
2484 + /* Release the last reference on the controller if its driver
2485 + * has not yet been converted to devm_spi_alloc_master/slave().
2486 + */
2487 + if (!devres_find(ctlr->dev.parent, devm_spi_release_controller,
2488 + devm_spi_match_controller, ctlr))
2489 + put_device(&ctlr->dev);
2490 +
2491 /* free bus id */
2492 mutex_lock(&board_lock);
2493 if (found == ctlr)
2494 diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
2495 index 3784a27641a6e..df2513234cf75 100644
2496 --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
2497 +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
2498 @@ -21,6 +21,7 @@ static const struct sdio_device_id sdio_ids[] =
2499 { SDIO_DEVICE(0x024c, 0x0525), },
2500 { SDIO_DEVICE(0x024c, 0x0623), },
2501 { SDIO_DEVICE(0x024c, 0x0626), },
2502 + { SDIO_DEVICE(0x024c, 0x0627), },
2503 { SDIO_DEVICE(0x024c, 0xb723), },
2504 { /* end: all zeroes */ },
2505 };
2506 diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c
2507 index 5a9eff08cb960..9917dbce24703 100644
2508 --- a/drivers/staging/speakup/spk_ttyio.c
2509 +++ b/drivers/staging/speakup/spk_ttyio.c
2510 @@ -49,15 +49,25 @@ static int spk_ttyio_ldisc_open(struct tty_struct *tty)
2511
2512 if (!tty->ops->write)
2513 return -EOPNOTSUPP;
2514 +
2515 + mutex_lock(&speakup_tty_mutex);
2516 + if (speakup_tty) {
2517 + mutex_unlock(&speakup_tty_mutex);
2518 + return -EBUSY;
2519 + }
2520 speakup_tty = tty;
2521
2522 ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL);
2523 - if (!ldisc_data)
2524 + if (!ldisc_data) {
2525 + speakup_tty = NULL;
2526 + mutex_unlock(&speakup_tty_mutex);
2527 return -ENOMEM;
2528 + }
2529
2530 init_completion(&ldisc_data->completion);
2531 ldisc_data->buf_free = true;
2532 speakup_tty->disc_data = ldisc_data;
2533 + mutex_unlock(&speakup_tty_mutex);
2534
2535 return 0;
2536 }
2537 diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
2538 index 22d8705cd5cda..e5ed4ab2b08df 100644
2539 --- a/drivers/tty/serial/imx.c
2540 +++ b/drivers/tty/serial/imx.c
2541 @@ -877,8 +877,14 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id)
2542 struct imx_port *sport = dev_id;
2543 unsigned int usr1, usr2, ucr1, ucr2, ucr3, ucr4;
2544 irqreturn_t ret = IRQ_NONE;
2545 + unsigned long flags = 0;
2546
2547 - spin_lock(&sport->port.lock);
2548 + /*
2549 + * IRQs might not be disabled upon entering this interrupt handler,
2550 + * e.g. when interrupt handlers are forced to be threaded. To support
2551 + * this scenario as well, disable IRQs when acquiring the spinlock.
2552 + */
2553 + spin_lock_irqsave(&sport->port.lock, flags);
2554
2555 usr1 = imx_uart_readl(sport, USR1);
2556 usr2 = imx_uart_readl(sport, USR2);
2557 @@ -946,7 +952,7 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id)
2558 ret = IRQ_HANDLED;
2559 }
2560
2561 - spin_unlock(&sport->port.lock);
2562 + spin_unlock_irqrestore(&sport->port.lock, flags);
2563
2564 return ret;
2565 }
2566 @@ -1936,16 +1942,6 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count)
2567 unsigned int ucr1;
2568 unsigned long flags = 0;
2569 int locked = 1;
2570 - int retval;
2571 -
2572 - retval = clk_enable(sport->clk_per);
2573 - if (retval)
2574 - return;
2575 - retval = clk_enable(sport->clk_ipg);
2576 - if (retval) {
2577 - clk_disable(sport->clk_per);
2578 - return;
2579 - }
2580
2581 if (sport->port.sysrq)
2582 locked = 0;
2583 @@ -1981,9 +1977,6 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count)
2584
2585 if (locked)
2586 spin_unlock_irqrestore(&sport->port.lock, flags);
2587 -
2588 - clk_disable(sport->clk_ipg);
2589 - clk_disable(sport->clk_per);
2590 }
2591
2592 /*
2593 @@ -2084,15 +2077,14 @@ imx_uart_console_setup(struct console *co, char *options)
2594
2595 retval = uart_set_options(&sport->port, co, baud, parity, bits, flow);
2596
2597 - clk_disable(sport->clk_ipg);
2598 if (retval) {
2599 - clk_unprepare(sport->clk_ipg);
2600 + clk_disable_unprepare(sport->clk_ipg);
2601 goto error_console;
2602 }
2603
2604 - retval = clk_prepare(sport->clk_per);
2605 + retval = clk_prepare_enable(sport->clk_per);
2606 if (retval)
2607 - clk_unprepare(sport->clk_ipg);
2608 + clk_disable_unprepare(sport->clk_ipg);
2609
2610 error_console:
2611 return retval;
2612 diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
2613 index 9760a52800b42..edcd6769a94b4 100644
2614 --- a/fs/efivarfs/super.c
2615 +++ b/fs/efivarfs/super.c
2616 @@ -21,6 +21,7 @@ LIST_HEAD(efivarfs_list);
2617 static void efivarfs_evict_inode(struct inode *inode)
2618 {
2619 clear_inode(inode);
2620 + kfree(inode->i_private);
2621 }
2622
2623 static const struct super_operations efivarfs_ops = {
2624 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
2625 index d576addfdd036..1c558b5547889 100644
2626 --- a/fs/ext4/ext4.h
2627 +++ b/fs/ext4/ext4.h
2628 @@ -2496,7 +2496,8 @@ void ext4_insert_dentry(struct inode *inode,
2629 struct ext4_filename *fname);
2630 static inline void ext4_update_dx_flag(struct inode *inode)
2631 {
2632 - if (!ext4_has_feature_dir_index(inode->i_sb)) {
2633 + if (!ext4_has_feature_dir_index(inode->i_sb) &&
2634 + ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) {
2635 /* ext4_iget() should have caught this... */
2636 WARN_ON_ONCE(ext4_has_feature_metadata_csum(inode->i_sb));
2637 ext4_clear_inode_flag(inode, EXT4_INODE_INDEX);
2638 diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
2639 index 3d5aa0c10a4c1..5d9d93ca0db70 100644
2640 --- a/fs/gfs2/rgrp.c
2641 +++ b/fs/gfs2/rgrp.c
2642 @@ -2574,13 +2574,13 @@ int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr, unsigned int type)
2643
2644 rbm.rgd = rgd;
2645 error = gfs2_rbm_from_block(&rbm, no_addr);
2646 - if (WARN_ON_ONCE(error))
2647 - goto fail;
2648 -
2649 - if (gfs2_testbit(&rbm, false) != type)
2650 - error = -ESTALE;
2651 + if (!WARN_ON_ONCE(error)) {
2652 + if (gfs2_testbit(&rbm, false) != type)
2653 + error = -ESTALE;
2654 + }
2655
2656 gfs2_glock_dq_uninit(&rgd_gh);
2657 +
2658 fail:
2659 return error;
2660 }
2661 diff --git a/fs/libfs.c b/fs/libfs.c
2662 index 5fd9cc0e2ac9e..247b58a68240a 100644
2663 --- a/fs/libfs.c
2664 +++ b/fs/libfs.c
2665 @@ -887,7 +887,7 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
2666 size_t len, loff_t *ppos)
2667 {
2668 struct simple_attr *attr;
2669 - u64 val;
2670 + unsigned long long val;
2671 size_t size;
2672 ssize_t ret;
2673
2674 @@ -905,7 +905,9 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
2675 goto out;
2676
2677 attr->set_buf[size] = '\0';
2678 - val = simple_strtoll(attr->set_buf, NULL, 0);
2679 + ret = kstrtoull(attr->set_buf, 0, &val);
2680 + if (ret)
2681 + goto out;
2682 ret = attr->set(attr->data, val);
2683 if (ret == 0)
2684 ret = len; /* on success, claim we got the whole input */
2685 diff --git a/fs/super.c b/fs/super.c
2686 index a288cd60d2aed..877532baf513d 100644
2687 --- a/fs/super.c
2688 +++ b/fs/super.c
2689 @@ -1647,36 +1647,11 @@ EXPORT_SYMBOL(__sb_end_write);
2690 */
2691 int __sb_start_write(struct super_block *sb, int level, bool wait)
2692 {
2693 - bool force_trylock = false;
2694 - int ret = 1;
2695 + if (!wait)
2696 + return percpu_down_read_trylock(sb->s_writers.rw_sem + level-1);
2697
2698 -#ifdef CONFIG_LOCKDEP
2699 - /*
2700 - * We want lockdep to tell us about possible deadlocks with freezing
2701 - * but it's it bit tricky to properly instrument it. Getting a freeze
2702 - * protection works as getting a read lock but there are subtle
2703 - * problems. XFS for example gets freeze protection on internal level
2704 - * twice in some cases, which is OK only because we already hold a
2705 - * freeze protection also on higher level. Due to these cases we have
2706 - * to use wait == F (trylock mode) which must not fail.
2707 - */
2708 - if (wait) {
2709 - int i;
2710 -
2711 - for (i = 0; i < level - 1; i++)
2712 - if (percpu_rwsem_is_held(sb->s_writers.rw_sem + i)) {
2713 - force_trylock = true;
2714 - break;
2715 - }
2716 - }
2717 -#endif
2718 - if (wait && !force_trylock)
2719 - percpu_down_read(sb->s_writers.rw_sem + level-1);
2720 - else
2721 - ret = percpu_down_read_trylock(sb->s_writers.rw_sem + level-1);
2722 -
2723 - WARN_ON(force_trylock && !ret);
2724 - return ret;
2725 + percpu_down_read(sb->s_writers.rw_sem + level-1);
2726 + return 1;
2727 }
2728 EXPORT_SYMBOL(__sb_start_write);
2729
2730 diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c
2731 index 3780609c7860c..fc78efa52c94e 100644
2732 --- a/fs/xfs/libxfs/xfs_rmap_btree.c
2733 +++ b/fs/xfs/libxfs/xfs_rmap_btree.c
2734 @@ -243,8 +243,8 @@ xfs_rmapbt_key_diff(
2735 else if (y > x)
2736 return -1;
2737
2738 - x = be64_to_cpu(kp->rm_offset);
2739 - y = xfs_rmap_irec_offset_pack(rec);
2740 + x = XFS_RMAP_OFF(be64_to_cpu(kp->rm_offset));
2741 + y = rec->rm_offset;
2742 if (x > y)
2743 return 1;
2744 else if (y > x)
2745 @@ -275,8 +275,8 @@ xfs_rmapbt_diff_two_keys(
2746 else if (y > x)
2747 return -1;
2748
2749 - x = be64_to_cpu(kp1->rm_offset);
2750 - y = be64_to_cpu(kp2->rm_offset);
2751 + x = XFS_RMAP_OFF(be64_to_cpu(kp1->rm_offset));
2752 + y = XFS_RMAP_OFF(be64_to_cpu(kp2->rm_offset));
2753 if (x > y)
2754 return 1;
2755 else if (y > x)
2756 @@ -390,8 +390,8 @@ xfs_rmapbt_keys_inorder(
2757 return 1;
2758 else if (a > b)
2759 return 0;
2760 - a = be64_to_cpu(k1->rmap.rm_offset);
2761 - b = be64_to_cpu(k2->rmap.rm_offset);
2762 + a = XFS_RMAP_OFF(be64_to_cpu(k1->rmap.rm_offset));
2763 + b = XFS_RMAP_OFF(be64_to_cpu(k2->rmap.rm_offset));
2764 if (a <= b)
2765 return 1;
2766 return 0;
2767 @@ -420,8 +420,8 @@ xfs_rmapbt_recs_inorder(
2768 return 1;
2769 else if (a > b)
2770 return 0;
2771 - a = be64_to_cpu(r1->rmap.rm_offset);
2772 - b = be64_to_cpu(r2->rmap.rm_offset);
2773 + a = XFS_RMAP_OFF(be64_to_cpu(r1->rmap.rm_offset));
2774 + b = XFS_RMAP_OFF(be64_to_cpu(r2->rmap.rm_offset));
2775 if (a <= b)
2776 return 1;
2777 return 0;
2778 diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c
2779 index ec580c0d70fa3..52892f41eb2d8 100644
2780 --- a/fs/xfs/scrub/bmap.c
2781 +++ b/fs/xfs/scrub/bmap.c
2782 @@ -218,13 +218,13 @@ xchk_bmap_xref_rmap(
2783 * which doesn't track unwritten state.
2784 */
2785 if (owner != XFS_RMAP_OWN_COW &&
2786 - irec->br_state == XFS_EXT_UNWRITTEN &&
2787 - !(rmap.rm_flags & XFS_RMAP_UNWRITTEN))
2788 + !!(irec->br_state == XFS_EXT_UNWRITTEN) !=
2789 + !!(rmap.rm_flags & XFS_RMAP_UNWRITTEN))
2790 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork,
2791 irec->br_startoff);
2792
2793 - if (info->whichfork == XFS_ATTR_FORK &&
2794 - !(rmap.rm_flags & XFS_RMAP_ATTR_FORK))
2795 + if (!!(info->whichfork == XFS_ATTR_FORK) !=
2796 + !!(rmap.rm_flags & XFS_RMAP_ATTR_FORK))
2797 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork,
2798 irec->br_startoff);
2799 if (rmap.rm_flags & XFS_RMAP_BMBT_BLOCK)
2800 diff --git a/fs/xfs/scrub/btree.c b/fs/xfs/scrub/btree.c
2801 index f52a7b8256f96..debf392e05156 100644
2802 --- a/fs/xfs/scrub/btree.c
2803 +++ b/fs/xfs/scrub/btree.c
2804 @@ -452,32 +452,41 @@ xchk_btree_check_minrecs(
2805 int level,
2806 struct xfs_btree_block *block)
2807 {
2808 - unsigned int numrecs;
2809 - int ok_level;
2810 -
2811 - numrecs = be16_to_cpu(block->bb_numrecs);
2812 + struct xfs_btree_cur *cur = bs->cur;
2813 + unsigned int root_level = cur->bc_nlevels - 1;
2814 + unsigned int numrecs = be16_to_cpu(block->bb_numrecs);
2815
2816 /* More records than minrecs means the block is ok. */
2817 - if (numrecs >= bs->cur->bc_ops->get_minrecs(bs->cur, level))
2818 + if (numrecs >= cur->bc_ops->get_minrecs(cur, level))
2819 return;
2820
2821 /*
2822 - * Certain btree blocks /can/ have fewer than minrecs records. Any
2823 - * level greater than or equal to the level of the highest dedicated
2824 - * btree block are allowed to violate this constraint.
2825 - *
2826 - * For a btree rooted in a block, the btree root can have fewer than
2827 - * minrecs records. If the btree is rooted in an inode and does not
2828 - * store records in the root, the direct children of the root and the
2829 - * root itself can have fewer than minrecs records.
2830 + * For btrees rooted in the inode, it's possible that the root block
2831 + * contents spilled into a regular ondisk block because there wasn't
2832 + * enough space in the inode root. The number of records in that
2833 + * child block might be less than the standard minrecs, but that's ok
2834 + * provided that there's only one direct child of the root.
2835 */
2836 - ok_level = bs->cur->bc_nlevels - 1;
2837 - if (bs->cur->bc_flags & XFS_BTREE_ROOT_IN_INODE)
2838 - ok_level--;
2839 - if (level >= ok_level)
2840 + if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) &&
2841 + level == cur->bc_nlevels - 2) {
2842 + struct xfs_btree_block *root_block;
2843 + struct xfs_buf *root_bp;
2844 + int root_maxrecs;
2845 +
2846 + root_block = xfs_btree_get_block(cur, root_level, &root_bp);
2847 + root_maxrecs = cur->bc_ops->get_dmaxrecs(cur, root_level);
2848 + if (be16_to_cpu(root_block->bb_numrecs) != 1 ||
2849 + numrecs <= root_maxrecs)
2850 + xchk_btree_set_corrupt(bs->sc, cur, level);
2851 return;
2852 + }
2853
2854 - xchk_btree_set_corrupt(bs->sc, bs->cur, level);
2855 + /*
2856 + * Otherwise, only the root level is allowed to have fewer than minrecs
2857 + * records or keyptrs.
2858 + */
2859 + if (level < root_level)
2860 + xchk_btree_set_corrupt(bs->sc, cur, level);
2861 }
2862
2863 /*
2864 diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
2865 index ba5b6f3b2b88a..5a0ce0c2c4bbd 100644
2866 --- a/fs/xfs/xfs_mount.c
2867 +++ b/fs/xfs/xfs_mount.c
2868 @@ -195,21 +195,26 @@ xfs_initialize_perag(
2869 }
2870
2871 pag = kmem_zalloc(sizeof(*pag), KM_MAYFAIL);
2872 - if (!pag)
2873 + if (!pag) {
2874 + error = -ENOMEM;
2875 goto out_unwind_new_pags;
2876 + }
2877 pag->pag_agno = index;
2878 pag->pag_mount = mp;
2879 spin_lock_init(&pag->pag_ici_lock);
2880 mutex_init(&pag->pag_ici_reclaim_lock);
2881 INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC);
2882 - if (xfs_buf_hash_init(pag))
2883 +
2884 + error = xfs_buf_hash_init(pag);
2885 + if (error)
2886 goto out_free_pag;
2887 init_waitqueue_head(&pag->pagb_wait);
2888 spin_lock_init(&pag->pagb_lock);
2889 pag->pagb_count = 0;
2890 pag->pagb_tree = RB_ROOT;
2891
2892 - if (radix_tree_preload(GFP_NOFS))
2893 + error = radix_tree_preload(GFP_NOFS);
2894 + if (error)
2895 goto out_hash_destroy;
2896
2897 spin_lock(&mp->m_perag_lock);
2898 diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
2899 index 71d81923e6b06..abfefaaf897a0 100644
2900 --- a/include/drm/intel-gtt.h
2901 +++ b/include/drm/intel-gtt.h
2902 @@ -5,6 +5,7 @@
2903 #define _DRM_INTEL_GTT_H
2904
2905 #include <linux/agp_backend.h>
2906 +#include <linux/intel-iommu.h>
2907 #include <linux/kernel.h>
2908
2909 void intel_gtt_get(u64 *gtt_total,
2910 @@ -33,8 +34,4 @@ void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries);
2911 /* flag for GFDT type */
2912 #define AGP_USER_CACHED_MEMORY_GFDT (1 << 3)
2913
2914 -#ifdef CONFIG_INTEL_IOMMU
2915 -extern int intel_iommu_gfx_mapped;
2916 -#endif
2917 -
2918 #endif
2919 diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
2920 index ed870da78326b..6b559d25a84ee 100644
2921 --- a/include/linux/intel-iommu.h
2922 +++ b/include/linux/intel-iommu.h
2923 @@ -706,7 +706,7 @@ extern int iommu_calculate_agaw(struct intel_iommu *iommu);
2924 extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
2925 extern int dmar_disabled;
2926 extern int intel_iommu_enabled;
2927 -extern int intel_iommu_tboot_noforce;
2928 +extern int intel_iommu_gfx_mapped;
2929 #else
2930 static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
2931 {
2932 diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
2933 index af4f265d0f67e..acd91300a4ab1 100644
2934 --- a/include/linux/spi/spi.h
2935 +++ b/include/linux/spi/spi.h
2936 @@ -663,6 +663,25 @@ static inline struct spi_controller *spi_alloc_slave(struct device *host,
2937 return __spi_alloc_controller(host, size, true);
2938 }
2939
2940 +struct spi_controller *__devm_spi_alloc_controller(struct device *dev,
2941 + unsigned int size,
2942 + bool slave);
2943 +
2944 +static inline struct spi_controller *devm_spi_alloc_master(struct device *dev,
2945 + unsigned int size)
2946 +{
2947 + return __devm_spi_alloc_controller(dev, size, false);
2948 +}
2949 +
2950 +static inline struct spi_controller *devm_spi_alloc_slave(struct device *dev,
2951 + unsigned int size)
2952 +{
2953 + if (!IS_ENABLED(CONFIG_SPI_SLAVE))
2954 + return NULL;
2955 +
2956 + return __devm_spi_alloc_controller(dev, size, true);
2957 +}
2958 +
2959 extern int spi_register_controller(struct spi_controller *ctlr);
2960 extern int devm_spi_register_controller(struct device *dev,
2961 struct spi_controller *ctlr);
2962 diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
2963 index cde3dc18e21a2..0a8fced6aaec4 100644
2964 --- a/include/linux/swiotlb.h
2965 +++ b/include/linux/swiotlb.h
2966 @@ -5,6 +5,7 @@
2967 #include <linux/dma-direction.h>
2968 #include <linux/init.h>
2969 #include <linux/types.h>
2970 +#include <linux/limits.h>
2971
2972 struct device;
2973 struct page;
2974 diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
2975 index af645604f3289..56deb2501e962 100644
2976 --- a/include/net/ip_tunnels.h
2977 +++ b/include/net/ip_tunnels.h
2978 @@ -472,9 +472,11 @@ static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info,
2979 const void *from, int len,
2980 __be16 flags)
2981 {
2982 - memcpy(ip_tunnel_info_opts(info), from, len);
2983 info->options_len = len;
2984 - info->key.tun_flags |= flags;
2985 + if (len > 0) {
2986 + memcpy(ip_tunnel_info_opts(info), from, len);
2987 + info->key.tun_flags |= flags;
2988 + }
2989 }
2990
2991 static inline struct ip_tunnel_info *lwt_tun_info(struct lwtunnel_state *lwtstate)
2992 @@ -520,7 +522,6 @@ static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info,
2993 __be16 flags)
2994 {
2995 info->options_len = 0;
2996 - info->key.tun_flags |= flags;
2997 }
2998
2999 #endif /* CONFIG_INET */
3000 diff --git a/include/net/neighbour.h b/include/net/neighbour.h
3001 index 8ec77bfdc1a41..2be8d6b0dfb69 100644
3002 --- a/include/net/neighbour.h
3003 +++ b/include/net/neighbour.h
3004 @@ -204,6 +204,7 @@ struct neigh_table {
3005 int (*pconstructor)(struct pneigh_entry *);
3006 void (*pdestructor)(struct pneigh_entry *);
3007 void (*proxy_redo)(struct sk_buff *skb);
3008 + int (*is_multicast)(const void *pkey);
3009 bool (*allow_add)(const struct net_device *dev,
3010 struct netlink_ext_ack *extack);
3011 char *id;
3012 diff --git a/kernel/fail_function.c b/kernel/fail_function.c
3013 index 63b349168da72..b0b1ad93fa957 100644
3014 --- a/kernel/fail_function.c
3015 +++ b/kernel/fail_function.c
3016 @@ -253,7 +253,7 @@ static ssize_t fei_write(struct file *file, const char __user *buffer,
3017
3018 if (copy_from_user(buf, buffer, count)) {
3019 ret = -EFAULT;
3020 - goto out;
3021 + goto out_free;
3022 }
3023 buf[count] = '\0';
3024 sym = strstrip(buf);
3025 @@ -307,8 +307,9 @@ static ssize_t fei_write(struct file *file, const char __user *buffer,
3026 ret = count;
3027 }
3028 out:
3029 - kfree(buf);
3030 mutex_unlock(&fei_lock);
3031 +out_free:
3032 + kfree(buf);
3033 return ret;
3034 }
3035
3036 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
3037 index 43d6179508d64..79de1294f8ebd 100644
3038 --- a/kernel/ptrace.c
3039 +++ b/kernel/ptrace.c
3040 @@ -264,17 +264,11 @@ static int ptrace_check_attach(struct task_struct *child, bool ignore_state)
3041 return ret;
3042 }
3043
3044 -static bool ptrace_has_cap(const struct cred *cred, struct user_namespace *ns,
3045 - unsigned int mode)
3046 +static bool ptrace_has_cap(struct user_namespace *ns, unsigned int mode)
3047 {
3048 - int ret;
3049 -
3050 if (mode & PTRACE_MODE_NOAUDIT)
3051 - ret = security_capable(cred, ns, CAP_SYS_PTRACE, CAP_OPT_NOAUDIT);
3052 - else
3053 - ret = security_capable(cred, ns, CAP_SYS_PTRACE, CAP_OPT_NONE);
3054 -
3055 - return ret == 0;
3056 + return ns_capable_noaudit(ns, CAP_SYS_PTRACE);
3057 + return ns_capable(ns, CAP_SYS_PTRACE);
3058 }
3059
3060 /* Returns 0 on success, -errno on denial. */
3061 @@ -326,7 +320,7 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode)
3062 gid_eq(caller_gid, tcred->sgid) &&
3063 gid_eq(caller_gid, tcred->gid))
3064 goto ok;
3065 - if (ptrace_has_cap(cred, tcred->user_ns, mode))
3066 + if (ptrace_has_cap(tcred->user_ns, mode))
3067 goto ok;
3068 rcu_read_unlock();
3069 return -EPERM;
3070 @@ -345,7 +339,7 @@ ok:
3071 mm = task->mm;
3072 if (mm &&
3073 ((get_dumpable(mm) != SUID_DUMP_USER) &&
3074 - !ptrace_has_cap(cred, mm->user_ns, mode)))
3075 + !ptrace_has_cap(mm->user_ns, mode)))
3076 return -EPERM;
3077
3078 return security_ptrace_access_check(task, mode);
3079 diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
3080 index 62e59596a30a0..1b1d2b09efa9b 100644
3081 --- a/kernel/rcu/tree.c
3082 +++ b/kernel/rcu/tree.c
3083 @@ -3157,7 +3157,6 @@ void rcu_cpu_starting(unsigned int cpu)
3084 smp_mb(); /* Ensure RCU read-side usage follows above initialization. */
3085 }
3086
3087 -#ifdef CONFIG_HOTPLUG_CPU
3088 /*
3089 * The outgoing function has no further need of RCU, so remove it from
3090 * the rcu_node tree's ->qsmaskinitnext bit masks.
3091 @@ -3197,6 +3196,7 @@ void rcu_report_dead(unsigned int cpu)
3092 per_cpu(rcu_cpu_started, cpu) = 0;
3093 }
3094
3095 +#ifdef CONFIG_HOTPLUG_CPU
3096 /*
3097 * The outgoing CPU has just passed through the dying-idle state, and we
3098 * are being invoked from the CPU that was IPIed to continue the offline
3099 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
3100 index dddaf61378f62..200e121101097 100644
3101 --- a/kernel/sched/fair.c
3102 +++ b/kernel/sched/fair.c
3103 @@ -5228,6 +5228,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
3104 struct cfs_rq *cfs_rq;
3105 struct sched_entity *se = &p->se;
3106 int idle_h_nr_running = task_has_idle_policy(p);
3107 + int task_new = !(flags & ENQUEUE_WAKEUP);
3108
3109 /*
3110 * The code below (indirectly) updates schedutil which looks at
3111 @@ -5299,7 +5300,7 @@ enqueue_throttle:
3112 * into account, but that is not straightforward to implement,
3113 * and the following generally works well enough in practice.
3114 */
3115 - if (flags & ENQUEUE_WAKEUP)
3116 + if (!task_new)
3117 update_overutilized_status(rq);
3118
3119 }
3120 diff --git a/kernel/seccomp.c b/kernel/seccomp.c
3121 index 0d991e9626f68..4221a4383cfc5 100644
3122 --- a/kernel/seccomp.c
3123 +++ b/kernel/seccomp.c
3124 @@ -37,7 +37,7 @@
3125 #include <linux/filter.h>
3126 #include <linux/pid.h>
3127 #include <linux/ptrace.h>
3128 -#include <linux/security.h>
3129 +#include <linux/capability.h>
3130 #include <linux/tracehook.h>
3131 #include <linux/uaccess.h>
3132 #include <linux/anon_inodes.h>
3133 @@ -453,8 +453,7 @@ static struct seccomp_filter *seccomp_prepare_filter(struct sock_fprog *fprog)
3134 * behavior of privileged children.
3135 */
3136 if (!task_no_new_privs(current) &&
3137 - security_capable(current_cred(), current_user_ns(),
3138 - CAP_SYS_ADMIN, CAP_OPT_NOAUDIT) != 0)
3139 + !ns_capable_noaudit(current_user_ns(), CAP_SYS_ADMIN))
3140 return ERR_PTR(-EACCES);
3141
3142 /* Allocate a new seccomp_filter */
3143 diff --git a/mm/huge_memory.c b/mm/huge_memory.c
3144 index 9295d9d70681e..11aa763a31440 100644
3145 --- a/mm/huge_memory.c
3146 +++ b/mm/huge_memory.c
3147 @@ -722,7 +722,6 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf)
3148 transparent_hugepage_use_zero_page()) {
3149 pgtable_t pgtable;
3150 struct page *zero_page;
3151 - bool set;
3152 vm_fault_t ret;
3153 pgtable = pte_alloc_one(vma->vm_mm);
3154 if (unlikely(!pgtable))
3155 @@ -735,25 +734,25 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf)
3156 }
3157 vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd);
3158 ret = 0;
3159 - set = false;
3160 if (pmd_none(*vmf->pmd)) {
3161 ret = check_stable_address_space(vma->vm_mm);
3162 if (ret) {
3163 spin_unlock(vmf->ptl);
3164 + pte_free(vma->vm_mm, pgtable);
3165 } else if (userfaultfd_missing(vma)) {
3166 spin_unlock(vmf->ptl);
3167 + pte_free(vma->vm_mm, pgtable);
3168 ret = handle_userfault(vmf, VM_UFFD_MISSING);
3169 VM_BUG_ON(ret & VM_FAULT_FALLBACK);
3170 } else {
3171 set_huge_zero_page(pgtable, vma->vm_mm, vma,
3172 haddr, vmf->pmd, zero_page);
3173 spin_unlock(vmf->ptl);
3174 - set = true;
3175 }
3176 - } else
3177 + } else {
3178 spin_unlock(vmf->ptl);
3179 - if (!set)
3180 pte_free(vma->vm_mm, pgtable);
3181 + }
3182 return ret;
3183 }
3184 gfp = alloc_hugepage_direct_gfpmask(vma);
3185 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
3186 index edf98f8588eeb..2701497edda5c 100644
3187 --- a/mm/memcontrol.c
3188 +++ b/mm/memcontrol.c
3189 @@ -776,8 +776,13 @@ void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val)
3190 rcu_read_lock();
3191 memcg = memcg_from_slab_page(page);
3192
3193 - /* Untracked pages have no memcg, no lruvec. Update only the node */
3194 - if (!memcg || memcg == root_mem_cgroup) {
3195 + /*
3196 + * Untracked pages have no memcg, no lruvec. Update only the
3197 + * node. If we reparent the slab objects to the root memcg,
3198 + * when we free the slab object, we need to update the per-memcg
3199 + * vmstats to keep it correct for the root memcg.
3200 + */
3201 + if (!memcg) {
3202 __mod_node_page_state(pgdat, idx, val);
3203 } else {
3204 lruvec = mem_cgroup_lruvec(pgdat, memcg);
3205 diff --git a/mm/page_alloc.c b/mm/page_alloc.c
3206 index c20e664866c33..1c869c6b825f3 100644
3207 --- a/mm/page_alloc.c
3208 +++ b/mm/page_alloc.c
3209 @@ -3484,7 +3484,8 @@ bool zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
3210 }
3211
3212 static inline bool zone_watermark_fast(struct zone *z, unsigned int order,
3213 - unsigned long mark, int classzone_idx, unsigned int alloc_flags)
3214 + unsigned long mark, int classzone_idx,
3215 + unsigned int alloc_flags, gfp_t gfp_mask)
3216 {
3217 long free_pages = zone_page_state(z, NR_FREE_PAGES);
3218 long cma_pages = 0;
3219 @@ -3505,8 +3506,23 @@ static inline bool zone_watermark_fast(struct zone *z, unsigned int order,
3220 if (!order && (free_pages - cma_pages) > mark + z->lowmem_reserve[classzone_idx])
3221 return true;
3222
3223 - return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags,
3224 - free_pages);
3225 + if (__zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags,
3226 + free_pages))
3227 + return true;
3228 + /*
3229 + * Ignore watermark boosting for GFP_ATOMIC order-0 allocations
3230 + * when checking the min watermark. The min watermark is the
3231 + * point where boosting is ignored so that kswapd is woken up
3232 + * when below the low watermark.
3233 + */
3234 + if (unlikely(!order && (gfp_mask & __GFP_ATOMIC) && z->watermark_boost
3235 + && ((alloc_flags & ALLOC_WMARK_MASK) == WMARK_MIN))) {
3236 + mark = z->_watermark[WMARK_MIN];
3237 + return __zone_watermark_ok(z, order, mark, classzone_idx,
3238 + alloc_flags, free_pages);
3239 + }
3240 +
3241 + return false;
3242 }
3243
3244 bool zone_watermark_ok_safe(struct zone *z, unsigned int order,
3245 @@ -3647,7 +3663,8 @@ retry:
3246
3247 mark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK);
3248 if (!zone_watermark_fast(zone, order, mark,
3249 - ac_classzone_idx(ac), alloc_flags)) {
3250 + ac_classzone_idx(ac), alloc_flags,
3251 + gfp_mask)) {
3252 int ret;
3253
3254 #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
3255 @@ -4910,6 +4927,11 @@ refill:
3256 if (!page_ref_sub_and_test(page, nc->pagecnt_bias))
3257 goto refill;
3258
3259 + if (unlikely(nc->pfmemalloc)) {
3260 + free_the_page(page, compound_order(page));
3261 + goto refill;
3262 + }
3263 +
3264 #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE)
3265 /* if size can vary use size else just use PAGE_SIZE */
3266 size = nc->size;
3267 diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
3268 index 022dc6e504c4b..b99efa42e81dc 100644
3269 --- a/net/bridge/br_device.c
3270 +++ b/net/bridge/br_device.c
3271 @@ -214,6 +214,7 @@ static void br_get_stats64(struct net_device *dev,
3272 sum.rx_packets += tmp.rx_packets;
3273 }
3274
3275 + netdev_stats_to_stats64(stats, &dev->stats);
3276 stats->tx_bytes = sum.tx_bytes;
3277 stats->tx_packets = sum.tx_packets;
3278 stats->rx_bytes = sum.rx_bytes;
3279 diff --git a/net/can/af_can.c b/net/can/af_can.c
3280 index 128d37a4c2e0b..fd6ef6d26846f 100644
3281 --- a/net/can/af_can.c
3282 +++ b/net/can/af_can.c
3283 @@ -675,16 +675,25 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
3284 {
3285 struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
3286
3287 - if (unlikely(dev->type != ARPHRD_CAN || skb->len != CAN_MTU ||
3288 - cfd->len > CAN_MAX_DLEN)) {
3289 - pr_warn_once("PF_CAN: dropped non conform CAN skbuf: dev type %d, len %d, datalen %d\n",
3290 + if (unlikely(dev->type != ARPHRD_CAN || skb->len != CAN_MTU)) {
3291 + pr_warn_once("PF_CAN: dropped non conform CAN skbuff: dev type %d, len %d\n",
3292 + dev->type, skb->len);
3293 + goto free_skb;
3294 + }
3295 +
3296 + /* This check is made separately since cfd->len would be uninitialized if skb->len = 0. */
3297 + if (unlikely(cfd->len > CAN_MAX_DLEN)) {
3298 + pr_warn_once("PF_CAN: dropped non conform CAN skbuff: dev type %d, len %d, datalen %d\n",
3299 dev->type, skb->len, cfd->len);
3300 - kfree_skb(skb);
3301 - return NET_RX_DROP;
3302 + goto free_skb;
3303 }
3304
3305 can_receive(skb, dev);
3306 return NET_RX_SUCCESS;
3307 +
3308 +free_skb:
3309 + kfree_skb(skb);
3310 + return NET_RX_DROP;
3311 }
3312
3313 static int canfd_rcv(struct sk_buff *skb, struct net_device *dev,
3314 @@ -692,16 +701,25 @@ static int canfd_rcv(struct sk_buff *skb, struct net_device *dev,
3315 {
3316 struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
3317
3318 - if (unlikely(dev->type != ARPHRD_CAN || skb->len != CANFD_MTU ||
3319 - cfd->len > CANFD_MAX_DLEN)) {
3320 - pr_warn_once("PF_CAN: dropped non conform CAN FD skbuf: dev type %d, len %d, datalen %d\n",
3321 + if (unlikely(dev->type != ARPHRD_CAN || skb->len != CANFD_MTU)) {
3322 + pr_warn_once("PF_CAN: dropped non conform CAN FD skbuff: dev type %d, len %d\n",
3323 + dev->type, skb->len);
3324 + goto free_skb;
3325 + }
3326 +
3327 + /* This check is made separately since cfd->len would be uninitialized if skb->len = 0. */
3328 + if (unlikely(cfd->len > CANFD_MAX_DLEN)) {
3329 + pr_warn_once("PF_CAN: dropped non conform CAN FD skbuff: dev type %d, len %d, datalen %d\n",
3330 dev->type, skb->len, cfd->len);
3331 - kfree_skb(skb);
3332 - return NET_RX_DROP;
3333 + goto free_skb;
3334 }
3335
3336 can_receive(skb, dev);
3337 return NET_RX_SUCCESS;
3338 +
3339 +free_skb:
3340 + kfree_skb(skb);
3341 + return NET_RX_DROP;
3342 }
3343
3344 /* af_can protocol functions */
3345 diff --git a/net/core/devlink.c b/net/core/devlink.c
3346 index 26c8993a17ae0..79f54ae714229 100644
3347 --- a/net/core/devlink.c
3348 +++ b/net/core/devlink.c
3349 @@ -1144,7 +1144,7 @@ static int devlink_nl_sb_port_pool_fill(struct sk_buff *msg,
3350 err = ops->sb_occ_port_pool_get(devlink_port, devlink_sb->index,
3351 pool_index, &cur, &max);
3352 if (err && err != -EOPNOTSUPP)
3353 - return err;
3354 + goto sb_occ_get_failure;
3355 if (!err) {
3356 if (nla_put_u32(msg, DEVLINK_ATTR_SB_OCC_CUR, cur))
3357 goto nla_put_failure;
3358 @@ -1157,8 +1157,10 @@ static int devlink_nl_sb_port_pool_fill(struct sk_buff *msg,
3359 return 0;
3360
3361 nla_put_failure:
3362 + err = -EMSGSIZE;
3363 +sb_occ_get_failure:
3364 genlmsg_cancel(msg, hdr);
3365 - return -EMSGSIZE;
3366 + return err;
3367 }
3368
3369 static int devlink_nl_cmd_sb_port_pool_get_doit(struct sk_buff *skb,
3370 diff --git a/net/core/neighbour.c b/net/core/neighbour.c
3371 index 04953e5f25302..6c270fce200f4 100644
3372 --- a/net/core/neighbour.c
3373 +++ b/net/core/neighbour.c
3374 @@ -235,6 +235,8 @@ static int neigh_forced_gc(struct neigh_table *tbl)
3375
3376 write_lock(&n->lock);
3377 if ((n->nud_state == NUD_FAILED) ||
3378 + (tbl->is_multicast &&
3379 + tbl->is_multicast(n->primary_key)) ||
3380 time_after(tref, n->updated))
3381 remove = true;
3382 write_unlock(&n->lock);
3383 diff --git a/net/core/netpoll.c b/net/core/netpoll.c
3384 index cb67d36f3adb0..78bbb912e5025 100644
3385 --- a/net/core/netpoll.c
3386 +++ b/net/core/netpoll.c
3387 @@ -29,6 +29,7 @@
3388 #include <linux/slab.h>
3389 #include <linux/export.h>
3390 #include <linux/if_vlan.h>
3391 +#include <net/dsa.h>
3392 #include <net/tcp.h>
3393 #include <net/udp.h>
3394 #include <net/addrconf.h>
3395 @@ -637,15 +638,15 @@ EXPORT_SYMBOL_GPL(__netpoll_setup);
3396
3397 int netpoll_setup(struct netpoll *np)
3398 {
3399 - struct net_device *ndev = NULL;
3400 + struct net_device *ndev = NULL, *dev = NULL;
3401 + struct net *net = current->nsproxy->net_ns;
3402 struct in_device *in_dev;
3403 int err;
3404
3405 rtnl_lock();
3406 - if (np->dev_name[0]) {
3407 - struct net *net = current->nsproxy->net_ns;
3408 + if (np->dev_name[0])
3409 ndev = __dev_get_by_name(net, np->dev_name);
3410 - }
3411 +
3412 if (!ndev) {
3413 np_err(np, "%s doesn't exist, aborting\n", np->dev_name);
3414 err = -ENODEV;
3415 @@ -653,6 +654,19 @@ int netpoll_setup(struct netpoll *np)
3416 }
3417 dev_hold(ndev);
3418
3419 + /* bring up DSA management network devices up first */
3420 + for_each_netdev(net, dev) {
3421 + if (!netdev_uses_dsa(dev))
3422 + continue;
3423 +
3424 + err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
3425 + if (err < 0) {
3426 + np_err(np, "%s failed to open %s\n",
3427 + np->dev_name, dev->name);
3428 + goto put;
3429 + }
3430 + }
3431 +
3432 if (netdev_master_upper_dev_get(ndev)) {
3433 np_err(np, "%s is a slave device, aborting\n", np->dev_name);
3434 err = -EBUSY;
3435 diff --git a/net/core/skmsg.c b/net/core/skmsg.c
3436 index 118cf1ace43a6..17cc1edd149cb 100644
3437 --- a/net/core/skmsg.c
3438 +++ b/net/core/skmsg.c
3439 @@ -170,10 +170,12 @@ static int sk_msg_free_elem(struct sock *sk, struct sk_msg *msg, u32 i,
3440 struct scatterlist *sge = sk_msg_elem(msg, i);
3441 u32 len = sge->length;
3442
3443 - if (charge)
3444 - sk_mem_uncharge(sk, len);
3445 - if (!msg->skb)
3446 + /* When the skb owns the memory we free it from consume_skb path. */
3447 + if (!msg->skb) {
3448 + if (charge)
3449 + sk_mem_uncharge(sk, len);
3450 put_page(sg_page(sge));
3451 + }
3452 memset(sge, 0, sizeof(*sge));
3453 return len;
3454 }
3455 @@ -397,28 +399,38 @@ out:
3456 }
3457 EXPORT_SYMBOL_GPL(sk_msg_memcopy_from_iter);
3458
3459 -static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb)
3460 +static struct sk_msg *sk_psock_create_ingress_msg(struct sock *sk,
3461 + struct sk_buff *skb)
3462 {
3463 - struct sock *sk = psock->sk;
3464 - int copied = 0, num_sge;
3465 struct sk_msg *msg;
3466
3467 + if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf)
3468 + return NULL;
3469 +
3470 + if (!sk_rmem_schedule(sk, skb, skb->truesize))
3471 + return NULL;
3472 +
3473 msg = kzalloc(sizeof(*msg), __GFP_NOWARN | GFP_ATOMIC);
3474 if (unlikely(!msg))
3475 - return -EAGAIN;
3476 - if (!sk_rmem_schedule(sk, skb, skb->len)) {
3477 - kfree(msg);
3478 - return -EAGAIN;
3479 - }
3480 + return NULL;
3481
3482 sk_msg_init(msg);
3483 - num_sge = skb_to_sgvec(skb, msg->sg.data, 0, skb->len);
3484 + return msg;
3485 +}
3486 +
3487 +static int sk_psock_skb_ingress_enqueue(struct sk_buff *skb,
3488 + struct sk_psock *psock,
3489 + struct sock *sk,
3490 + struct sk_msg *msg)
3491 +{
3492 + int num_sge = skb_to_sgvec(skb, msg->sg.data, 0, skb->len);
3493 + int copied;
3494 +
3495 if (unlikely(num_sge < 0)) {
3496 kfree(msg);
3497 return num_sge;
3498 }
3499
3500 - sk_mem_charge(sk, skb->len);
3501 copied = skb->len;
3502 msg->sg.start = 0;
3503 msg->sg.size = copied;
3504 @@ -430,6 +442,40 @@ static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb)
3505 return copied;
3506 }
3507
3508 +static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb)
3509 +{
3510 + struct sock *sk = psock->sk;
3511 + struct sk_msg *msg;
3512 +
3513 + msg = sk_psock_create_ingress_msg(sk, skb);
3514 + if (!msg)
3515 + return -EAGAIN;
3516 +
3517 + /* This will transition ownership of the data from the socket where
3518 + * the BPF program was run initiating the redirect to the socket
3519 + * we will eventually receive this data on. The data will be released
3520 + * from skb_consume found in __tcp_bpf_recvmsg() after its been copied
3521 + * into user buffers.
3522 + */
3523 + skb_set_owner_r(skb, sk);
3524 + return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg);
3525 +}
3526 +
3527 +/* Puts an skb on the ingress queue of the socket already assigned to the
3528 + * skb. In this case we do not need to check memory limits or skb_set_owner_r
3529 + * because the skb is already accounted for here.
3530 + */
3531 +static int sk_psock_skb_ingress_self(struct sk_psock *psock, struct sk_buff *skb)
3532 +{
3533 + struct sk_msg *msg = kzalloc(sizeof(*msg), __GFP_NOWARN | GFP_ATOMIC);
3534 + struct sock *sk = psock->sk;
3535 +
3536 + if (unlikely(!msg))
3537 + return -EAGAIN;
3538 + sk_msg_init(msg);
3539 + return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg);
3540 +}
3541 +
3542 static int sk_psock_handle_skb(struct sk_psock *psock, struct sk_buff *skb,
3543 u32 off, u32 len, bool ingress)
3544 {
3545 @@ -753,7 +799,9 @@ EXPORT_SYMBOL_GPL(sk_psock_tls_strp_read);
3546 static void sk_psock_verdict_apply(struct sk_psock *psock,
3547 struct sk_buff *skb, int verdict)
3548 {
3549 + struct tcp_skb_cb *tcp;
3550 struct sock *sk_other;
3551 + int err = -EIO;
3552
3553 switch (verdict) {
3554 case __SK_PASS:
3555 @@ -762,16 +810,24 @@ static void sk_psock_verdict_apply(struct sk_psock *psock,
3556 !sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) {
3557 goto out_free;
3558 }
3559 - if (atomic_read(&sk_other->sk_rmem_alloc) <=
3560 - sk_other->sk_rcvbuf) {
3561 - struct tcp_skb_cb *tcp = TCP_SKB_CB(skb);
3562
3563 - tcp->bpf.flags |= BPF_F_INGRESS;
3564 + tcp = TCP_SKB_CB(skb);
3565 + tcp->bpf.flags |= BPF_F_INGRESS;
3566 +
3567 + /* If the queue is empty then we can submit directly
3568 + * into the msg queue. If its not empty we have to
3569 + * queue work otherwise we may get OOO data. Otherwise,
3570 + * if sk_psock_skb_ingress errors will be handled by
3571 + * retrying later from workqueue.
3572 + */
3573 + if (skb_queue_empty(&psock->ingress_skb)) {
3574 + err = sk_psock_skb_ingress_self(psock, skb);
3575 + }
3576 + if (err < 0) {
3577 skb_queue_tail(&psock->ingress_skb, skb);
3578 schedule_work(&psock->work);
3579 - break;
3580 }
3581 - goto out_free;
3582 + break;
3583 case __SK_REDIRECT:
3584 sk_psock_skb_redirect(skb);
3585 break;
3586 diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
3587 index 05eb42f347e8f..7b951992c372b 100644
3588 --- a/net/ipv4/arp.c
3589 +++ b/net/ipv4/arp.c
3590 @@ -125,6 +125,7 @@ static int arp_constructor(struct neighbour *neigh);
3591 static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb);
3592 static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb);
3593 static void parp_redo(struct sk_buff *skb);
3594 +static int arp_is_multicast(const void *pkey);
3595
3596 static const struct neigh_ops arp_generic_ops = {
3597 .family = AF_INET,
3598 @@ -156,6 +157,7 @@ struct neigh_table arp_tbl = {
3599 .key_eq = arp_key_eq,
3600 .constructor = arp_constructor,
3601 .proxy_redo = parp_redo,
3602 + .is_multicast = arp_is_multicast,
3603 .id = "arp_cache",
3604 .parms = {
3605 .tbl = &arp_tbl,
3606 @@ -928,6 +930,10 @@ static void parp_redo(struct sk_buff *skb)
3607 arp_process(dev_net(skb->dev), NULL, skb);
3608 }
3609
3610 +static int arp_is_multicast(const void *pkey)
3611 +{
3612 + return ipv4_is_multicast(*((__be32 *)pkey));
3613 +}
3614
3615 /*
3616 * Receive an arp request from the device layer.
3617 diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
3618 index 5b68bdaa8bff8..4f71aca156662 100644
3619 --- a/net/ipv4/inet_diag.c
3620 +++ b/net/ipv4/inet_diag.c
3621 @@ -388,8 +388,10 @@ static int inet_req_diag_fill(struct sock *sk, struct sk_buff *skb,
3622 r->idiag_inode = 0;
3623
3624 if (net_admin && nla_put_u32(skb, INET_DIAG_MARK,
3625 - inet_rsk(reqsk)->ir_mark))
3626 + inet_rsk(reqsk)->ir_mark)) {
3627 + nlmsg_cancel(skb, nlh);
3628 return -EMSGSIZE;
3629 + }
3630
3631 nlmsg_end(skb, nlh);
3632 return 0;
3633 diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c
3634 index 6c4d79baff269..6ea3dc2e42194 100644
3635 --- a/net/ipv4/tcp_bbr.c
3636 +++ b/net/ipv4/tcp_bbr.c
3637 @@ -945,7 +945,7 @@ static void bbr_update_min_rtt(struct sock *sk, const struct rate_sample *rs)
3638 filter_expired = after(tcp_jiffies32,
3639 bbr->min_rtt_stamp + bbr_min_rtt_win_sec * HZ);
3640 if (rs->rtt_us >= 0 &&
3641 - (rs->rtt_us <= bbr->min_rtt_us ||
3642 + (rs->rtt_us < bbr->min_rtt_us ||
3643 (filter_expired && !rs->is_ack_delayed))) {
3644 bbr->min_rtt_us = rs->rtt_us;
3645 bbr->min_rtt_stamp = tcp_jiffies32;
3646 diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
3647 index ad9f382027311..819255ee4e42d 100644
3648 --- a/net/ipv4/tcp_bpf.c
3649 +++ b/net/ipv4/tcp_bpf.c
3650 @@ -47,8 +47,8 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock,
3651 {
3652 struct iov_iter *iter = &msg->msg_iter;
3653 int peek = flags & MSG_PEEK;
3654 - int i, ret, copied = 0;
3655 struct sk_msg *msg_rx;
3656 + int i, copied = 0;
3657
3658 msg_rx = list_first_entry_or_null(&psock->ingress_msg,
3659 struct sk_msg, list);
3660 @@ -69,17 +69,16 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock,
3661 page = sg_page(sge);
3662 if (copied + copy > len)
3663 copy = len - copied;
3664 - ret = copy_page_to_iter(page, sge->offset, copy, iter);
3665 - if (ret != copy) {
3666 - msg_rx->sg.start = i;
3667 - return -EFAULT;
3668 - }
3669 + copy = copy_page_to_iter(page, sge->offset, copy, iter);
3670 + if (!copy)
3671 + return copied ? copied : -EFAULT;
3672
3673 copied += copy;
3674 if (likely(!peek)) {
3675 sge->offset += copy;
3676 sge->length -= copy;
3677 - sk_mem_uncharge(sk, copy);
3678 + if (!msg_rx->skb)
3679 + sk_mem_uncharge(sk, copy);
3680 msg_rx->sg.size -= copy;
3681
3682 if (!sge->length) {
3683 @@ -88,6 +87,11 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock,
3684 put_page(page);
3685 }
3686 } else {
3687 + /* Lets not optimize peek case if copy_page_to_iter
3688 + * didn't copy the entire length lets just break.
3689 + */
3690 + if (copy != sge->length)
3691 + return copied;
3692 sk_msg_iter_var_next(i);
3693 }
3694
3695 diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
3696 index 6e1d200f30c19..635b2482fa204 100644
3697 --- a/net/ipv6/addrconf.c
3698 +++ b/net/ipv6/addrconf.c
3699 @@ -4984,8 +4984,10 @@ static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca,
3700 return -EMSGSIZE;
3701
3702 if (args->netnsid >= 0 &&
3703 - nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid))
3704 + nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) {
3705 + nlmsg_cancel(skb, nlh);
3706 return -EMSGSIZE;
3707 + }
3708
3709 put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex);
3710 if (nla_put_in6_addr(skb, IFA_MULTICAST, &ifmca->mca_addr) < 0 ||
3711 @@ -5016,8 +5018,10 @@ static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca,
3712 return -EMSGSIZE;
3713
3714 if (args->netnsid >= 0 &&
3715 - nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid))
3716 + nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) {
3717 + nlmsg_cancel(skb, nlh);
3718 return -EMSGSIZE;
3719 + }
3720
3721 put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex);
3722 if (nla_put_in6_addr(skb, IFA_ANYCAST, &ifaca->aca_addr) < 0 ||
3723 diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
3724 index 95835e8d99aa5..1c5ecd07a43e1 100644
3725 --- a/net/ipv6/ah6.c
3726 +++ b/net/ipv6/ah6.c
3727 @@ -588,7 +588,8 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
3728 memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len);
3729 memset(ah->auth_data, 0, ahp->icv_trunc_len);
3730
3731 - if (ipv6_clear_mutable_options(ip6h, hdr_len, XFRM_POLICY_IN))
3732 + err = ipv6_clear_mutable_options(ip6h, hdr_len, XFRM_POLICY_IN);
3733 + if (err)
3734 goto out_free;
3735
3736 ip6h->priority = 0;
3737 diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
3738 index 53caf59c591e3..118e19cabb72b 100644
3739 --- a/net/ipv6/ndisc.c
3740 +++ b/net/ipv6/ndisc.c
3741 @@ -81,6 +81,7 @@ static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb);
3742 static int pndisc_constructor(struct pneigh_entry *n);
3743 static void pndisc_destructor(struct pneigh_entry *n);
3744 static void pndisc_redo(struct sk_buff *skb);
3745 +static int ndisc_is_multicast(const void *pkey);
3746
3747 static const struct neigh_ops ndisc_generic_ops = {
3748 .family = AF_INET6,
3749 @@ -115,6 +116,7 @@ struct neigh_table nd_tbl = {
3750 .pconstructor = pndisc_constructor,
3751 .pdestructor = pndisc_destructor,
3752 .proxy_redo = pndisc_redo,
3753 + .is_multicast = ndisc_is_multicast,
3754 .allow_add = ndisc_allow_add,
3755 .id = "ndisc_cache",
3756 .parms = {
3757 @@ -1705,6 +1707,11 @@ static void pndisc_redo(struct sk_buff *skb)
3758 kfree_skb(skb);
3759 }
3760
3761 +static int ndisc_is_multicast(const void *pkey)
3762 +{
3763 + return ipv6_addr_is_multicast((struct in6_addr *)pkey);
3764 +}
3765 +
3766 static bool ndisc_suppress_frag_ndisc(struct sk_buff *skb)
3767 {
3768 struct inet6_dev *idev = __in6_dev_get(skb->dev);
3769 diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
3770 index ee86c3333999a..7227343551e99 100644
3771 --- a/net/mac80211/rc80211_minstrel.c
3772 +++ b/net/mac80211/rc80211_minstrel.c
3773 @@ -270,7 +270,7 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband,
3774 success = !!(info->flags & IEEE80211_TX_STAT_ACK);
3775
3776 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
3777 - if (ar[i].idx < 0)
3778 + if (ar[i].idx < 0 || !ar[i].count)
3779 break;
3780
3781 ndx = rix_to_ndx(mi, ar[i].idx);
3782 @@ -283,12 +283,6 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband,
3783 mi->r[ndx].stats.success += success;
3784 }
3785
3786 - if ((info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) && (i >= 0))
3787 - mi->sample_packets++;
3788 -
3789 - if (mi->sample_deferred > 0)
3790 - mi->sample_deferred--;
3791 -
3792 if (time_after(jiffies, mi->last_stats_update +
3793 (mp->update_interval * HZ) / 1000))
3794 minstrel_update_stats(mp, mi);
3795 @@ -363,7 +357,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
3796 return;
3797
3798 delta = (mi->total_packets * sampling_ratio / 100) -
3799 - (mi->sample_packets + mi->sample_deferred / 2);
3800 + mi->sample_packets;
3801
3802 /* delta < 0: no sampling required */
3803 prev_sample = mi->prev_sample;
3804 @@ -372,7 +366,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
3805 return;
3806
3807 if (mi->total_packets >= 10000) {
3808 - mi->sample_deferred = 0;
3809 mi->sample_packets = 0;
3810 mi->total_packets = 0;
3811 } else if (delta > mi->n_rates * 2) {
3812 @@ -397,19 +390,8 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
3813 * rate sampling method should be used.
3814 * Respect such rates that are not sampled for 20 interations.
3815 */
3816 - if (mrr_capable &&
3817 - msr->perfect_tx_time > mr->perfect_tx_time &&
3818 - msr->stats.sample_skipped < 20) {
3819 - /* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark
3820 - * packets that have the sampling rate deferred to the
3821 - * second MRR stage. Increase the sample counter only
3822 - * if the deferred sample rate was actually used.
3823 - * Use the sample_deferred counter to make sure that
3824 - * the sampling is not done in large bursts */
3825 - info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
3826 - rate++;
3827 - mi->sample_deferred++;
3828 - } else {
3829 + if (msr->perfect_tx_time < mr->perfect_tx_time ||
3830 + msr->stats.sample_skipped >= 20) {
3831 if (!msr->sample_limit)
3832 return;
3833
3834 @@ -429,6 +411,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
3835
3836 rate->idx = mi->r[ndx].rix;
3837 rate->count = minstrel_get_retry_count(&mi->r[ndx], info);
3838 + info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
3839 }
3840
3841
3842 diff --git a/net/mac80211/rc80211_minstrel.h b/net/mac80211/rc80211_minstrel.h
3843 index 51d8b2c846e77..3112d85a014df 100644
3844 --- a/net/mac80211/rc80211_minstrel.h
3845 +++ b/net/mac80211/rc80211_minstrel.h
3846 @@ -79,7 +79,6 @@ struct minstrel_sta_info {
3847 u8 max_prob_rate;
3848 unsigned int total_packets;
3849 unsigned int sample_packets;
3850 - int sample_deferred;
3851
3852 unsigned int sample_row;
3853 unsigned int sample_column;
3854 diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
3855 index 38bb6d512b36d..4a23996dce044 100644
3856 --- a/net/mac80211/sta_info.c
3857 +++ b/net/mac80211/sta_info.c
3858 @@ -688,7 +688,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
3859 out_drop_sta:
3860 local->num_sta--;
3861 synchronize_net();
3862 - __cleanup_single_sta(sta);
3863 + cleanup_single_sta(sta);
3864 out_err:
3865 mutex_unlock(&local->sta_mtx);
3866 kfree(sinfo);
3867 @@ -707,19 +707,13 @@ int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU)
3868
3869 err = sta_info_insert_check(sta);
3870 if (err) {
3871 + sta_info_free(local, sta);
3872 mutex_unlock(&local->sta_mtx);
3873 rcu_read_lock();
3874 - goto out_free;
3875 + return err;
3876 }
3877
3878 - err = sta_info_insert_finish(sta);
3879 - if (err)
3880 - goto out_free;
3881 -
3882 - return 0;
3883 - out_free:
3884 - sta_info_free(local, sta);
3885 - return err;
3886 + return sta_info_insert_finish(sta);
3887 }
3888
3889 int sta_info_insert(struct sta_info *sta)
3890 diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
3891 index 70fe02697544f..4910e61622329 100644
3892 --- a/net/ncsi/ncsi-manage.c
3893 +++ b/net/ncsi/ncsi-manage.c
3894 @@ -1667,9 +1667,6 @@ struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
3895 ndp->ptype.dev = dev;
3896 dev_add_pack(&ndp->ptype);
3897
3898 - /* Set up generic netlink interface */
3899 - ncsi_init_netlink(dev);
3900 -
3901 return nd;
3902 }
3903 EXPORT_SYMBOL_GPL(ncsi_register_dev);
3904 @@ -1826,8 +1823,6 @@ void ncsi_unregister_dev(struct ncsi_dev *nd)
3905 list_del_rcu(&ndp->node);
3906 spin_unlock_irqrestore(&ncsi_dev_lock, flags);
3907
3908 - ncsi_unregister_netlink(nd->dev);
3909 -
3910 kfree(ndp);
3911 }
3912 EXPORT_SYMBOL_GPL(ncsi_unregister_dev);
3913 diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c
3914 index 8b386d766e7d3..a33ea45dec054 100644
3915 --- a/net/ncsi/ncsi-netlink.c
3916 +++ b/net/ncsi/ncsi-netlink.c
3917 @@ -766,24 +766,8 @@ static struct genl_family ncsi_genl_family __ro_after_init = {
3918 .n_ops = ARRAY_SIZE(ncsi_ops),
3919 };
3920
3921 -int ncsi_init_netlink(struct net_device *dev)
3922 +static int __init ncsi_init_netlink(void)
3923 {
3924 - int rc;
3925 -
3926 - rc = genl_register_family(&ncsi_genl_family);
3927 - if (rc)
3928 - netdev_err(dev, "ncsi: failed to register netlink family\n");
3929 -
3930 - return rc;
3931 -}
3932 -
3933 -int ncsi_unregister_netlink(struct net_device *dev)
3934 -{
3935 - int rc;
3936 -
3937 - rc = genl_unregister_family(&ncsi_genl_family);
3938 - if (rc)
3939 - netdev_err(dev, "ncsi: failed to unregister netlink family\n");
3940 -
3941 - return rc;
3942 + return genl_register_family(&ncsi_genl_family);
3943 }
3944 +subsys_initcall(ncsi_init_netlink);
3945 diff --git a/net/ncsi/ncsi-netlink.h b/net/ncsi/ncsi-netlink.h
3946 index 7502723fba837..39a1a9d7bf77e 100644
3947 --- a/net/ncsi/ncsi-netlink.h
3948 +++ b/net/ncsi/ncsi-netlink.h
3949 @@ -22,7 +22,4 @@ int ncsi_send_netlink_err(struct net_device *dev,
3950 struct nlmsghdr *nlhdr,
3951 int err);
3952
3953 -int ncsi_init_netlink(struct net_device *dev);
3954 -int ncsi_unregister_netlink(struct net_device *dev);
3955 -
3956 #endif /* __NCSI_NETLINK_H__ */
3957 diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
3958 index d2e4ab8d1cb10..7b62cdea61631 100644
3959 --- a/net/netlabel/netlabel_unlabeled.c
3960 +++ b/net/netlabel/netlabel_unlabeled.c
3961 @@ -1165,12 +1165,13 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
3962 struct netlbl_unlhsh_walk_arg cb_arg;
3963 u32 skip_bkt = cb->args[0];
3964 u32 skip_chain = cb->args[1];
3965 - u32 iter_bkt;
3966 - u32 iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0;
3967 + u32 skip_addr4 = cb->args[2];
3968 + u32 iter_bkt, iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0;
3969 struct netlbl_unlhsh_iface *iface;
3970 struct list_head *iter_list;
3971 struct netlbl_af4list *addr4;
3972 #if IS_ENABLED(CONFIG_IPV6)
3973 + u32 skip_addr6 = cb->args[3];
3974 struct netlbl_af6list *addr6;
3975 #endif
3976
3977 @@ -1181,7 +1182,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
3978 rcu_read_lock();
3979 for (iter_bkt = skip_bkt;
3980 iter_bkt < rcu_dereference(netlbl_unlhsh)->size;
3981 - iter_bkt++, iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0) {
3982 + iter_bkt++) {
3983 iter_list = &rcu_dereference(netlbl_unlhsh)->tbl[iter_bkt];
3984 list_for_each_entry_rcu(iface, iter_list, list) {
3985 if (!iface->valid ||
3986 @@ -1189,7 +1190,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
3987 continue;
3988 netlbl_af4list_foreach_rcu(addr4,
3989 &iface->addr4_list) {
3990 - if (iter_addr4++ < cb->args[2])
3991 + if (iter_addr4++ < skip_addr4)
3992 continue;
3993 if (netlbl_unlabel_staticlist_gen(
3994 NLBL_UNLABEL_C_STATICLIST,
3995 @@ -1202,10 +1203,12 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
3996 goto unlabel_staticlist_return;
3997 }
3998 }
3999 + iter_addr4 = 0;
4000 + skip_addr4 = 0;
4001 #if IS_ENABLED(CONFIG_IPV6)
4002 netlbl_af6list_foreach_rcu(addr6,
4003 &iface->addr6_list) {
4004 - if (iter_addr6++ < cb->args[3])
4005 + if (iter_addr6++ < skip_addr6)
4006 continue;
4007 if (netlbl_unlabel_staticlist_gen(
4008 NLBL_UNLABEL_C_STATICLIST,
4009 @@ -1218,8 +1221,12 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
4010 goto unlabel_staticlist_return;
4011 }
4012 }
4013 + iter_addr6 = 0;
4014 + skip_addr6 = 0;
4015 #endif /* IPv6 */
4016 }
4017 + iter_chain = 0;
4018 + skip_chain = 0;
4019 }
4020
4021 unlabel_staticlist_return:
4022 diff --git a/net/rfkill/core.c b/net/rfkill/core.c
4023 index 6c089320ae4f1..5bba7c36ac74f 100644
4024 --- a/net/rfkill/core.c
4025 +++ b/net/rfkill/core.c
4026 @@ -876,6 +876,9 @@ static int rfkill_resume(struct device *dev)
4027
4028 rfkill->suspended = false;
4029
4030 + if (!rfkill->registered)
4031 + return 0;
4032 +
4033 if (!rfkill->persistent) {
4034 cur = !!(rfkill->state & RFKILL_BLOCK_SW);
4035 rfkill_set_block(rfkill, cur);
4036 diff --git a/net/sctp/input.c b/net/sctp/input.c
4037 index 4d2bcfc9d7f88..7807754f69c56 100644
4038 --- a/net/sctp/input.c
4039 +++ b/net/sctp/input.c
4040 @@ -449,7 +449,7 @@ void sctp_icmp_proto_unreachable(struct sock *sk,
4041 else {
4042 if (!mod_timer(&t->proto_unreach_timer,
4043 jiffies + (HZ/20)))
4044 - sctp_association_hold(asoc);
4045 + sctp_transport_hold(t);
4046 }
4047 } else {
4048 struct net *net = sock_net(sk);
4049 @@ -458,7 +458,7 @@ void sctp_icmp_proto_unreachable(struct sock *sk,
4050 "encountered!\n", __func__);
4051
4052 if (del_timer(&t->proto_unreach_timer))
4053 - sctp_association_put(asoc);
4054 + sctp_transport_put(t);
4055
4056 sctp_do_sm(net, SCTP_EVENT_T_OTHER,
4057 SCTP_ST_OTHER(SCTP_EVENT_ICMP_PROTO_UNREACH),
4058 diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
4059 index 4b7edb3645c30..0d225f891b61b 100644
4060 --- a/net/sctp/sm_sideeffect.c
4061 +++ b/net/sctp/sm_sideeffect.c
4062 @@ -419,7 +419,7 @@ void sctp_generate_proto_unreach_event(struct timer_list *t)
4063 /* Try again later. */
4064 if (!mod_timer(&transport->proto_unreach_timer,
4065 jiffies + (HZ/20)))
4066 - sctp_association_hold(asoc);
4067 + sctp_transport_hold(transport);
4068 goto out_unlock;
4069 }
4070
4071 @@ -435,7 +435,7 @@ void sctp_generate_proto_unreach_event(struct timer_list *t)
4072
4073 out_unlock:
4074 bh_unlock_sock(sk);
4075 - sctp_association_put(asoc);
4076 + sctp_transport_put(transport);
4077 }
4078
4079 /* Handle the timeout of the RE-CONFIG timer. */
4080 diff --git a/net/sctp/transport.c b/net/sctp/transport.c
4081 index 3bbe1a58ec876..a3dc5037c1eb7 100644
4082 --- a/net/sctp/transport.c
4083 +++ b/net/sctp/transport.c
4084 @@ -133,7 +133,7 @@ void sctp_transport_free(struct sctp_transport *transport)
4085
4086 /* Delete the ICMP proto unreachable timer if it's active. */
4087 if (del_timer(&transport->proto_unreach_timer))
4088 - sctp_association_put(transport->asoc);
4089 + sctp_transport_put(transport);
4090
4091 sctp_transport_put(transport);
4092 }
4093 diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c
4094 index d74a71dff5b87..a2bc7e096ef8a 100644
4095 --- a/net/smc/smc_ib.c
4096 +++ b/net/smc/smc_ib.c
4097 @@ -191,9 +191,9 @@ int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
4098 rcu_read_lock();
4099 ndev = rdma_read_gid_attr_ndev_rcu(attr);
4100 if (!IS_ERR(ndev) &&
4101 - ((!vlan_id && !is_vlan_dev(attr->ndev)) ||
4102 - (vlan_id && is_vlan_dev(attr->ndev) &&
4103 - vlan_dev_vlan_id(attr->ndev) == vlan_id)) &&
4104 + ((!vlan_id && !is_vlan_dev(ndev)) ||
4105 + (vlan_id && is_vlan_dev(ndev) &&
4106 + vlan_dev_vlan_id(ndev) == vlan_id)) &&
4107 attr->gid_type == IB_GID_TYPE_ROCE) {
4108 rcu_read_unlock();
4109 if (gid)
4110 diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
4111 index 515d295309a86..57032b7ad0239 100644
4112 --- a/net/tls/tls_sw.c
4113 +++ b/net/tls/tls_sw.c
4114 @@ -1907,7 +1907,7 @@ pick_next_record:
4115 * another message type
4116 */
4117 msg->msg_flags |= MSG_EOR;
4118 - if (ctx->control != TLS_RECORD_TYPE_DATA)
4119 + if (control != TLS_RECORD_TYPE_DATA)
4120 goto recv_end;
4121 } else {
4122 break;
4123 diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
4124 index 5e8146fcb5835..54351e5ba0470 100644
4125 --- a/net/x25/af_x25.c
4126 +++ b/net/x25/af_x25.c
4127 @@ -1044,6 +1044,7 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
4128 makex25->lci = lci;
4129 makex25->dest_addr = dest_addr;
4130 makex25->source_addr = source_addr;
4131 + x25_neigh_hold(nb);
4132 makex25->neighbour = nb;
4133 makex25->facilities = facilities;
4134 makex25->dte_facilities= dte_facilities;
4135 diff --git a/sound/core/control.c b/sound/core/control.c
4136 index 08ca7666e84cf..15efa4b6ea944 100644
4137 --- a/sound/core/control.c
4138 +++ b/sound/core/control.c
4139 @@ -1350,7 +1350,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
4140
4141 unlock:
4142 up_write(&card->controls_rwsem);
4143 - return 0;
4144 + return err;
4145 }
4146
4147 static int snd_ctl_elem_add_user(struct snd_ctl_file *file,
4148 diff --git a/sound/firewire/fireworks/fireworks_transaction.c b/sound/firewire/fireworks/fireworks_transaction.c
4149 index 0f533f5bd960f..9f8c53b39f958 100644
4150 --- a/sound/firewire/fireworks/fireworks_transaction.c
4151 +++ b/sound/firewire/fireworks/fireworks_transaction.c
4152 @@ -123,7 +123,7 @@ copy_resp_to_buf(struct snd_efw *efw, void *data, size_t length, int *rcode)
4153 t = (struct snd_efw_transaction *)data;
4154 length = min_t(size_t, be32_to_cpu(t->length) * sizeof(u32), length);
4155
4156 - spin_lock_irq(&efw->lock);
4157 + spin_lock(&efw->lock);
4158
4159 if (efw->push_ptr < efw->pull_ptr)
4160 capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr);
4161 @@ -190,7 +190,7 @@ handle_resp_for_user(struct fw_card *card, int generation, int source,
4162
4163 copy_resp_to_buf(efw, data, length, rcode);
4164 end:
4165 - spin_unlock_irq(&instances_lock);
4166 + spin_unlock(&instances_lock);
4167 }
4168
4169 static void
4170 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
4171 index d25c3bee56f87..bd802cbc1165a 100644
4172 --- a/sound/pci/hda/patch_realtek.c
4173 +++ b/sound/pci/hda/patch_realtek.c
4174 @@ -2513,13 +2513,23 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
4175 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
4176 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
4177 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
4178 + SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
4179 + SND_PCI_QUIRK(0x1558, 0x950A, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
4180 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
4181 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
4182 + SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
4183 + SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
4184 + SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
4185 + SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
4186 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
4187 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
4188 + SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
4189 + SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4190 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4191 + SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4192 + SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4193 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4194 - SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4195 + SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4196 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4197 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
4198 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
4199 @@ -6283,6 +6293,7 @@ enum {
4200 ALC274_FIXUP_HP_MIC,
4201 ALC274_FIXUP_HP_HEADSET_MIC,
4202 ALC256_FIXUP_ASUS_HPE,
4203 + ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
4204 };
4205
4206 static const struct hda_fixup alc269_fixups[] = {
4207 @@ -7687,6 +7698,12 @@ static const struct hda_fixup alc269_fixups[] = {
4208 .chained = true,
4209 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
4210 },
4211 + [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
4212 + .type = HDA_FIXUP_FUNC,
4213 + .v.func = alc_fixup_headset_jack,
4214 + .chained = true,
4215 + .chain_id = ALC269_FIXUP_THINKPAD_ACPI
4216 + },
4217 };
4218
4219 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4220 @@ -7906,11 +7923,49 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4221 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
4222 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
4223 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
4224 + SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4225 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4226 + SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4227 + SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4228 + SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4229 + SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4230 + SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4231 + SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4232 + SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4233 + SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4234 + SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4235 + SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4236 + SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4237 + SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4238 + SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4239 + SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4240 + SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4241 + SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4242 + SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4243 + SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4244 + SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4245 + SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4246 + SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4247 + SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4248 + SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4249 + SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4250 + SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4251 + SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4252 + SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4253 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4254 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4255 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
4256 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
4257 + SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4258 + SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4259 + SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4260 + SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4261 + SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4262 + SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4263 + SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4264 + SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4265 + SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4266 + SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4267 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
4268 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
4269 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
4270 @@ -7948,6 +8003,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4271 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4272 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
4273 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
4274 + SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
4275 + SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
4276 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
4277 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
4278 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
4279 diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c
4280 index 048a2660d18d4..363b26e85af5e 100644
4281 --- a/sound/pci/mixart/mixart_core.c
4282 +++ b/sound/pci/mixart/mixart_core.c
4283 @@ -70,7 +70,6 @@ static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp,
4284 unsigned int i;
4285 #endif
4286
4287 - mutex_lock(&mgr->msg_lock);
4288 err = 0;
4289
4290 /* copy message descriptor from miXart to driver */
4291 @@ -119,8 +118,6 @@ static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp,
4292 writel_be(headptr, MIXART_MEM(mgr, MSG_OUTBOUND_FREE_HEAD));
4293
4294 _clean_exit:
4295 - mutex_unlock(&mgr->msg_lock);
4296 -
4297 return err;
4298 }
4299
4300 @@ -258,7 +255,9 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
4301 resp.data = resp_data;
4302 resp.size = max_resp_size;
4303
4304 + mutex_lock(&mgr->msg_lock);
4305 err = get_msg(mgr, &resp, msg_frame);
4306 + mutex_unlock(&mgr->msg_lock);
4307
4308 if( request->message_id != resp.message_id )
4309 dev_err(&mgr->pci->dev, "RESPONSE ERROR!\n");
4310 diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
4311 index 9acaef81dd74c..b1981d84ac18c 100644
4312 --- a/sound/soc/qcom/lpass-platform.c
4313 +++ b/sound/soc/qcom/lpass-platform.c
4314 @@ -73,8 +73,10 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
4315 else
4316 dma_ch = 0;
4317
4318 - if (dma_ch < 0)
4319 + if (dma_ch < 0) {
4320 + kfree(data);
4321 return dma_ch;
4322 + }
4323
4324 drvdata->substream[dma_ch] = substream;
4325
4326 @@ -95,6 +97,7 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
4327 ret = snd_pcm_hw_constraint_integer(runtime,
4328 SNDRV_PCM_HW_PARAM_PERIODS);
4329 if (ret < 0) {
4330 + kfree(data);
4331 dev_err(soc_runtime->dev, "setting constraints failed: %d\n",
4332 ret);
4333 return -EINVAL;
4334 diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
4335 index 825b6f2efada5..931964716228e 100644
4336 --- a/sound/usb/quirks.c
4337 +++ b/sound/usb/quirks.c
4338 @@ -1604,13 +1604,13 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
4339 && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
4340 msleep(20);
4341
4342 - /* Zoom R16/24, Logitech H650e/H570e, Jabra 550a, Kingston HyperX
4343 - * needs a tiny delay here, otherwise requests like get/set
4344 - * frequency return as failed despite actually succeeding.
4345 + /* Zoom R16/24, many Logitech(at least H650e/H570e/BCC950),
4346 + * Jabra 550a, Kingston HyperX needs a tiny delay here,
4347 + * otherwise requests like get/set frequency return
4348 + * as failed despite actually succeeding.
4349 */
4350 if ((chip->usb_id == USB_ID(0x1686, 0x00dd) ||
4351 - chip->usb_id == USB_ID(0x046d, 0x0a46) ||
4352 - chip->usb_id == USB_ID(0x046d, 0x0a56) ||
4353 + USB_ID_VENDOR(chip->usb_id) == 0x046d || /* Logitech */
4354 chip->usb_id == USB_ID(0x0b0e, 0x0349) ||
4355 chip->usb_id == USB_ID(0x0951, 0x16ad)) &&
4356 (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
4357 diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c
4358 index 4f52d31516166..bb311ccc6c487 100644
4359 --- a/tools/bpf/bpftool/net.c
4360 +++ b/tools/bpf/bpftool/net.c
4361 @@ -312,8 +312,8 @@ static int do_attach(int argc, char **argv)
4362
4363 ifindex = net_parse_dev(&argc, &argv);
4364 if (ifindex < 1) {
4365 - close(progfd);
4366 - return -EINVAL;
4367 + err = -EINVAL;
4368 + goto cleanup;
4369 }
4370
4371 if (argc) {
4372 @@ -321,8 +321,8 @@ static int do_attach(int argc, char **argv)
4373 overwrite = true;
4374 } else {
4375 p_err("expected 'overwrite', got: '%s'?", *argv);
4376 - close(progfd);
4377 - return -EINVAL;
4378 + err = -EINVAL;
4379 + goto cleanup;
4380 }
4381 }
4382
4383 @@ -330,17 +330,17 @@ static int do_attach(int argc, char **argv)
4384 if (is_prefix("xdp", attach_type_strings[attach_type]))
4385 err = do_attach_detach_xdp(progfd, attach_type, ifindex,
4386 overwrite);
4387 -
4388 - if (err < 0) {
4389 + if (err) {
4390 p_err("interface %s attach failed: %s",
4391 attach_type_strings[attach_type], strerror(-err));
4392 - return err;
4393 + goto cleanup;
4394 }
4395
4396 if (json_output)
4397 jsonw_null(json_wtr);
4398 -
4399 - return 0;
4400 +cleanup:
4401 + close(progfd);
4402 + return err;
4403 }
4404
4405 static int do_detach(int argc, char **argv)
4406 diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
4407 index 474dfd59d7eb2..d06665077dfe0 100644
4408 --- a/tools/perf/builtin-lock.c
4409 +++ b/tools/perf/builtin-lock.c
4410 @@ -621,7 +621,7 @@ static int report_lock_release_event(struct evsel *evsel,
4411 case SEQ_STATE_READ_ACQUIRED:
4412 seq->read_count--;
4413 BUG_ON(seq->read_count < 0);
4414 - if (!seq->read_count) {
4415 + if (seq->read_count) {
4416 ls->nr_release++;
4417 goto end;
4418 }
4419 diff --git a/tools/testing/selftests/bpf/prog_tests/sockopt_multi.c b/tools/testing/selftests/bpf/prog_tests/sockopt_multi.c
4420 index 29188d6f5c8de..51fac975b3163 100644
4421 --- a/tools/testing/selftests/bpf/prog_tests/sockopt_multi.c
4422 +++ b/tools/testing/selftests/bpf/prog_tests/sockopt_multi.c
4423 @@ -138,7 +138,8 @@ static int run_getsockopt_test(struct bpf_object *obj, int cg_parent,
4424 */
4425
4426 buf = 0x40;
4427 - if (setsockopt(sock_fd, SOL_IP, IP_TOS, &buf, 1) < 0) {
4428 + err = setsockopt(sock_fd, SOL_IP, IP_TOS, &buf, 1);
4429 + if (err < 0) {
4430 log_err("Failed to call setsockopt(IP_TOS)");
4431 goto detach;
4432 }
4433 diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
4434 index ff234018219cf..aead07c24afcf 100644
4435 --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
4436 +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
4437 @@ -57,7 +57,7 @@ enum x86_register {
4438 struct desc64 {
4439 uint16_t limit0;
4440 uint16_t base0;
4441 - unsigned base1:8, s:1, type:4, dpl:2, p:1;
4442 + unsigned base1:8, type:4, s:1, dpl:2, p:1;
4443 unsigned limit1:4, avl:1, l:1, db:1, g:1, base2:8;
4444 uint32_t base3;
4445 uint32_t zero1;
4446 diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
4447 index 6698cb741e10a..7d8f7fc736467 100644
4448 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
4449 +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
4450 @@ -446,11 +446,12 @@ static void kvm_seg_fill_gdt_64bit(struct kvm_vm *vm, struct kvm_segment *segp)
4451 desc->limit0 = segp->limit & 0xFFFF;
4452 desc->base0 = segp->base & 0xFFFF;
4453 desc->base1 = segp->base >> 16;
4454 - desc->s = segp->s;
4455 desc->type = segp->type;
4456 + desc->s = segp->s;
4457 desc->dpl = segp->dpl;
4458 desc->p = segp->present;
4459 desc->limit1 = segp->limit >> 16;
4460 + desc->avl = segp->avl;
4461 desc->l = segp->l;
4462 desc->db = segp->db;
4463 desc->g = segp->g;