Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.10 commit in: /
Date: Wed, 29 Dec 2021 13:06:42
Message-Id: 1640783184.bd0c2b6eb76e3e0c39aa3f953a7cd3546013b9d8.mpagano@gentoo
1 commit: bd0c2b6eb76e3e0c39aa3f953a7cd3546013b9d8
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 29 13:06:24 2021 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 29 13:06:24 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=bd0c2b6e
7
8 Linux patch 5.10.89
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1088_linux-5.10.89.patch | 2684 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2688 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index a6cd68ff..aa52e9d4 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -395,6 +395,10 @@ Patch: 1087_linux-5.10.88.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.10.88
23
24 +Patch: 1088_linux-5.10.89.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.10.89
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1088_linux-5.10.89.patch b/1088_linux-5.10.89.patch
33 new file mode 100644
34 index 00000000..80aaf5db
35 --- /dev/null
36 +++ b/1088_linux-5.10.89.patch
37 @@ -0,0 +1,2684 @@
38 +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
39 +index 516499f9ccae4..ccaa72562538e 100644
40 +--- a/Documentation/admin-guide/kernel-parameters.txt
41 ++++ b/Documentation/admin-guide/kernel-parameters.txt
42 +@@ -2294,8 +2294,12 @@
43 + Default is 1 (enabled)
44 +
45 + kvm-intel.emulate_invalid_guest_state=
46 +- [KVM,Intel] Enable emulation of invalid guest states
47 +- Default is 0 (disabled)
48 ++ [KVM,Intel] Disable emulation of invalid guest state.
49 ++ Ignored if kvm-intel.enable_unrestricted_guest=1, as
50 ++ guest state is never invalid for unrestricted guests.
51 ++ This param doesn't apply to nested guests (L2), as KVM
52 ++ never emulates invalid L2 guest state.
53 ++ Default is 1 (enabled)
54 +
55 + kvm-intel.flexpriority=
56 + [KVM,Intel] Disable FlexPriority feature (TPR shadow).
57 +diff --git a/Documentation/hwmon/lm90.rst b/Documentation/hwmon/lm90.rst
58 +index 3da8c6e06a365..05391fb4042d9 100644
59 +--- a/Documentation/hwmon/lm90.rst
60 ++++ b/Documentation/hwmon/lm90.rst
61 +@@ -265,6 +265,16 @@ Supported chips:
62 +
63 + https://www.ti.com/litv/pdf/sbos686
64 +
65 ++ * Texas Instruments TMP461
66 ++
67 ++ Prefix: 'tmp461'
68 ++
69 ++ Addresses scanned: I2C 0x48 through 0x4F
70 ++
71 ++ Datasheet: Publicly available at TI website
72 ++
73 ++ https://www.ti.com/lit/gpn/tmp461
74 ++
75 + Author: Jean Delvare <jdelvare@××××.de>
76 +
77 +
78 +diff --git a/Documentation/networking/bonding.rst b/Documentation/networking/bonding.rst
79 +index adc314639085b..413dca513e1db 100644
80 +--- a/Documentation/networking/bonding.rst
81 ++++ b/Documentation/networking/bonding.rst
82 +@@ -196,11 +196,12 @@ ad_actor_sys_prio
83 + ad_actor_system
84 +
85 + In an AD system, this specifies the mac-address for the actor in
86 +- protocol packet exchanges (LACPDUs). The value cannot be NULL or
87 +- multicast. It is preferred to have the local-admin bit set for this
88 +- mac but driver does not enforce it. If the value is not given then
89 +- system defaults to using the masters' mac address as actors' system
90 +- address.
91 ++ protocol packet exchanges (LACPDUs). The value cannot be a multicast
92 ++ address. If the all-zeroes MAC is specified, bonding will internally
93 ++ use the MAC of the bond itself. It is preferred to have the
94 ++ local-admin bit set for this mac but driver does not enforce it. If
95 ++ the value is not given then system defaults to using the masters'
96 ++ mac address as actors' system address.
97 +
98 + This parameter has effect only in 802.3ad mode and is available through
99 + SysFs interface.
100 +diff --git a/Documentation/sound/hd-audio/models.rst b/Documentation/sound/hd-audio/models.rst
101 +index 0ea967d345838..d25335993e553 100644
102 +--- a/Documentation/sound/hd-audio/models.rst
103 ++++ b/Documentation/sound/hd-audio/models.rst
104 +@@ -326,6 +326,8 @@ usi-headset
105 + Headset support on USI machines
106 + dual-codecs
107 + Lenovo laptops with dual codecs
108 ++alc285-hp-amp-init
109 ++ HP laptops which require speaker amplifier initialization (ALC285)
110 +
111 + ALC680
112 + ======
113 +diff --git a/Makefile b/Makefile
114 +index 0b74b414f4e57..1500ea340424d 100644
115 +--- a/Makefile
116 ++++ b/Makefile
117 +@@ -1,7 +1,7 @@
118 + # SPDX-License-Identifier: GPL-2.0
119 + VERSION = 5
120 + PATCHLEVEL = 10
121 +-SUBLEVEL = 88
122 ++SUBLEVEL = 89
123 + EXTRAVERSION =
124 + NAME = Dare mighty things
125 +
126 +diff --git a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
127 +index c070893c509ee..5bad982bc5a05 100644
128 +--- a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
129 ++++ b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
130 +@@ -289,6 +289,7 @@
131 +
132 + ethphy: ethernet-phy@1 {
133 + reg = <1>;
134 ++ qca,clk-out-frequency = <125000000>;
135 + };
136 + };
137 + };
138 +diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
139 +index 1c9e6d1452c5b..63fbcdc97ded9 100644
140 +--- a/arch/arm/kernel/entry-armv.S
141 ++++ b/arch/arm/kernel/entry-armv.S
142 +@@ -596,11 +596,9 @@ call_fpe:
143 + tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2
144 + reteq lr
145 + and r8, r0, #0x00000f00 @ mask out CP number
146 +- THUMB( lsr r8, r8, #8 )
147 + mov r7, #1
148 +- add r6, r10, #TI_USED_CP
149 +- ARM( strb r7, [r6, r8, lsr #8] ) @ set appropriate used_cp[]
150 +- THUMB( strb r7, [r6, r8] ) @ set appropriate used_cp[]
151 ++ add r6, r10, r8, lsr #8 @ add used_cp[] array offset first
152 ++ strb r7, [r6, #TI_USED_CP] @ set appropriate used_cp[]
153 + #ifdef CONFIG_IWMMXT
154 + @ Test if we need to give access to iWMMXt coprocessors
155 + ldr r5, [r10, #TI_FLAGS]
156 +@@ -609,7 +607,7 @@ call_fpe:
157 + bcs iwmmxt_task_enable
158 + #endif
159 + ARM( add pc, pc, r8, lsr #6 )
160 +- THUMB( lsl r8, r8, #2 )
161 ++ THUMB( lsr r8, r8, #6 )
162 + THUMB( add pc, r8 )
163 + nop
164 +
165 +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
166 +index 5e5cf3af63515..3da71fe56b922 100644
167 +--- a/arch/arm64/Kconfig
168 ++++ b/arch/arm64/Kconfig
169 +@@ -1265,7 +1265,8 @@ config KUSER_HELPERS
170 +
171 + config COMPAT_VDSO
172 + bool "Enable vDSO for 32-bit applications"
173 +- depends on !CPU_BIG_ENDIAN && "$(CROSS_COMPILE_COMPAT)" != ""
174 ++ depends on !CPU_BIG_ENDIAN
175 ++ depends on (CC_IS_CLANG && LD_IS_LLD) || "$(CROSS_COMPILE_COMPAT)" != ""
176 + select GENERIC_COMPAT_VDSO
177 + default y
178 + help
179 +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus.dts
180 +index ef5ca64442203..de448ca51e216 100644
181 +--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus.dts
182 ++++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus.dts
183 +@@ -69,7 +69,7 @@
184 + pinctrl-0 = <&emac_rgmii_pins>;
185 + phy-supply = <&reg_gmac_3v3>;
186 + phy-handle = <&ext_rgmii_phy>;
187 +- phy-mode = "rgmii";
188 ++ phy-mode = "rgmii-id";
189 + status = "okay";
190 + };
191 +
192 +diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
193 +index a463b9bceed41..abad38c576e1d 100644
194 +--- a/arch/arm64/kernel/vdso32/Makefile
195 ++++ b/arch/arm64/kernel/vdso32/Makefile
196 +@@ -10,26 +10,15 @@ include $(srctree)/lib/vdso/Makefile
197 +
198 + # Same as cc-*option, but using CC_COMPAT instead of CC
199 + ifeq ($(CONFIG_CC_IS_CLANG), y)
200 +-COMPAT_GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE_COMPAT)elfedit))
201 +-COMPAT_GCC_TOOLCHAIN := $(realpath $(COMPAT_GCC_TOOLCHAIN_DIR)/..)
202 +-
203 +-CC_COMPAT_CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%))
204 +-CC_COMPAT_CLANG_FLAGS += --prefix=$(COMPAT_GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE_COMPAT))
205 +-CC_COMPAT_CLANG_FLAGS += -no-integrated-as -Qunused-arguments
206 +-ifneq ($(COMPAT_GCC_TOOLCHAIN),)
207 +-CC_COMPAT_CLANG_FLAGS += --gcc-toolchain=$(COMPAT_GCC_TOOLCHAIN)
208 +-endif
209 +-
210 + CC_COMPAT ?= $(CC)
211 +-CC_COMPAT += $(CC_COMPAT_CLANG_FLAGS)
212 +-
213 +-ifneq ($(LLVM),)
214 +-LD_COMPAT ?= $(LD)
215 ++CC_COMPAT += --target=arm-linux-gnueabi
216 + else
217 +-LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)ld
218 ++CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc
219 + endif
220 ++
221 ++ifeq ($(CONFIG_LD_IS_LLD), y)
222 ++LD_COMPAT ?= $(LD)
223 + else
224 +-CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc
225 + LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)ld
226 + endif
227 +
228 +@@ -55,10 +44,6 @@ VDSO_CPPFLAGS += $(LINUXINCLUDE)
229 + # Common C and assembly flags
230 + # From top-level Makefile
231 + VDSO_CAFLAGS := $(VDSO_CPPFLAGS)
232 +-ifneq ($(shell $(CC_COMPAT) --version 2>&1 | head -n 1 | grep clang),)
233 +-VDSO_CAFLAGS += --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%))
234 +-endif
235 +-
236 + VDSO_CAFLAGS += $(call cc32-option,-fno-PIE)
237 + ifdef CONFIG_DEBUG_INFO
238 + VDSO_CAFLAGS += -g
239 +diff --git a/arch/parisc/include/asm/futex.h b/arch/parisc/include/asm/futex.h
240 +index fceb9cf02fb3a..71aa0921d6c72 100644
241 +--- a/arch/parisc/include/asm/futex.h
242 ++++ b/arch/parisc/include/asm/futex.h
243 +@@ -16,7 +16,7 @@ static inline void
244 + _futex_spin_lock_irqsave(u32 __user *uaddr, unsigned long int *flags)
245 + {
246 + extern u32 lws_lock_start[];
247 +- long index = ((long)uaddr & 0x3f8) >> 1;
248 ++ long index = ((long)uaddr & 0x7f8) >> 1;
249 + arch_spinlock_t *s = (arch_spinlock_t *)&lws_lock_start[index];
250 + local_irq_save(*flags);
251 + arch_spin_lock(s);
252 +@@ -26,7 +26,7 @@ static inline void
253 + _futex_spin_unlock_irqrestore(u32 __user *uaddr, unsigned long int *flags)
254 + {
255 + extern u32 lws_lock_start[];
256 +- long index = ((long)uaddr & 0x3f8) >> 1;
257 ++ long index = ((long)uaddr & 0x7f8) >> 1;
258 + arch_spinlock_t *s = (arch_spinlock_t *)&lws_lock_start[index];
259 + arch_spin_unlock(s);
260 + local_irq_restore(*flags);
261 +diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
262 +index 322503780db61..4e53515cf81f1 100644
263 +--- a/arch/parisc/kernel/syscall.S
264 ++++ b/arch/parisc/kernel/syscall.S
265 +@@ -478,7 +478,7 @@ lws_start:
266 + extrd,u %r1,PSW_W_BIT,1,%r1
267 + /* sp must be aligned on 4, so deposit the W bit setting into
268 + * the bottom of sp temporarily */
269 +- or,ev %r1,%r30,%r30
270 ++ or,od %r1,%r30,%r30
271 +
272 + /* Clip LWS number to a 32-bit value for 32-bit processes */
273 + depdi 0, 31, 32, %r20
274 +diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
275 +index a02c67291cfcb..87de9f2d71cf2 100644
276 +--- a/arch/x86/include/asm/pgtable.h
277 ++++ b/arch/x86/include/asm/pgtable.h
278 +@@ -1360,8 +1360,8 @@ static inline pmd_t pmd_swp_clear_uffd_wp(pmd_t pmd)
279 + }
280 + #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_WP */
281 +
282 +-#define PKRU_AD_BIT 0x1
283 +-#define PKRU_WD_BIT 0x2
284 ++#define PKRU_AD_BIT 0x1u
285 ++#define PKRU_WD_BIT 0x2u
286 + #define PKRU_BITS_PER_PKEY 2
287 +
288 + #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
289 +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
290 +index 5b7664d51dc2b..38c453f28f1f0 100644
291 +--- a/arch/x86/kvm/vmx/vmx.c
292 ++++ b/arch/x86/kvm/vmx/vmx.c
293 +@@ -4007,8 +4007,7 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector)
294 + if (pi_test_and_set_on(&vmx->pi_desc))
295 + return 0;
296 +
297 +- if (vcpu != kvm_get_running_vcpu() &&
298 +- !kvm_vcpu_trigger_posted_interrupt(vcpu, false))
299 ++ if (!kvm_vcpu_trigger_posted_interrupt(vcpu, false))
300 + kvm_vcpu_kick(vcpu);
301 +
302 + return 0;
303 +diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
304 +index 38b545bef05a3..8f147274f826a 100644
305 +--- a/drivers/char/ipmi/ipmi_msghandler.c
306 ++++ b/drivers/char/ipmi/ipmi_msghandler.c
307 +@@ -2945,7 +2945,7 @@ cleanup_bmc_device(struct kref *ref)
308 + * with removing the device attributes while reading a device
309 + * attribute.
310 + */
311 +- schedule_work(&bmc->remove_work);
312 ++ queue_work(remove_work_wq, &bmc->remove_work);
313 + }
314 +
315 + /*
316 +@@ -5161,22 +5161,27 @@ static int ipmi_init_msghandler(void)
317 + if (initialized)
318 + goto out;
319 +
320 +- init_srcu_struct(&ipmi_interfaces_srcu);
321 +-
322 +- timer_setup(&ipmi_timer, ipmi_timeout, 0);
323 +- mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
324 +-
325 +- atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
326 ++ rv = init_srcu_struct(&ipmi_interfaces_srcu);
327 ++ if (rv)
328 ++ goto out;
329 +
330 + remove_work_wq = create_singlethread_workqueue("ipmi-msghandler-remove-wq");
331 + if (!remove_work_wq) {
332 + pr_err("unable to create ipmi-msghandler-remove-wq workqueue");
333 + rv = -ENOMEM;
334 +- goto out;
335 ++ goto out_wq;
336 + }
337 +
338 ++ timer_setup(&ipmi_timer, ipmi_timeout, 0);
339 ++ mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
340 ++
341 ++ atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
342 ++
343 + initialized = true;
344 +
345 ++out_wq:
346 ++ if (rv)
347 ++ cleanup_srcu_struct(&ipmi_interfaces_srcu);
348 + out:
349 + mutex_unlock(&ipmi_interfaces_mutex);
350 + return rv;
351 +diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
352 +index 0416b9c9d4105..3de679723648b 100644
353 +--- a/drivers/char/ipmi/ipmi_ssif.c
354 ++++ b/drivers/char/ipmi/ipmi_ssif.c
355 +@@ -1700,6 +1700,9 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
356 + }
357 + }
358 +
359 ++ ssif_info->client = client;
360 ++ i2c_set_clientdata(client, ssif_info);
361 ++
362 + rv = ssif_check_and_remove(client, ssif_info);
363 + /* If rv is 0 and addr source is not SI_ACPI, continue probing */
364 + if (!rv && ssif_info->addr_source == SI_ACPI) {
365 +@@ -1720,9 +1723,6 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
366 + ipmi_addr_src_to_str(ssif_info->addr_source),
367 + client->addr, client->adapter->name, slave_addr);
368 +
369 +- ssif_info->client = client;
370 +- i2c_set_clientdata(client, ssif_info);
371 +-
372 + /* Now check for system interface capabilities */
373 + msg[0] = IPMI_NETFN_APP_REQUEST << 2;
374 + msg[1] = IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_CMD;
375 +@@ -1922,6 +1922,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
376 +
377 + dev_err(&ssif_info->client->dev,
378 + "Unable to start IPMI SSIF: %d\n", rv);
379 ++ i2c_set_clientdata(client, NULL);
380 + kfree(ssif_info);
381 + }
382 + kfree(resp);
383 +diff --git a/drivers/gpio/gpio-dln2.c b/drivers/gpio/gpio-dln2.c
384 +index 4c5f6d0c8d745..22f11dd5210db 100644
385 +--- a/drivers/gpio/gpio-dln2.c
386 ++++ b/drivers/gpio/gpio-dln2.c
387 +@@ -46,6 +46,7 @@
388 + struct dln2_gpio {
389 + struct platform_device *pdev;
390 + struct gpio_chip gpio;
391 ++ struct irq_chip irqchip;
392 +
393 + /*
394 + * Cache pin direction to save us one transfer, since the hardware has
395 +@@ -383,15 +384,6 @@ static void dln2_irq_bus_unlock(struct irq_data *irqd)
396 + mutex_unlock(&dln2->irq_lock);
397 + }
398 +
399 +-static struct irq_chip dln2_gpio_irqchip = {
400 +- .name = "dln2-irq",
401 +- .irq_mask = dln2_irq_mask,
402 +- .irq_unmask = dln2_irq_unmask,
403 +- .irq_set_type = dln2_irq_set_type,
404 +- .irq_bus_lock = dln2_irq_bus_lock,
405 +- .irq_bus_sync_unlock = dln2_irq_bus_unlock,
406 +-};
407 +-
408 + static void dln2_gpio_event(struct platform_device *pdev, u16 echo,
409 + const void *data, int len)
410 + {
411 +@@ -477,8 +469,15 @@ static int dln2_gpio_probe(struct platform_device *pdev)
412 + dln2->gpio.direction_output = dln2_gpio_direction_output;
413 + dln2->gpio.set_config = dln2_gpio_set_config;
414 +
415 ++ dln2->irqchip.name = "dln2-irq",
416 ++ dln2->irqchip.irq_mask = dln2_irq_mask,
417 ++ dln2->irqchip.irq_unmask = dln2_irq_unmask,
418 ++ dln2->irqchip.irq_set_type = dln2_irq_set_type,
419 ++ dln2->irqchip.irq_bus_lock = dln2_irq_bus_lock,
420 ++ dln2->irqchip.irq_bus_sync_unlock = dln2_irq_bus_unlock,
421 ++
422 + girq = &dln2->gpio.irq;
423 +- girq->chip = &dln2_gpio_irqchip;
424 ++ girq->chip = &dln2->irqchip;
425 + /* The event comes from the outside so no parent handler */
426 + girq->parent_handler = NULL;
427 + girq->num_parents = 0;
428 +diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c
429 +index b7172c48ef9f0..7c907939bfae1 100644
430 +--- a/drivers/hid/hid-holtek-mouse.c
431 ++++ b/drivers/hid/hid-holtek-mouse.c
432 +@@ -65,8 +65,23 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
433 + static int holtek_mouse_probe(struct hid_device *hdev,
434 + const struct hid_device_id *id)
435 + {
436 ++ int ret;
437 ++
438 + if (!hid_is_usb(hdev))
439 + return -EINVAL;
440 ++
441 ++ ret = hid_parse(hdev);
442 ++ if (ret) {
443 ++ hid_err(hdev, "hid parse failed: %d\n", ret);
444 ++ return ret;
445 ++ }
446 ++
447 ++ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
448 ++ if (ret) {
449 ++ hid_err(hdev, "hw start failed: %d\n", ret);
450 ++ return ret;
451 ++ }
452 ++
453 + return 0;
454 + }
455 +
456 +diff --git a/drivers/hid/hid-vivaldi.c b/drivers/hid/hid-vivaldi.c
457 +index cd7ada48b1d9f..72957a9f71170 100644
458 +--- a/drivers/hid/hid-vivaldi.c
459 ++++ b/drivers/hid/hid-vivaldi.c
460 +@@ -57,6 +57,9 @@ static int vivaldi_probe(struct hid_device *hdev,
461 + int ret;
462 +
463 + drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL);
464 ++ if (!drvdata)
465 ++ return -ENOMEM;
466 ++
467 + hid_set_drvdata(hdev, drvdata);
468 +
469 + ret = hid_parse(hdev);
470 +diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
471 +index a850e4f0e0bde..0c2b032ee6176 100644
472 +--- a/drivers/hwmon/Kconfig
473 ++++ b/drivers/hwmon/Kconfig
474 +@@ -1275,7 +1275,7 @@ config SENSORS_LM90
475 + Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6654, MAX6657, MAX6658,
476 + MAX6659, MAX6680, MAX6681, MAX6692, MAX6695, MAX6696,
477 + ON Semiconductor NCT1008, Winbond/Nuvoton W83L771W/G/AWG/ASG,
478 +- Philips SA56004, GMT G781, and Texas Instruments TMP451
479 ++ Philips SA56004, GMT G781, Texas Instruments TMP451 and TMP461
480 + sensor chips.
481 +
482 + This driver can also be built as a module. If so, the module
483 +diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
484 +index ebbfd5f352c06..959446b0137bc 100644
485 +--- a/drivers/hwmon/lm90.c
486 ++++ b/drivers/hwmon/lm90.c
487 +@@ -35,13 +35,14 @@
488 + * explicitly as max6659, or if its address is not 0x4c.
489 + * These chips lack the remote temperature offset feature.
490 + *
491 +- * This driver also supports the MAX6654 chip made by Maxim. This chip can
492 +- * be at 9 different addresses, similar to MAX6680/MAX6681. The MAX6654 is
493 +- * otherwise similar to MAX6657/MAX6658/MAX6659. Extended range is available
494 +- * by setting the configuration register accordingly, and is done during
495 +- * initialization. Extended precision is only available at conversion rates
496 +- * of 1 Hz and slower. Note that extended precision is not enabled by
497 +- * default, as this driver initializes all chips to 2 Hz by design.
498 ++ * This driver also supports the MAX6654 chip made by Maxim. This chip can be
499 ++ * at 9 different addresses, similar to MAX6680/MAX6681. The MAX6654 is similar
500 ++ * to MAX6657/MAX6658/MAX6659, but does not support critical temperature
501 ++ * limits. Extended range is available by setting the configuration register
502 ++ * accordingly, and is done during initialization. Extended precision is only
503 ++ * available at conversion rates of 1 Hz and slower. Note that extended
504 ++ * precision is not enabled by default, as this driver initializes all chips
505 ++ * to 2 Hz by design.
506 + *
507 + * This driver also supports the MAX6646, MAX6647, MAX6648, MAX6649 and
508 + * MAX6692 chips made by Maxim. These are again similar to the LM86,
509 +@@ -69,10 +70,10 @@
510 + * This driver also supports the G781 from GMT. This device is compatible
511 + * with the ADM1032.
512 + *
513 +- * This driver also supports TMP451 from Texas Instruments. This device is
514 +- * supported in both compatibility and extended mode. It's mostly compatible
515 +- * with ADT7461 except for local temperature low byte register and max
516 +- * conversion rate.
517 ++ * This driver also supports TMP451 and TMP461 from Texas Instruments.
518 ++ * Those devices are supported in both compatibility and extended mode.
519 ++ * They are mostly compatible with ADT7461 except for local temperature
520 ++ * low byte register and max conversion rate.
521 + *
522 + * Since the LM90 was the first chipset supported by this driver, most
523 + * comments will refer to this chipset, but are actually general and
524 +@@ -112,7 +113,7 @@ static const unsigned short normal_i2c[] = {
525 + 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
526 +
527 + enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
528 +- max6646, w83l771, max6696, sa56004, g781, tmp451, max6654 };
529 ++ max6646, w83l771, max6696, sa56004, g781, tmp451, tmp461, max6654 };
530 +
531 + /*
532 + * The LM90 registers
533 +@@ -168,8 +169,12 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
534 +
535 + #define LM90_MAX_CONVRATE_MS 16000 /* Maximum conversion rate in ms */
536 +
537 +-/* TMP451 registers */
538 ++/* TMP451/TMP461 registers */
539 + #define TMP451_REG_R_LOCAL_TEMPL 0x15
540 ++#define TMP451_REG_CONALERT 0x22
541 ++
542 ++#define TMP461_REG_CHEN 0x16
543 ++#define TMP461_REG_DFC 0x24
544 +
545 + /*
546 + * Device flags
547 +@@ -182,7 +187,10 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
548 + #define LM90_HAVE_EMERGENCY_ALARM (1 << 5)/* emergency alarm */
549 + #define LM90_HAVE_TEMP3 (1 << 6) /* 3rd temperature sensor */
550 + #define LM90_HAVE_BROKEN_ALERT (1 << 7) /* Broken alert */
551 +-#define LM90_PAUSE_FOR_CONFIG (1 << 8) /* Pause conversion for config */
552 ++#define LM90_HAVE_EXTENDED_TEMP (1 << 8) /* extended temperature support*/
553 ++#define LM90_PAUSE_FOR_CONFIG (1 << 9) /* Pause conversion for config */
554 ++#define LM90_HAVE_CRIT (1 << 10)/* Chip supports CRIT/OVERT register */
555 ++#define LM90_HAVE_CRIT_ALRM_SWP (1 << 11)/* critical alarm bits swapped */
556 +
557 + /* LM90 status */
558 + #define LM90_STATUS_LTHRM (1 << 0) /* local THERM limit tripped */
559 +@@ -192,6 +200,7 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
560 + #define LM90_STATUS_RHIGH (1 << 4) /* remote high temp limit tripped */
561 + #define LM90_STATUS_LLOW (1 << 5) /* local low temp limit tripped */
562 + #define LM90_STATUS_LHIGH (1 << 6) /* local high temp limit tripped */
563 ++#define LM90_STATUS_BUSY (1 << 7) /* conversion is ongoing */
564 +
565 + #define MAX6696_STATUS2_R2THRM (1 << 1) /* remote2 THERM limit tripped */
566 + #define MAX6696_STATUS2_R2OPEN (1 << 2) /* remote2 is an open circuit */
567 +@@ -229,6 +238,7 @@ static const struct i2c_device_id lm90_id[] = {
568 + { "w83l771", w83l771 },
569 + { "sa56004", sa56004 },
570 + { "tmp451", tmp451 },
571 ++ { "tmp461", tmp461 },
572 + { }
573 + };
574 + MODULE_DEVICE_TABLE(i2c, lm90_id);
575 +@@ -326,6 +336,10 @@ static const struct of_device_id __maybe_unused lm90_of_match[] = {
576 + .compatible = "ti,tmp451",
577 + .data = (void *)tmp451
578 + },
579 ++ {
580 ++ .compatible = "ti,tmp461",
581 ++ .data = (void *)tmp461
582 ++ },
583 + { },
584 + };
585 + MODULE_DEVICE_TABLE(of, lm90_of_match);
586 +@@ -344,38 +358,43 @@ struct lm90_params {
587 + static const struct lm90_params lm90_params[] = {
588 + [adm1032] = {
589 + .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
590 +- | LM90_HAVE_BROKEN_ALERT,
591 ++ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT,
592 + .alert_alarms = 0x7c,
593 + .max_convrate = 10,
594 + },
595 + [adt7461] = {
596 + .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
597 +- | LM90_HAVE_BROKEN_ALERT,
598 ++ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP
599 ++ | LM90_HAVE_CRIT,
600 + .alert_alarms = 0x7c,
601 + .max_convrate = 10,
602 + },
603 + [g781] = {
604 + .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
605 +- | LM90_HAVE_BROKEN_ALERT,
606 ++ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT,
607 + .alert_alarms = 0x7c,
608 + .max_convrate = 8,
609 + },
610 + [lm86] = {
611 +- .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT,
612 ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
613 ++ | LM90_HAVE_CRIT,
614 + .alert_alarms = 0x7b,
615 + .max_convrate = 9,
616 + },
617 + [lm90] = {
618 +- .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT,
619 ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
620 ++ | LM90_HAVE_CRIT,
621 + .alert_alarms = 0x7b,
622 + .max_convrate = 9,
623 + },
624 + [lm99] = {
625 +- .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT,
626 ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
627 ++ | LM90_HAVE_CRIT,
628 + .alert_alarms = 0x7b,
629 + .max_convrate = 9,
630 + },
631 + [max6646] = {
632 ++ .flags = LM90_HAVE_CRIT,
633 + .alert_alarms = 0x7c,
634 + .max_convrate = 6,
635 + .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
636 +@@ -386,43 +405,51 @@ static const struct lm90_params lm90_params[] = {
637 + .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
638 + },
639 + [max6657] = {
640 +- .flags = LM90_PAUSE_FOR_CONFIG,
641 ++ .flags = LM90_PAUSE_FOR_CONFIG | LM90_HAVE_CRIT,
642 + .alert_alarms = 0x7c,
643 + .max_convrate = 8,
644 + .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
645 + },
646 + [max6659] = {
647 +- .flags = LM90_HAVE_EMERGENCY,
648 ++ .flags = LM90_HAVE_EMERGENCY | LM90_HAVE_CRIT,
649 + .alert_alarms = 0x7c,
650 + .max_convrate = 8,
651 + .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
652 + },
653 + [max6680] = {
654 +- .flags = LM90_HAVE_OFFSET,
655 ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_CRIT
656 ++ | LM90_HAVE_CRIT_ALRM_SWP,
657 + .alert_alarms = 0x7c,
658 + .max_convrate = 7,
659 + },
660 + [max6696] = {
661 + .flags = LM90_HAVE_EMERGENCY
662 +- | LM90_HAVE_EMERGENCY_ALARM | LM90_HAVE_TEMP3,
663 ++ | LM90_HAVE_EMERGENCY_ALARM | LM90_HAVE_TEMP3 | LM90_HAVE_CRIT,
664 + .alert_alarms = 0x1c7c,
665 + .max_convrate = 6,
666 + .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
667 + },
668 + [w83l771] = {
669 +- .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT,
670 ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT | LM90_HAVE_CRIT,
671 + .alert_alarms = 0x7c,
672 + .max_convrate = 8,
673 + },
674 + [sa56004] = {
675 +- .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT,
676 ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT | LM90_HAVE_CRIT,
677 + .alert_alarms = 0x7b,
678 + .max_convrate = 9,
679 + .reg_local_ext = SA56004_REG_R_LOCAL_TEMPL,
680 + },
681 + [tmp451] = {
682 + .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
683 +- | LM90_HAVE_BROKEN_ALERT,
684 ++ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP | LM90_HAVE_CRIT,
685 ++ .alert_alarms = 0x7c,
686 ++ .max_convrate = 9,
687 ++ .reg_local_ext = TMP451_REG_R_LOCAL_TEMPL,
688 ++ },
689 ++ [tmp461] = {
690 ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
691 ++ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP | LM90_HAVE_CRIT,
692 + .alert_alarms = 0x7c,
693 + .max_convrate = 9,
694 + .reg_local_ext = TMP451_REG_R_LOCAL_TEMPL,
695 +@@ -650,20 +677,22 @@ static int lm90_update_limits(struct device *dev)
696 + struct i2c_client *client = data->client;
697 + int val;
698 +
699 +- val = lm90_read_reg(client, LM90_REG_R_LOCAL_CRIT);
700 +- if (val < 0)
701 +- return val;
702 +- data->temp8[LOCAL_CRIT] = val;
703 ++ if (data->flags & LM90_HAVE_CRIT) {
704 ++ val = lm90_read_reg(client, LM90_REG_R_LOCAL_CRIT);
705 ++ if (val < 0)
706 ++ return val;
707 ++ data->temp8[LOCAL_CRIT] = val;
708 +
709 +- val = lm90_read_reg(client, LM90_REG_R_REMOTE_CRIT);
710 +- if (val < 0)
711 +- return val;
712 +- data->temp8[REMOTE_CRIT] = val;
713 ++ val = lm90_read_reg(client, LM90_REG_R_REMOTE_CRIT);
714 ++ if (val < 0)
715 ++ return val;
716 ++ data->temp8[REMOTE_CRIT] = val;
717 +
718 +- val = lm90_read_reg(client, LM90_REG_R_TCRIT_HYST);
719 +- if (val < 0)
720 +- return val;
721 +- data->temp_hyst = val;
722 ++ val = lm90_read_reg(client, LM90_REG_R_TCRIT_HYST);
723 ++ if (val < 0)
724 ++ return val;
725 ++ data->temp_hyst = val;
726 ++ }
727 +
728 + val = lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH);
729 + if (val < 0)
730 +@@ -791,7 +820,7 @@ static int lm90_update_device(struct device *dev)
731 + val = lm90_read_reg(client, LM90_REG_R_STATUS);
732 + if (val < 0)
733 + return val;
734 +- data->alarms = val; /* lower 8 bit of alarms */
735 ++ data->alarms = val & ~LM90_STATUS_BUSY;
736 +
737 + if (data->kind == max6696) {
738 + val = lm90_select_remote_channel(data, 1);
739 +@@ -997,7 +1026,7 @@ static int lm90_get_temp11(struct lm90_data *data, int index)
740 + s16 temp11 = data->temp11[index];
741 + int temp;
742 +
743 +- if (data->kind == adt7461 || data->kind == tmp451)
744 ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP)
745 + temp = temp_from_u16_adt7461(data, temp11);
746 + else if (data->kind == max6646)
747 + temp = temp_from_u16(temp11);
748 +@@ -1031,7 +1060,7 @@ static int lm90_set_temp11(struct lm90_data *data, int index, long val)
749 + if (data->kind == lm99 && index <= 2)
750 + val -= 16000;
751 +
752 +- if (data->kind == adt7461 || data->kind == tmp451)
753 ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP)
754 + data->temp11[index] = temp_to_u16_adt7461(data, val);
755 + else if (data->kind == max6646)
756 + data->temp11[index] = temp_to_u8(val) << 8;
757 +@@ -1058,7 +1087,7 @@ static int lm90_get_temp8(struct lm90_data *data, int index)
758 + s8 temp8 = data->temp8[index];
759 + int temp;
760 +
761 +- if (data->kind == adt7461 || data->kind == tmp451)
762 ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP)
763 + temp = temp_from_u8_adt7461(data, temp8);
764 + else if (data->kind == max6646)
765 + temp = temp_from_u8(temp8);
766 +@@ -1091,7 +1120,7 @@ static int lm90_set_temp8(struct lm90_data *data, int index, long val)
767 + if (data->kind == lm99 && index == 3)
768 + val -= 16000;
769 +
770 +- if (data->kind == adt7461 || data->kind == tmp451)
771 ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP)
772 + data->temp8[index] = temp_to_u8_adt7461(data, val);
773 + else if (data->kind == max6646)
774 + data->temp8[index] = temp_to_u8(val);
775 +@@ -1109,7 +1138,7 @@ static int lm90_get_temphyst(struct lm90_data *data, int index)
776 + {
777 + int temp;
778 +
779 +- if (data->kind == adt7461 || data->kind == tmp451)
780 ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP)
781 + temp = temp_from_u8_adt7461(data, data->temp8[index]);
782 + else if (data->kind == max6646)
783 + temp = temp_from_u8(data->temp8[index]);
784 +@@ -1129,7 +1158,7 @@ static int lm90_set_temphyst(struct lm90_data *data, long val)
785 + int temp;
786 + int err;
787 +
788 +- if (data->kind == adt7461 || data->kind == tmp451)
789 ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP)
790 + temp = temp_from_u8_adt7461(data, data->temp8[LOCAL_CRIT]);
791 + else if (data->kind == max6646)
792 + temp = temp_from_u8(data->temp8[LOCAL_CRIT]);
793 +@@ -1165,6 +1194,7 @@ static const u8 lm90_temp_emerg_index[3] = {
794 + static const u8 lm90_min_alarm_bits[3] = { 5, 3, 11 };
795 + static const u8 lm90_max_alarm_bits[3] = { 6, 4, 12 };
796 + static const u8 lm90_crit_alarm_bits[3] = { 0, 1, 9 };
797 ++static const u8 lm90_crit_alarm_bits_swapped[3] = { 1, 0, 9 };
798 + static const u8 lm90_emergency_alarm_bits[3] = { 15, 13, 14 };
799 + static const u8 lm90_fault_bits[3] = { 0, 2, 10 };
800 +
801 +@@ -1190,7 +1220,10 @@ static int lm90_temp_read(struct device *dev, u32 attr, int channel, long *val)
802 + *val = (data->alarms >> lm90_max_alarm_bits[channel]) & 1;
803 + break;
804 + case hwmon_temp_crit_alarm:
805 +- *val = (data->alarms >> lm90_crit_alarm_bits[channel]) & 1;
806 ++ if (data->flags & LM90_HAVE_CRIT_ALRM_SWP)
807 ++ *val = (data->alarms >> lm90_crit_alarm_bits_swapped[channel]) & 1;
808 ++ else
809 ++ *val = (data->alarms >> lm90_crit_alarm_bits[channel]) & 1;
810 + break;
811 + case hwmon_temp_emergency_alarm:
812 + *val = (data->alarms >> lm90_emergency_alarm_bits[channel]) & 1;
813 +@@ -1438,12 +1471,11 @@ static int lm90_detect(struct i2c_client *client,
814 + if (man_id < 0 || chip_id < 0 || config1 < 0 || convrate < 0)
815 + return -ENODEV;
816 +
817 +- if (man_id == 0x01 || man_id == 0x5C || man_id == 0x41) {
818 ++ if (man_id == 0x01 || man_id == 0x5C || man_id == 0xA1) {
819 + config2 = i2c_smbus_read_byte_data(client, LM90_REG_R_CONFIG2);
820 + if (config2 < 0)
821 + return -ENODEV;
822 +- } else
823 +- config2 = 0; /* Make compiler happy */
824 ++ }
825 +
826 + if ((address == 0x4C || address == 0x4D)
827 + && man_id == 0x01) { /* National Semiconductor */
828 +@@ -1617,18 +1649,26 @@ static int lm90_detect(struct i2c_client *client,
829 + && convrate <= 0x08)
830 + name = "g781";
831 + } else
832 +- if (address == 0x4C
833 +- && man_id == 0x55) { /* Texas Instruments */
834 +- int local_ext;
835 ++ if (man_id == 0x55 && chip_id == 0x00 &&
836 ++ (config1 & 0x1B) == 0x00 && convrate <= 0x09) {
837 ++ int local_ext, conalert, chen, dfc;
838 +
839 + local_ext = i2c_smbus_read_byte_data(client,
840 + TMP451_REG_R_LOCAL_TEMPL);
841 +-
842 +- if (chip_id == 0x00 /* TMP451 */
843 +- && (config1 & 0x1B) == 0x00
844 +- && convrate <= 0x09
845 +- && (local_ext & 0x0F) == 0x00)
846 +- name = "tmp451";
847 ++ conalert = i2c_smbus_read_byte_data(client,
848 ++ TMP451_REG_CONALERT);
849 ++ chen = i2c_smbus_read_byte_data(client, TMP461_REG_CHEN);
850 ++ dfc = i2c_smbus_read_byte_data(client, TMP461_REG_DFC);
851 ++
852 ++ if ((local_ext & 0x0F) == 0x00 &&
853 ++ (conalert & 0xf1) == 0x01 &&
854 ++ (chen & 0xfc) == 0x00 &&
855 ++ (dfc & 0xfc) == 0x00) {
856 ++ if (address == 0x4c && !(chen & 0x03))
857 ++ name = "tmp451";
858 ++ else if (address >= 0x48 && address <= 0x4f)
859 ++ name = "tmp461";
860 ++ }
861 + }
862 +
863 + if (!name) { /* identification failed */
864 +@@ -1675,7 +1715,7 @@ static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
865 + lm90_set_convrate(client, data, 500); /* 500ms; 2Hz conversion rate */
866 +
867 + /* Check Temperature Range Select */
868 +- if (data->kind == adt7461 || data->kind == tmp451) {
869 ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP) {
870 + if (config & 0x04)
871 + data->flags |= LM90_FLAG_ADT7461_EXT;
872 + }
873 +@@ -1842,11 +1882,14 @@ static int lm90_probe(struct i2c_client *client)
874 + info->config = data->channel_config;
875 +
876 + data->channel_config[0] = HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX |
877 +- HWMON_T_CRIT | HWMON_T_CRIT_HYST | HWMON_T_MIN_ALARM |
878 +- HWMON_T_MAX_ALARM | HWMON_T_CRIT_ALARM;
879 ++ HWMON_T_MIN_ALARM | HWMON_T_MAX_ALARM;
880 + data->channel_config[1] = HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX |
881 +- HWMON_T_CRIT | HWMON_T_CRIT_HYST | HWMON_T_MIN_ALARM |
882 +- HWMON_T_MAX_ALARM | HWMON_T_CRIT_ALARM | HWMON_T_FAULT;
883 ++ HWMON_T_MIN_ALARM | HWMON_T_MAX_ALARM | HWMON_T_FAULT;
884 ++
885 ++ if (data->flags & LM90_HAVE_CRIT) {
886 ++ data->channel_config[0] |= HWMON_T_CRIT | HWMON_T_CRIT_ALARM | HWMON_T_CRIT_HYST;
887 ++ data->channel_config[1] |= HWMON_T_CRIT | HWMON_T_CRIT_ALARM | HWMON_T_CRIT_HYST;
888 ++ }
889 +
890 + if (data->flags & LM90_HAVE_OFFSET)
891 + data->channel_config[1] |= HWMON_T_OFFSET;
892 +diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c
893 +index f27523e1a12d7..08df97e0a6654 100644
894 +--- a/drivers/infiniband/hw/hns/hns_roce_srq.c
895 ++++ b/drivers/infiniband/hw/hns/hns_roce_srq.c
896 +@@ -277,7 +277,7 @@ static int alloc_srq_wrid(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
897 +
898 + static void free_srq_wrid(struct hns_roce_srq *srq)
899 + {
900 +- kfree(srq->wrid);
901 ++ kvfree(srq->wrid);
902 + srq->wrid = NULL;
903 + }
904 +
905 +diff --git a/drivers/infiniband/hw/qib/qib_user_sdma.c b/drivers/infiniband/hw/qib/qib_user_sdma.c
906 +index ac11943a5ddb0..bf2f30d67949d 100644
907 +--- a/drivers/infiniband/hw/qib/qib_user_sdma.c
908 ++++ b/drivers/infiniband/hw/qib/qib_user_sdma.c
909 +@@ -941,7 +941,7 @@ static int qib_user_sdma_queue_pkts(const struct qib_devdata *dd,
910 + &addrlimit) ||
911 + addrlimit > type_max(typeof(pkt->addrlimit))) {
912 + ret = -EINVAL;
913 +- goto free_pbc;
914 ++ goto free_pkt;
915 + }
916 + pkt->addrlimit = addrlimit;
917 +
918 +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
919 +index 4357d30c15c56..2e53ea261e014 100644
920 +--- a/drivers/input/mouse/elantech.c
921 ++++ b/drivers/input/mouse/elantech.c
922 +@@ -1588,7 +1588,13 @@ static const struct dmi_system_id no_hw_res_dmi_table[] = {
923 + */
924 + static int elantech_change_report_id(struct psmouse *psmouse)
925 + {
926 +- unsigned char param[2] = { 0x10, 0x03 };
927 ++ /*
928 ++ * NOTE: the code is expecting to receive param[] as an array of 3
929 ++ * items (see __ps2_command()), even if in this case only 2 are
930 ++ * actually needed. Make sure the array size is 3 to avoid potential
931 ++ * stack out-of-bound accesses.
932 ++ */
933 ++ unsigned char param[3] = { 0x10, 0x03 };
934 +
935 + if (elantech_write_reg_params(psmouse, 0x7, param) ||
936 + elantech_read_reg_params(psmouse, 0x7, param) ||
937 +diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
938 +index b6f75367a284a..8df402a1ed446 100644
939 +--- a/drivers/input/touchscreen/atmel_mxt_ts.c
940 ++++ b/drivers/input/touchscreen/atmel_mxt_ts.c
941 +@@ -1839,7 +1839,7 @@ static int mxt_read_info_block(struct mxt_data *data)
942 + if (error) {
943 + dev_err(&client->dev, "Error %d parsing object table\n", error);
944 + mxt_free_object_table(data);
945 +- goto err_free_mem;
946 ++ return error;
947 + }
948 +
949 + data->object_table = (struct mxt_object *)(id_buf + MXT_OBJECT_START);
950 +diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
951 +index 03a4825359448..c09aefa2661dd 100644
952 +--- a/drivers/input/touchscreen/elants_i2c.c
953 ++++ b/drivers/input/touchscreen/elants_i2c.c
954 +@@ -109,6 +109,19 @@
955 + #define ELAN_POWERON_DELAY_USEC 500
956 + #define ELAN_RESET_DELAY_MSEC 20
957 +
958 ++/* FW boot code version */
959 ++#define BC_VER_H_BYTE_FOR_EKTH3900x1_I2C 0x72
960 ++#define BC_VER_H_BYTE_FOR_EKTH3900x2_I2C 0x82
961 ++#define BC_VER_H_BYTE_FOR_EKTH3900x3_I2C 0x92
962 ++#define BC_VER_H_BYTE_FOR_EKTH5312x1_I2C 0x6D
963 ++#define BC_VER_H_BYTE_FOR_EKTH5312x2_I2C 0x6E
964 ++#define BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C 0x77
965 ++#define BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C 0x78
966 ++#define BC_VER_H_BYTE_FOR_EKTH5312x1_I2C_USB 0x67
967 ++#define BC_VER_H_BYTE_FOR_EKTH5312x2_I2C_USB 0x68
968 ++#define BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C_USB 0x74
969 ++#define BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C_USB 0x75
970 ++
971 + enum elants_state {
972 + ELAN_STATE_NORMAL,
973 + ELAN_WAIT_QUEUE_HEADER,
974 +@@ -663,6 +676,37 @@ static int elants_i2c_validate_remark_id(struct elants_data *ts,
975 + return 0;
976 + }
977 +
978 ++static bool elants_i2c_should_check_remark_id(struct elants_data *ts)
979 ++{
980 ++ struct i2c_client *client = ts->client;
981 ++ const u8 bootcode_version = ts->iap_version;
982 ++ bool check;
983 ++
984 ++ /* I2C eKTH3900 and eKTH5312 are NOT support Remark ID */
985 ++ if ((bootcode_version == BC_VER_H_BYTE_FOR_EKTH3900x1_I2C) ||
986 ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH3900x2_I2C) ||
987 ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH3900x3_I2C) ||
988 ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x1_I2C) ||
989 ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x2_I2C) ||
990 ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C) ||
991 ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C) ||
992 ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x1_I2C_USB) ||
993 ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x2_I2C_USB) ||
994 ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C_USB) ||
995 ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C_USB)) {
996 ++ dev_dbg(&client->dev,
997 ++ "eKTH3900/eKTH5312(0x%02x) are not support remark id\n",
998 ++ bootcode_version);
999 ++ check = false;
1000 ++ } else if (bootcode_version >= 0x60) {
1001 ++ check = true;
1002 ++ } else {
1003 ++ check = false;
1004 ++ }
1005 ++
1006 ++ return check;
1007 ++}
1008 ++
1009 + static int elants_i2c_do_update_firmware(struct i2c_client *client,
1010 + const struct firmware *fw,
1011 + bool force)
1012 +@@ -676,7 +720,7 @@ static int elants_i2c_do_update_firmware(struct i2c_client *client,
1013 + u16 send_id;
1014 + int page, n_fw_pages;
1015 + int error;
1016 +- bool check_remark_id = ts->iap_version >= 0x60;
1017 ++ bool check_remark_id = elants_i2c_should_check_remark_id(ts);
1018 +
1019 + /* Recovery mode detection! */
1020 + if (force) {
1021 +diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
1022 +index a06385c55af2a..5fc789f717c8a 100644
1023 +--- a/drivers/input/touchscreen/goodix.c
1024 ++++ b/drivers/input/touchscreen/goodix.c
1025 +@@ -162,6 +162,7 @@ static const struct goodix_chip_id goodix_chip_ids[] = {
1026 + { .id = "911", .data = &gt911_chip_data },
1027 + { .id = "9271", .data = &gt911_chip_data },
1028 + { .id = "9110", .data = &gt911_chip_data },
1029 ++ { .id = "9111", .data = &gt911_chip_data },
1030 + { .id = "927", .data = &gt911_chip_data },
1031 + { .id = "928", .data = &gt911_chip_data },
1032 +
1033 +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
1034 +index b5f3f160c8420..eb82f6aac951f 100644
1035 +--- a/drivers/mmc/core/core.c
1036 ++++ b/drivers/mmc/core/core.c
1037 +@@ -2327,7 +2327,7 @@ void mmc_start_host(struct mmc_host *host)
1038 + _mmc_detect_change(host, 0, false);
1039 + }
1040 +
1041 +-void mmc_stop_host(struct mmc_host *host)
1042 ++void __mmc_stop_host(struct mmc_host *host)
1043 + {
1044 + if (host->slot.cd_irq >= 0) {
1045 + mmc_gpio_set_cd_wake(host, false);
1046 +@@ -2336,6 +2336,11 @@ void mmc_stop_host(struct mmc_host *host)
1047 +
1048 + host->rescan_disable = 1;
1049 + cancel_delayed_work_sync(&host->detect);
1050 ++}
1051 ++
1052 ++void mmc_stop_host(struct mmc_host *host)
1053 ++{
1054 ++ __mmc_stop_host(host);
1055 +
1056 + /* clear pm flags now and let card drivers set them as needed */
1057 + host->pm_flags = 0;
1058 +diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
1059 +index db3c9c68875d8..a6c814fdbf0a9 100644
1060 +--- a/drivers/mmc/core/core.h
1061 ++++ b/drivers/mmc/core/core.h
1062 +@@ -69,6 +69,7 @@ static inline void mmc_delay(unsigned int ms)
1063 +
1064 + void mmc_rescan(struct work_struct *work);
1065 + void mmc_start_host(struct mmc_host *host);
1066 ++void __mmc_stop_host(struct mmc_host *host);
1067 + void mmc_stop_host(struct mmc_host *host);
1068 +
1069 + void _mmc_detect_change(struct mmc_host *host, unsigned long delay,
1070 +diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
1071 +index 58112999a69ab..864c8c205ff78 100644
1072 +--- a/drivers/mmc/core/host.c
1073 ++++ b/drivers/mmc/core/host.c
1074 +@@ -79,9 +79,18 @@ static void mmc_host_classdev_release(struct device *dev)
1075 + kfree(host);
1076 + }
1077 +
1078 ++static int mmc_host_classdev_shutdown(struct device *dev)
1079 ++{
1080 ++ struct mmc_host *host = cls_dev_to_mmc_host(dev);
1081 ++
1082 ++ __mmc_stop_host(host);
1083 ++ return 0;
1084 ++}
1085 ++
1086 + static struct class mmc_host_class = {
1087 + .name = "mmc_host",
1088 + .dev_release = mmc_host_classdev_release,
1089 ++ .shutdown_pre = mmc_host_classdev_shutdown,
1090 + .pm = MMC_HOST_CLASS_DEV_PM_OPS,
1091 + };
1092 +
1093 +diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
1094 +index 7cd9c0ec2fcfe..8fdd0bbbfa21f 100644
1095 +--- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
1096 ++++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
1097 +@@ -135,6 +135,7 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
1098 + struct mmc_command *cmd)
1099 + {
1100 + struct meson_mx_sdhc_host *host = mmc_priv(mmc);
1101 ++ bool manual_stop = false;
1102 + u32 ictl, send;
1103 + int pack_len;
1104 +
1105 +@@ -172,12 +173,27 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
1106 + else
1107 + /* software flush: */
1108 + ictl |= MESON_SDHC_ICTL_DATA_XFER_OK;
1109 ++
1110 ++ /*
1111 ++ * Mimic the logic from the vendor driver where (only)
1112 ++ * SD_IO_RW_EXTENDED commands with more than one block set the
1113 ++ * MESON_SDHC_MISC_MANUAL_STOP bit. This fixes the firmware
1114 ++ * download in the brcmfmac driver for a BCM43362/1 card.
1115 ++ * Without this sdio_memcpy_toio() (with a size of 219557
1116 ++ * bytes) times out if MESON_SDHC_MISC_MANUAL_STOP is not set.
1117 ++ */
1118 ++ manual_stop = cmd->data->blocks > 1 &&
1119 ++ cmd->opcode == SD_IO_RW_EXTENDED;
1120 + } else {
1121 + pack_len = 0;
1122 +
1123 + ictl |= MESON_SDHC_ICTL_RESP_OK;
1124 + }
1125 +
1126 ++ regmap_update_bits(host->regmap, MESON_SDHC_MISC,
1127 ++ MESON_SDHC_MISC_MANUAL_STOP,
1128 ++ manual_stop ? MESON_SDHC_MISC_MANUAL_STOP : 0);
1129 ++
1130 + if (cmd->opcode == MMC_STOP_TRANSMISSION)
1131 + send |= MESON_SDHC_SEND_DATA_STOP;
1132 +
1133 +diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c
1134 +index fdaa11f92fe6f..a75d3dd34d18c 100644
1135 +--- a/drivers/mmc/host/mmci_stm32_sdmmc.c
1136 ++++ b/drivers/mmc/host/mmci_stm32_sdmmc.c
1137 +@@ -441,6 +441,8 @@ static int sdmmc_dlyb_phase_tuning(struct mmci_host *host, u32 opcode)
1138 + return -EINVAL;
1139 + }
1140 +
1141 ++ writel_relaxed(0, dlyb->base + DLYB_CR);
1142 ++
1143 + phase = end_of_len - max_len / 2;
1144 + sdmmc_dlyb_set_cfgr(dlyb, dlyb->unit, phase, false);
1145 +
1146 +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
1147 +index 8ea9132ebca4e..d50b691f6c44e 100644
1148 +--- a/drivers/mmc/host/sdhci-tegra.c
1149 ++++ b/drivers/mmc/host/sdhci-tegra.c
1150 +@@ -354,23 +354,6 @@ static void tegra_sdhci_set_tap(struct sdhci_host *host, unsigned int tap)
1151 + }
1152 + }
1153 +
1154 +-static void tegra_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc,
1155 +- struct mmc_ios *ios)
1156 +-{
1157 +- struct sdhci_host *host = mmc_priv(mmc);
1158 +- u32 val;
1159 +-
1160 +- val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL);
1161 +-
1162 +- if (ios->enhanced_strobe)
1163 +- val |= SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE;
1164 +- else
1165 +- val &= ~SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE;
1166 +-
1167 +- sdhci_writel(host, val, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL);
1168 +-
1169 +-}
1170 +-
1171 + static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)
1172 + {
1173 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
1174 +@@ -791,6 +774,32 @@ static void tegra_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
1175 + }
1176 + }
1177 +
1178 ++static void tegra_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc,
1179 ++ struct mmc_ios *ios)
1180 ++{
1181 ++ struct sdhci_host *host = mmc_priv(mmc);
1182 ++ u32 val;
1183 ++
1184 ++ val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL);
1185 ++
1186 ++ if (ios->enhanced_strobe) {
1187 ++ val |= SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE;
1188 ++ /*
1189 ++ * When CMD13 is sent from mmc_select_hs400es() after
1190 ++ * switching to HS400ES mode, the bus is operating at
1191 ++ * either MMC_HIGH_26_MAX_DTR or MMC_HIGH_52_MAX_DTR.
1192 ++ * To meet Tegra SDHCI requirement at HS400ES mode, force SDHCI
1193 ++ * interface clock to MMC_HS200_MAX_DTR (200 MHz) so that host
1194 ++ * controller CAR clock and the interface clock are rate matched.
1195 ++ */
1196 ++ tegra_sdhci_set_clock(host, MMC_HS200_MAX_DTR);
1197 ++ } else {
1198 ++ val &= ~SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE;
1199 ++ }
1200 ++
1201 ++ sdhci_writel(host, val, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL);
1202 ++}
1203 ++
1204 + static unsigned int tegra_sdhci_get_max_clock(struct sdhci_host *host)
1205 + {
1206 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
1207 +diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
1208 +index a4e4e15f574df..fe55c81608daa 100644
1209 +--- a/drivers/net/bonding/bond_options.c
1210 ++++ b/drivers/net/bonding/bond_options.c
1211 +@@ -1466,7 +1466,7 @@ static int bond_option_ad_actor_system_set(struct bonding *bond,
1212 + mac = (u8 *)&newval->value;
1213 + }
1214 +
1215 +- if (!is_valid_ether_addr(mac))
1216 ++ if (is_multicast_ether_addr(mac))
1217 + goto err;
1218 +
1219 + netdev_dbg(bond->dev, "Setting ad_actor_system to %pM\n", mac);
1220 +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
1221 +index 1662c0985eca4..f854d41c6c94d 100644
1222 +--- a/drivers/net/ethernet/intel/igb/igb_main.c
1223 ++++ b/drivers/net/ethernet/intel/igb/igb_main.c
1224 +@@ -9260,7 +9260,7 @@ static int __maybe_unused igb_suspend(struct device *dev)
1225 + return __igb_shutdown(to_pci_dev(dev), NULL, 0);
1226 + }
1227 +
1228 +-static int __maybe_unused igb_resume(struct device *dev)
1229 ++static int __maybe_unused __igb_resume(struct device *dev, bool rpm)
1230 + {
1231 + struct pci_dev *pdev = to_pci_dev(dev);
1232 + struct net_device *netdev = pci_get_drvdata(pdev);
1233 +@@ -9303,17 +9303,24 @@ static int __maybe_unused igb_resume(struct device *dev)
1234 +
1235 + wr32(E1000_WUS, ~0);
1236 +
1237 +- rtnl_lock();
1238 ++ if (!rpm)
1239 ++ rtnl_lock();
1240 + if (!err && netif_running(netdev))
1241 + err = __igb_open(netdev, true);
1242 +
1243 + if (!err)
1244 + netif_device_attach(netdev);
1245 +- rtnl_unlock();
1246 ++ if (!rpm)
1247 ++ rtnl_unlock();
1248 +
1249 + return err;
1250 + }
1251 +
1252 ++static int __maybe_unused igb_resume(struct device *dev)
1253 ++{
1254 ++ return __igb_resume(dev, false);
1255 ++}
1256 ++
1257 + static int __maybe_unused igb_runtime_idle(struct device *dev)
1258 + {
1259 + struct net_device *netdev = dev_get_drvdata(dev);
1260 +@@ -9332,7 +9339,7 @@ static int __maybe_unused igb_runtime_suspend(struct device *dev)
1261 +
1262 + static int __maybe_unused igb_runtime_resume(struct device *dev)
1263 + {
1264 +- return igb_resume(dev);
1265 ++ return __igb_resume(dev, true);
1266 + }
1267 +
1268 + static void igb_shutdown(struct pci_dev *pdev)
1269 +@@ -9448,7 +9455,7 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev,
1270 + * @pdev: Pointer to PCI device
1271 + *
1272 + * Restart the card from scratch, as if from a cold-boot. Implementation
1273 +- * resembles the first-half of the igb_resume routine.
1274 ++ * resembles the first-half of the __igb_resume routine.
1275 + **/
1276 + static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
1277 + {
1278 +@@ -9488,7 +9495,7 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
1279 + *
1280 + * This callback is called when the error recovery driver tells us that
1281 + * its OK to resume normal operation. Implementation resembles the
1282 +- * second-half of the igb_resume routine.
1283 ++ * second-half of the __igb_resume routine.
1284 + */
1285 + static void igb_io_resume(struct pci_dev *pdev)
1286 + {
1287 +diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
1288 +index feb69fcd908e3..f406f5b517b02 100644
1289 +--- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
1290 ++++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
1291 +@@ -50,12 +50,14 @@ int prestera_port_pvid_set(struct prestera_port *port, u16 vid)
1292 + struct prestera_port *prestera_port_find_by_hwid(struct prestera_switch *sw,
1293 + u32 dev_id, u32 hw_id)
1294 + {
1295 +- struct prestera_port *port = NULL;
1296 ++ struct prestera_port *port = NULL, *tmp;
1297 +
1298 + read_lock(&sw->port_list_lock);
1299 +- list_for_each_entry(port, &sw->port_list, list) {
1300 +- if (port->dev_id == dev_id && port->hw_id == hw_id)
1301 ++ list_for_each_entry(tmp, &sw->port_list, list) {
1302 ++ if (tmp->dev_id == dev_id && tmp->hw_id == hw_id) {
1303 ++ port = tmp;
1304 + break;
1305 ++ }
1306 + }
1307 + read_unlock(&sw->port_list_lock);
1308 +
1309 +@@ -64,12 +66,14 @@ struct prestera_port *prestera_port_find_by_hwid(struct prestera_switch *sw,
1310 +
1311 + struct prestera_port *prestera_find_port(struct prestera_switch *sw, u32 id)
1312 + {
1313 +- struct prestera_port *port = NULL;
1314 ++ struct prestera_port *port = NULL, *tmp;
1315 +
1316 + read_lock(&sw->port_list_lock);
1317 +- list_for_each_entry(port, &sw->port_list, list) {
1318 +- if (port->id == id)
1319 ++ list_for_each_entry(tmp, &sw->port_list, list) {
1320 ++ if (tmp->id == id) {
1321 ++ port = tmp;
1322 + break;
1323 ++ }
1324 + }
1325 + read_unlock(&sw->port_list_lock);
1326 +
1327 +diff --git a/drivers/net/ethernet/micrel/ks8851_par.c b/drivers/net/ethernet/micrel/ks8851_par.c
1328 +index 3bab0cb2b1a56..c7c99cc54ca11 100644
1329 +--- a/drivers/net/ethernet/micrel/ks8851_par.c
1330 ++++ b/drivers/net/ethernet/micrel/ks8851_par.c
1331 +@@ -323,6 +323,8 @@ static int ks8851_probe_par(struct platform_device *pdev)
1332 + return ret;
1333 +
1334 + netdev->irq = platform_get_irq(pdev, 0);
1335 ++ if (netdev->irq < 0)
1336 ++ return netdev->irq;
1337 +
1338 + return ks8851_probe_common(netdev, dev, msg_enable);
1339 + }
1340 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h
1341 +index 7160b42f51ddd..d0111cb3b40e1 100644
1342 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h
1343 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h
1344 +@@ -201,7 +201,7 @@ int qlcnic_sriov_get_vf_vport_info(struct qlcnic_adapter *,
1345 + struct qlcnic_info *, u16);
1346 + int qlcnic_sriov_cfg_vf_guest_vlan(struct qlcnic_adapter *, u16, u8);
1347 + void qlcnic_sriov_free_vlans(struct qlcnic_adapter *);
1348 +-void qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *);
1349 ++int qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *);
1350 + bool qlcnic_sriov_check_any_vlan(struct qlcnic_vf_info *);
1351 + void qlcnic_sriov_del_vlan_id(struct qlcnic_sriov *,
1352 + struct qlcnic_vf_info *, u16);
1353 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
1354 +index 30e52f9697593..8367891bfb139 100644
1355 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
1356 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
1357 +@@ -432,7 +432,7 @@ static int qlcnic_sriov_set_guest_vlan_mode(struct qlcnic_adapter *adapter,
1358 + struct qlcnic_cmd_args *cmd)
1359 + {
1360 + struct qlcnic_sriov *sriov = adapter->ahw->sriov;
1361 +- int i, num_vlans;
1362 ++ int i, num_vlans, ret;
1363 + u16 *vlans;
1364 +
1365 + if (sriov->allowed_vlans)
1366 +@@ -443,7 +443,9 @@ static int qlcnic_sriov_set_guest_vlan_mode(struct qlcnic_adapter *adapter,
1367 + dev_info(&adapter->pdev->dev, "Number of allowed Guest VLANs = %d\n",
1368 + sriov->num_allowed_vlans);
1369 +
1370 +- qlcnic_sriov_alloc_vlans(adapter);
1371 ++ ret = qlcnic_sriov_alloc_vlans(adapter);
1372 ++ if (ret)
1373 ++ return ret;
1374 +
1375 + if (!sriov->any_vlan)
1376 + return 0;
1377 +@@ -2159,7 +2161,7 @@ static int qlcnic_sriov_vf_resume(struct qlcnic_adapter *adapter)
1378 + return err;
1379 + }
1380 +
1381 +-void qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *adapter)
1382 ++int qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *adapter)
1383 + {
1384 + struct qlcnic_sriov *sriov = adapter->ahw->sriov;
1385 + struct qlcnic_vf_info *vf;
1386 +@@ -2169,7 +2171,11 @@ void qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *adapter)
1387 + vf = &sriov->vf_info[i];
1388 + vf->sriov_vlans = kcalloc(sriov->num_allowed_vlans,
1389 + sizeof(*vf->sriov_vlans), GFP_KERNEL);
1390 ++ if (!vf->sriov_vlans)
1391 ++ return -ENOMEM;
1392 + }
1393 ++
1394 ++ return 0;
1395 + }
1396 +
1397 + void qlcnic_sriov_free_vlans(struct qlcnic_adapter *adapter)
1398 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
1399 +index 447720b93e5ab..e90fa97c0ae6c 100644
1400 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
1401 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
1402 +@@ -597,7 +597,9 @@ static int __qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter,
1403 + if (err)
1404 + goto del_flr_queue;
1405 +
1406 +- qlcnic_sriov_alloc_vlans(adapter);
1407 ++ err = qlcnic_sriov_alloc_vlans(adapter);
1408 ++ if (err)
1409 ++ goto del_flr_queue;
1410 +
1411 + return err;
1412 +
1413 +diff --git a/drivers/net/ethernet/sfc/falcon/rx.c b/drivers/net/ethernet/sfc/falcon/rx.c
1414 +index 966f13e7475dd..11a6aee852e92 100644
1415 +--- a/drivers/net/ethernet/sfc/falcon/rx.c
1416 ++++ b/drivers/net/ethernet/sfc/falcon/rx.c
1417 +@@ -728,7 +728,10 @@ static void ef4_init_rx_recycle_ring(struct ef4_nic *efx,
1418 + efx->rx_bufs_per_page);
1419 + rx_queue->page_ring = kcalloc(page_ring_size,
1420 + sizeof(*rx_queue->page_ring), GFP_KERNEL);
1421 +- rx_queue->page_ptr_mask = page_ring_size - 1;
1422 ++ if (!rx_queue->page_ring)
1423 ++ rx_queue->page_ptr_mask = 0;
1424 ++ else
1425 ++ rx_queue->page_ptr_mask = page_ring_size - 1;
1426 + }
1427 +
1428 + void ef4_init_rx_queue(struct ef4_rx_queue *rx_queue)
1429 +diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c
1430 +index 19cf7cac1e6e9..8834bcb12fa97 100644
1431 +--- a/drivers/net/ethernet/sfc/rx_common.c
1432 ++++ b/drivers/net/ethernet/sfc/rx_common.c
1433 +@@ -150,7 +150,10 @@ static void efx_init_rx_recycle_ring(struct efx_rx_queue *rx_queue)
1434 + efx->rx_bufs_per_page);
1435 + rx_queue->page_ring = kcalloc(page_ring_size,
1436 + sizeof(*rx_queue->page_ring), GFP_KERNEL);
1437 +- rx_queue->page_ptr_mask = page_ring_size - 1;
1438 ++ if (!rx_queue->page_ring)
1439 ++ rx_queue->page_ptr_mask = 0;
1440 ++ else
1441 ++ rx_queue->page_ptr_mask = page_ring_size - 1;
1442 + }
1443 +
1444 + static void efx_fini_rx_recycle_ring(struct efx_rx_queue *rx_queue)
1445 +diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
1446 +index 01069dfaf75c9..288b420f88d42 100644
1447 +--- a/drivers/net/ethernet/smsc/smc911x.c
1448 ++++ b/drivers/net/ethernet/smsc/smc911x.c
1449 +@@ -2069,6 +2069,11 @@ static int smc911x_drv_probe(struct platform_device *pdev)
1450 +
1451 + ndev->dma = (unsigned char)-1;
1452 + ndev->irq = platform_get_irq(pdev, 0);
1453 ++ if (ndev->irq < 0) {
1454 ++ ret = ndev->irq;
1455 ++ goto release_both;
1456 ++ }
1457 ++
1458 + lp = netdev_priv(ndev);
1459 + lp->netdev = ndev;
1460 + #ifdef SMC_DYNAMIC_BUS_CONFIG
1461 +diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
1462 +index e449d94661225..2a569eea4ee8f 100644
1463 +--- a/drivers/net/fjes/fjes_main.c
1464 ++++ b/drivers/net/fjes/fjes_main.c
1465 +@@ -1269,6 +1269,11 @@ static int fjes_probe(struct platform_device *plat_dev)
1466 + hw->hw_res.start = res->start;
1467 + hw->hw_res.size = resource_size(res);
1468 + hw->hw_res.irq = platform_get_irq(plat_dev, 0);
1469 ++ if (hw->hw_res.irq < 0) {
1470 ++ err = hw->hw_res.irq;
1471 ++ goto err_free_control_wq;
1472 ++ }
1473 ++
1474 + err = fjes_hw_init(&adapter->hw);
1475 + if (err)
1476 + goto err_free_control_wq;
1477 +diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
1478 +index 920e9f888cc35..63502a85a9751 100644
1479 +--- a/drivers/net/hamradio/mkiss.c
1480 ++++ b/drivers/net/hamradio/mkiss.c
1481 +@@ -792,13 +792,14 @@ static void mkiss_close(struct tty_struct *tty)
1482 + */
1483 + netif_stop_queue(ax->dev);
1484 +
1485 +- /* Free all AX25 frame buffers. */
1486 ++ unregister_netdev(ax->dev);
1487 ++
1488 ++ /* Free all AX25 frame buffers after unreg. */
1489 + kfree(ax->rbuff);
1490 + kfree(ax->xbuff);
1491 +
1492 + ax->tty = NULL;
1493 +
1494 +- unregister_netdev(ax->dev);
1495 + free_netdev(ax->dev);
1496 + }
1497 +
1498 +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
1499 +index c666e990900b9..6f7b70522d926 100644
1500 +--- a/drivers/net/usb/lan78xx.c
1501 ++++ b/drivers/net/usb/lan78xx.c
1502 +@@ -64,6 +64,8 @@
1503 + #define LAN7801_USB_PRODUCT_ID (0x7801)
1504 + #define LAN78XX_EEPROM_MAGIC (0x78A5)
1505 + #define LAN78XX_OTP_MAGIC (0x78F3)
1506 ++#define AT29M2AF_USB_VENDOR_ID (0x07C9)
1507 ++#define AT29M2AF_USB_PRODUCT_ID (0x0012)
1508 +
1509 + #define MII_READ 1
1510 + #define MII_WRITE 0
1511 +@@ -4142,6 +4144,10 @@ static const struct usb_device_id products[] = {
1512 + /* LAN7801 USB Gigabit Ethernet Device */
1513 + USB_DEVICE(LAN78XX_USB_VENDOR_ID, LAN7801_USB_PRODUCT_ID),
1514 + },
1515 ++ {
1516 ++ /* ATM2-AF USB Gigabit Ethernet Device */
1517 ++ USB_DEVICE(AT29M2AF_USB_VENDOR_ID, AT29M2AF_USB_PRODUCT_ID),
1518 ++ },
1519 + {},
1520 + };
1521 + MODULE_DEVICE_TABLE(usb, products);
1522 +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
1523 +index 1d21129f7751c..40ce18a0d0190 100644
1524 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
1525 ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
1526 +@@ -1244,6 +1244,18 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
1527 + raw_spin_lock_init(&pc->irq_lock[i]);
1528 + }
1529 +
1530 ++ pc->pctl_desc = *pdata->pctl_desc;
1531 ++ pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc);
1532 ++ if (IS_ERR(pc->pctl_dev)) {
1533 ++ gpiochip_remove(&pc->gpio_chip);
1534 ++ return PTR_ERR(pc->pctl_dev);
1535 ++ }
1536 ++
1537 ++ pc->gpio_range = *pdata->gpio_range;
1538 ++ pc->gpio_range.base = pc->gpio_chip.base;
1539 ++ pc->gpio_range.gc = &pc->gpio_chip;
1540 ++ pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range);
1541 ++
1542 + girq = &pc->gpio_chip.irq;
1543 + girq->chip = &bcm2835_gpio_irq_chip;
1544 + girq->parent_handler = bcm2835_gpio_irq_handler;
1545 +@@ -1251,8 +1263,10 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
1546 + girq->parents = devm_kcalloc(dev, BCM2835_NUM_IRQS,
1547 + sizeof(*girq->parents),
1548 + GFP_KERNEL);
1549 +- if (!girq->parents)
1550 ++ if (!girq->parents) {
1551 ++ pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
1552 + return -ENOMEM;
1553 ++ }
1554 +
1555 + if (is_7211) {
1556 + pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS,
1557 +@@ -1303,21 +1317,10 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
1558 + err = gpiochip_add_data(&pc->gpio_chip, pc);
1559 + if (err) {
1560 + dev_err(dev, "could not add GPIO chip\n");
1561 ++ pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
1562 + return err;
1563 + }
1564 +
1565 +- pc->pctl_desc = *pdata->pctl_desc;
1566 +- pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc);
1567 +- if (IS_ERR(pc->pctl_dev)) {
1568 +- gpiochip_remove(&pc->gpio_chip);
1569 +- return PTR_ERR(pc->pctl_dev);
1570 +- }
1571 +-
1572 +- pc->gpio_range = *pdata->gpio_range;
1573 +- pc->gpio_range.base = pc->gpio_chip.base;
1574 +- pc->gpio_range.gc = &pc->gpio_chip;
1575 +- pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range);
1576 +-
1577 + return 0;
1578 + }
1579 +
1580 +diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
1581 +index 10002b8497fea..fbb7807e0da29 100644
1582 +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
1583 ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
1584 +@@ -280,8 +280,12 @@ static int mtk_xt_get_gpio_n(void *data, unsigned long eint_n,
1585 + desc = (const struct mtk_pin_desc *)hw->soc->pins;
1586 + *gpio_chip = &hw->chip;
1587 +
1588 +- /* Be greedy to guess first gpio_n is equal to eint_n */
1589 +- if (desc[eint_n].eint.eint_n == eint_n)
1590 ++ /*
1591 ++ * Be greedy to guess first gpio_n is equal to eint_n.
1592 ++ * Only eint virtual eint number is greater than gpio number.
1593 ++ */
1594 ++ if (hw->soc->npins > eint_n &&
1595 ++ desc[eint_n].eint.eint_n == eint_n)
1596 + *gpio_n = eint_n;
1597 + else
1598 + *gpio_n = mtk_xt_find_eint_num(hw, eint_n);
1599 +diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
1600 +index a5f1f6ba74392..e13723bb2be41 100644
1601 +--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
1602 ++++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
1603 +@@ -1255,10 +1255,10 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,
1604 + bank_nr = args.args[1] / STM32_GPIO_PINS_PER_BANK;
1605 + bank->gpio_chip.base = args.args[1];
1606 +
1607 +- npins = args.args[2];
1608 +- while (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
1609 +- ++i, &args))
1610 +- npins += args.args[2];
1611 ++ /* get the last defined gpio line (offset + nb of pins) */
1612 ++ npins = args.args[0] + args.args[2];
1613 ++ while (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, ++i, &args))
1614 ++ npins = max(npins, (int)(args.args[0] + args.args[2]));
1615 + } else {
1616 + bank_nr = pctl->nbanks;
1617 + bank->gpio_chip.base = bank_nr * STM32_GPIO_PINS_PER_BANK;
1618 +diff --git a/drivers/platform/x86/intel_pmc_core_pltdrv.c b/drivers/platform/x86/intel_pmc_core_pltdrv.c
1619 +index 73797680b895c..15ca8afdd973d 100644
1620 +--- a/drivers/platform/x86/intel_pmc_core_pltdrv.c
1621 ++++ b/drivers/platform/x86/intel_pmc_core_pltdrv.c
1622 +@@ -65,7 +65,7 @@ static int __init pmc_core_platform_init(void)
1623 +
1624 + retval = platform_device_register(pmc_core_device);
1625 + if (retval)
1626 +- kfree(pmc_core_device);
1627 ++ platform_device_put(pmc_core_device);
1628 +
1629 + return retval;
1630 + }
1631 +diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c
1632 +index 46feafe4e201c..d8cc4b270644a 100644
1633 +--- a/drivers/spi/spi-armada-3700.c
1634 ++++ b/drivers/spi/spi-armada-3700.c
1635 +@@ -901,7 +901,7 @@ static int a3700_spi_probe(struct platform_device *pdev)
1636 + return 0;
1637 +
1638 + error_clk:
1639 +- clk_disable_unprepare(spi->clk);
1640 ++ clk_unprepare(spi->clk);
1641 + error:
1642 + spi_master_put(master);
1643 + out:
1644 +diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c
1645 +index c41a9a501a6e9..fa75024f16f7f 100644
1646 +--- a/drivers/tee/optee/shm_pool.c
1647 ++++ b/drivers/tee/optee/shm_pool.c
1648 +@@ -41,10 +41,8 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
1649 + goto err;
1650 + }
1651 +
1652 +- for (i = 0; i < nr_pages; i++) {
1653 +- pages[i] = page;
1654 +- page++;
1655 +- }
1656 ++ for (i = 0; i < nr_pages; i++)
1657 ++ pages[i] = page + i;
1658 +
1659 + shm->flags |= TEE_SHM_REGISTER;
1660 + rc = optee_shm_register(shm->ctx, shm, pages, nr_pages,
1661 +diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
1662 +index 8a9384a64f3e2..499fccba3d74b 100644
1663 +--- a/drivers/tee/tee_shm.c
1664 ++++ b/drivers/tee/tee_shm.c
1665 +@@ -1,11 +1,11 @@
1666 + // SPDX-License-Identifier: GPL-2.0-only
1667 + /*
1668 +- * Copyright (c) 2015-2016, Linaro Limited
1669 ++ * Copyright (c) 2015-2017, 2019-2021 Linaro Limited
1670 + */
1671 ++#include <linux/anon_inodes.h>
1672 + #include <linux/device.h>
1673 +-#include <linux/dma-buf.h>
1674 +-#include <linux/fdtable.h>
1675 + #include <linux/idr.h>
1676 ++#include <linux/mm.h>
1677 + #include <linux/sched.h>
1678 + #include <linux/slab.h>
1679 + #include <linux/tee_drv.h>
1680 +@@ -28,16 +28,8 @@ static void release_registered_pages(struct tee_shm *shm)
1681 + }
1682 + }
1683 +
1684 +-static void tee_shm_release(struct tee_shm *shm)
1685 ++static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm)
1686 + {
1687 +- struct tee_device *teedev = shm->ctx->teedev;
1688 +-
1689 +- if (shm->flags & TEE_SHM_DMA_BUF) {
1690 +- mutex_lock(&teedev->mutex);
1691 +- idr_remove(&teedev->idr, shm->id);
1692 +- mutex_unlock(&teedev->mutex);
1693 +- }
1694 +-
1695 + if (shm->flags & TEE_SHM_POOL) {
1696 + struct tee_shm_pool_mgr *poolm;
1697 +
1698 +@@ -64,45 +56,6 @@ static void tee_shm_release(struct tee_shm *shm)
1699 + tee_device_put(teedev);
1700 + }
1701 +
1702 +-static struct sg_table *tee_shm_op_map_dma_buf(struct dma_buf_attachment
1703 +- *attach, enum dma_data_direction dir)
1704 +-{
1705 +- return NULL;
1706 +-}
1707 +-
1708 +-static void tee_shm_op_unmap_dma_buf(struct dma_buf_attachment *attach,
1709 +- struct sg_table *table,
1710 +- enum dma_data_direction dir)
1711 +-{
1712 +-}
1713 +-
1714 +-static void tee_shm_op_release(struct dma_buf *dmabuf)
1715 +-{
1716 +- struct tee_shm *shm = dmabuf->priv;
1717 +-
1718 +- tee_shm_release(shm);
1719 +-}
1720 +-
1721 +-static int tee_shm_op_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
1722 +-{
1723 +- struct tee_shm *shm = dmabuf->priv;
1724 +- size_t size = vma->vm_end - vma->vm_start;
1725 +-
1726 +- /* Refuse sharing shared memory provided by application */
1727 +- if (shm->flags & TEE_SHM_USER_MAPPED)
1728 +- return -EINVAL;
1729 +-
1730 +- return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
1731 +- size, vma->vm_page_prot);
1732 +-}
1733 +-
1734 +-static const struct dma_buf_ops tee_shm_dma_buf_ops = {
1735 +- .map_dma_buf = tee_shm_op_map_dma_buf,
1736 +- .unmap_dma_buf = tee_shm_op_unmap_dma_buf,
1737 +- .release = tee_shm_op_release,
1738 +- .mmap = tee_shm_op_mmap,
1739 +-};
1740 +-
1741 + struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags)
1742 + {
1743 + struct tee_device *teedev = ctx->teedev;
1744 +@@ -137,6 +90,7 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags)
1745 + goto err_dev_put;
1746 + }
1747 +
1748 ++ refcount_set(&shm->refcount, 1);
1749 + shm->flags = flags | TEE_SHM_POOL;
1750 + shm->ctx = ctx;
1751 + if (flags & TEE_SHM_DMA_BUF)
1752 +@@ -150,10 +104,7 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags)
1753 + goto err_kfree;
1754 + }
1755 +
1756 +-
1757 + if (flags & TEE_SHM_DMA_BUF) {
1758 +- DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
1759 +-
1760 + mutex_lock(&teedev->mutex);
1761 + shm->id = idr_alloc(&teedev->idr, shm, 1, 0, GFP_KERNEL);
1762 + mutex_unlock(&teedev->mutex);
1763 +@@ -161,28 +112,11 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags)
1764 + ret = ERR_PTR(shm->id);
1765 + goto err_pool_free;
1766 + }
1767 +-
1768 +- exp_info.ops = &tee_shm_dma_buf_ops;
1769 +- exp_info.size = shm->size;
1770 +- exp_info.flags = O_RDWR;
1771 +- exp_info.priv = shm;
1772 +-
1773 +- shm->dmabuf = dma_buf_export(&exp_info);
1774 +- if (IS_ERR(shm->dmabuf)) {
1775 +- ret = ERR_CAST(shm->dmabuf);
1776 +- goto err_rem;
1777 +- }
1778 + }
1779 +
1780 + teedev_ctx_get(ctx);
1781 +
1782 + return shm;
1783 +-err_rem:
1784 +- if (flags & TEE_SHM_DMA_BUF) {
1785 +- mutex_lock(&teedev->mutex);
1786 +- idr_remove(&teedev->idr, shm->id);
1787 +- mutex_unlock(&teedev->mutex);
1788 +- }
1789 + err_pool_free:
1790 + poolm->ops->free(poolm, shm);
1791 + err_kfree:
1792 +@@ -243,6 +177,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
1793 + goto err;
1794 + }
1795 +
1796 ++ refcount_set(&shm->refcount, 1);
1797 + shm->flags = flags | TEE_SHM_REGISTER;
1798 + shm->ctx = ctx;
1799 + shm->id = -1;
1800 +@@ -303,22 +238,6 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
1801 + goto err;
1802 + }
1803 +
1804 +- if (flags & TEE_SHM_DMA_BUF) {
1805 +- DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
1806 +-
1807 +- exp_info.ops = &tee_shm_dma_buf_ops;
1808 +- exp_info.size = shm->size;
1809 +- exp_info.flags = O_RDWR;
1810 +- exp_info.priv = shm;
1811 +-
1812 +- shm->dmabuf = dma_buf_export(&exp_info);
1813 +- if (IS_ERR(shm->dmabuf)) {
1814 +- ret = ERR_CAST(shm->dmabuf);
1815 +- teedev->desc->ops->shm_unregister(ctx, shm);
1816 +- goto err;
1817 +- }
1818 +- }
1819 +-
1820 + return shm;
1821 + err:
1822 + if (shm) {
1823 +@@ -336,6 +255,35 @@ err:
1824 + }
1825 + EXPORT_SYMBOL_GPL(tee_shm_register);
1826 +
1827 ++static int tee_shm_fop_release(struct inode *inode, struct file *filp)
1828 ++{
1829 ++ tee_shm_put(filp->private_data);
1830 ++ return 0;
1831 ++}
1832 ++
1833 ++static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma)
1834 ++{
1835 ++ struct tee_shm *shm = filp->private_data;
1836 ++ size_t size = vma->vm_end - vma->vm_start;
1837 ++
1838 ++ /* Refuse sharing shared memory provided by application */
1839 ++ if (shm->flags & TEE_SHM_USER_MAPPED)
1840 ++ return -EINVAL;
1841 ++
1842 ++ /* check for overflowing the buffer's size */
1843 ++ if (vma->vm_pgoff + vma_pages(vma) > shm->size >> PAGE_SHIFT)
1844 ++ return -EINVAL;
1845 ++
1846 ++ return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
1847 ++ size, vma->vm_page_prot);
1848 ++}
1849 ++
1850 ++static const struct file_operations tee_shm_fops = {
1851 ++ .owner = THIS_MODULE,
1852 ++ .release = tee_shm_fop_release,
1853 ++ .mmap = tee_shm_fop_mmap,
1854 ++};
1855 ++
1856 + /**
1857 + * tee_shm_get_fd() - Increase reference count and return file descriptor
1858 + * @shm: Shared memory handle
1859 +@@ -348,10 +296,11 @@ int tee_shm_get_fd(struct tee_shm *shm)
1860 + if (!(shm->flags & TEE_SHM_DMA_BUF))
1861 + return -EINVAL;
1862 +
1863 +- get_dma_buf(shm->dmabuf);
1864 +- fd = dma_buf_fd(shm->dmabuf, O_CLOEXEC);
1865 ++ /* matched by tee_shm_put() in tee_shm_op_release() */
1866 ++ refcount_inc(&shm->refcount);
1867 ++ fd = anon_inode_getfd("tee_shm", &tee_shm_fops, shm, O_RDWR);
1868 + if (fd < 0)
1869 +- dma_buf_put(shm->dmabuf);
1870 ++ tee_shm_put(shm);
1871 + return fd;
1872 + }
1873 +
1874 +@@ -361,17 +310,7 @@ int tee_shm_get_fd(struct tee_shm *shm)
1875 + */
1876 + void tee_shm_free(struct tee_shm *shm)
1877 + {
1878 +- /*
1879 +- * dma_buf_put() decreases the dmabuf reference counter and will
1880 +- * call tee_shm_release() when the last reference is gone.
1881 +- *
1882 +- * In the case of driver private memory we call tee_shm_release
1883 +- * directly instead as it doesn't have a reference counter.
1884 +- */
1885 +- if (shm->flags & TEE_SHM_DMA_BUF)
1886 +- dma_buf_put(shm->dmabuf);
1887 +- else
1888 +- tee_shm_release(shm);
1889 ++ tee_shm_put(shm);
1890 + }
1891 + EXPORT_SYMBOL_GPL(tee_shm_free);
1892 +
1893 +@@ -478,10 +417,15 @@ struct tee_shm *tee_shm_get_from_id(struct tee_context *ctx, int id)
1894 + teedev = ctx->teedev;
1895 + mutex_lock(&teedev->mutex);
1896 + shm = idr_find(&teedev->idr, id);
1897 ++ /*
1898 ++ * If the tee_shm was found in the IDR it must have a refcount
1899 ++ * larger than 0 due to the guarantee in tee_shm_put() below. So
1900 ++ * it's safe to use refcount_inc().
1901 ++ */
1902 + if (!shm || shm->ctx != ctx)
1903 + shm = ERR_PTR(-EINVAL);
1904 +- else if (shm->flags & TEE_SHM_DMA_BUF)
1905 +- get_dma_buf(shm->dmabuf);
1906 ++ else
1907 ++ refcount_inc(&shm->refcount);
1908 + mutex_unlock(&teedev->mutex);
1909 + return shm;
1910 + }
1911 +@@ -493,7 +437,24 @@ EXPORT_SYMBOL_GPL(tee_shm_get_from_id);
1912 + */
1913 + void tee_shm_put(struct tee_shm *shm)
1914 + {
1915 +- if (shm->flags & TEE_SHM_DMA_BUF)
1916 +- dma_buf_put(shm->dmabuf);
1917 ++ struct tee_device *teedev = shm->ctx->teedev;
1918 ++ bool do_release = false;
1919 ++
1920 ++ mutex_lock(&teedev->mutex);
1921 ++ if (refcount_dec_and_test(&shm->refcount)) {
1922 ++ /*
1923 ++ * refcount has reached 0, we must now remove it from the
1924 ++ * IDR before releasing the mutex. This will guarantee that
1925 ++ * the refcount_inc() in tee_shm_get_from_id() never starts
1926 ++ * from 0.
1927 ++ */
1928 ++ if (shm->flags & TEE_SHM_DMA_BUF)
1929 ++ idr_remove(&teedev->idr, shm->id);
1930 ++ do_release = true;
1931 ++ }
1932 ++ mutex_unlock(&teedev->mutex);
1933 ++
1934 ++ if (do_release)
1935 ++ tee_shm_release(teedev, shm);
1936 + }
1937 + EXPORT_SYMBOL_GPL(tee_shm_put);
1938 +diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
1939 +index a9cb647bac6fb..a40be8b448c24 100644
1940 +--- a/drivers/usb/gadget/function/u_ether.c
1941 ++++ b/drivers/usb/gadget/function/u_ether.c
1942 +@@ -860,19 +860,23 @@ int gether_register_netdev(struct net_device *net)
1943 + {
1944 + struct eth_dev *dev;
1945 + struct usb_gadget *g;
1946 +- struct sockaddr sa;
1947 + int status;
1948 +
1949 + if (!net->dev.parent)
1950 + return -EINVAL;
1951 + dev = netdev_priv(net);
1952 + g = dev->gadget;
1953 ++
1954 ++ memcpy(net->dev_addr, dev->dev_mac, ETH_ALEN);
1955 ++ net->addr_assign_type = NET_ADDR_RANDOM;
1956 ++
1957 + status = register_netdev(net);
1958 + if (status < 0) {
1959 + dev_dbg(&g->dev, "register_netdev failed, %d\n", status);
1960 + return status;
1961 + } else {
1962 + INFO(dev, "HOST MAC %pM\n", dev->host_mac);
1963 ++ INFO(dev, "MAC %pM\n", dev->dev_mac);
1964 +
1965 + /* two kinds of host-initiated state changes:
1966 + * - iff DATA transfer is active, carrier is "on"
1967 +@@ -880,15 +884,6 @@ int gether_register_netdev(struct net_device *net)
1968 + */
1969 + netif_carrier_off(net);
1970 + }
1971 +- sa.sa_family = net->type;
1972 +- memcpy(sa.sa_data, dev->dev_mac, ETH_ALEN);
1973 +- rtnl_lock();
1974 +- status = dev_set_mac_address(net, &sa, NULL);
1975 +- rtnl_unlock();
1976 +- if (status)
1977 +- pr_warn("cannot set self ethernet address: %d\n", status);
1978 +- else
1979 +- INFO(dev, "MAC %pM\n", dev->dev_mac);
1980 +
1981 + return status;
1982 + }
1983 +diff --git a/fs/ceph/file.c b/fs/ceph/file.c
1984 +index 8e6855e7ed836..8ed881fd7440d 100644
1985 +--- a/fs/ceph/file.c
1986 ++++ b/fs/ceph/file.c
1987 +@@ -603,13 +603,25 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry,
1988 + in.cap.realm = cpu_to_le64(ci->i_snap_realm->ino);
1989 + in.cap.flags = CEPH_CAP_FLAG_AUTH;
1990 + in.ctime = in.mtime = in.atime = iinfo.btime;
1991 +- in.mode = cpu_to_le32((u32)mode);
1992 + in.truncate_seq = cpu_to_le32(1);
1993 + in.truncate_size = cpu_to_le64(-1ULL);
1994 + in.xattr_version = cpu_to_le64(1);
1995 + in.uid = cpu_to_le32(from_kuid(&init_user_ns, current_fsuid()));
1996 +- in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_mode & S_ISGID ?
1997 +- dir->i_gid : current_fsgid()));
1998 ++ if (dir->i_mode & S_ISGID) {
1999 ++ in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_gid));
2000 ++
2001 ++ /* Directories always inherit the setgid bit. */
2002 ++ if (S_ISDIR(mode))
2003 ++ mode |= S_ISGID;
2004 ++ else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) &&
2005 ++ !in_group_p(dir->i_gid) &&
2006 ++ !capable_wrt_inode_uidgid(dir, CAP_FSETID))
2007 ++ mode &= ~S_ISGID;
2008 ++ } else {
2009 ++ in.gid = cpu_to_le32(from_kgid(&init_user_ns, current_fsgid()));
2010 ++ }
2011 ++ in.mode = cpu_to_le32((u32)mode);
2012 ++
2013 + in.nlink = cpu_to_le32(1);
2014 + in.max_size = cpu_to_le64(lo->stripe_unit);
2015 +
2016 +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
2017 +index c2f237653f68e..b8c9df6ab67f5 100644
2018 +--- a/fs/ext4/extents.c
2019 ++++ b/fs/ext4/extents.c
2020 +@@ -136,14 +136,24 @@ int ext4_datasem_ensure_credits(handle_t *handle, struct inode *inode,
2021 + static int ext4_ext_get_access(handle_t *handle, struct inode *inode,
2022 + struct ext4_ext_path *path)
2023 + {
2024 ++ int err = 0;
2025 ++
2026 + if (path->p_bh) {
2027 + /* path points to block */
2028 + BUFFER_TRACE(path->p_bh, "get_write_access");
2029 +- return ext4_journal_get_write_access(handle, path->p_bh);
2030 ++ err = ext4_journal_get_write_access(handle, path->p_bh);
2031 ++ /*
2032 ++ * The extent buffer's verified bit will be set again in
2033 ++ * __ext4_ext_dirty(). We could leave an inconsistent
2034 ++ * buffer if the extents updating procudure break off du
2035 ++ * to some error happens, force to check it again.
2036 ++ */
2037 ++ if (!err)
2038 ++ clear_buffer_verified(path->p_bh);
2039 + }
2040 + /* path points to leaf/index in inode body */
2041 + /* we use in-core data, no need to protect them */
2042 +- return 0;
2043 ++ return err;
2044 + }
2045 +
2046 + /*
2047 +@@ -164,6 +174,9 @@ static int __ext4_ext_dirty(const char *where, unsigned int line,
2048 + /* path points to block */
2049 + err = __ext4_handle_dirty_metadata(where, line, handle,
2050 + inode, path->p_bh);
2051 ++ /* Extents updating done, re-set verified flag */
2052 ++ if (!err)
2053 ++ set_buffer_verified(path->p_bh);
2054 + } else {
2055 + /* path points to leaf/index in inode body */
2056 + err = ext4_mark_inode_dirty(handle, inode);
2057 +@@ -353,9 +366,13 @@ static int ext4_valid_extent_idx(struct inode *inode,
2058 +
2059 + static int ext4_valid_extent_entries(struct inode *inode,
2060 + struct ext4_extent_header *eh,
2061 +- ext4_fsblk_t *pblk, int depth)
2062 ++ ext4_lblk_t lblk, ext4_fsblk_t *pblk,
2063 ++ int depth)
2064 + {
2065 + unsigned short entries;
2066 ++ ext4_lblk_t lblock = 0;
2067 ++ ext4_lblk_t prev = 0;
2068 ++
2069 + if (eh->eh_entries == 0)
2070 + return 1;
2071 +
2072 +@@ -364,31 +381,51 @@ static int ext4_valid_extent_entries(struct inode *inode,
2073 + if (depth == 0) {
2074 + /* leaf entries */
2075 + struct ext4_extent *ext = EXT_FIRST_EXTENT(eh);
2076 +- ext4_lblk_t lblock = 0;
2077 +- ext4_lblk_t prev = 0;
2078 +- int len = 0;
2079 ++
2080 ++ /*
2081 ++ * The logical block in the first entry should equal to
2082 ++ * the number in the index block.
2083 ++ */
2084 ++ if (depth != ext_depth(inode) &&
2085 ++ lblk != le32_to_cpu(ext->ee_block))
2086 ++ return 0;
2087 + while (entries) {
2088 + if (!ext4_valid_extent(inode, ext))
2089 + return 0;
2090 +
2091 + /* Check for overlapping extents */
2092 + lblock = le32_to_cpu(ext->ee_block);
2093 +- len = ext4_ext_get_actual_len(ext);
2094 + if ((lblock <= prev) && prev) {
2095 + *pblk = ext4_ext_pblock(ext);
2096 + return 0;
2097 + }
2098 ++ prev = lblock + ext4_ext_get_actual_len(ext) - 1;
2099 + ext++;
2100 + entries--;
2101 +- prev = lblock + len - 1;
2102 + }
2103 + } else {
2104 + struct ext4_extent_idx *ext_idx = EXT_FIRST_INDEX(eh);
2105 ++
2106 ++ /*
2107 ++ * The logical block in the first entry should equal to
2108 ++ * the number in the parent index block.
2109 ++ */
2110 ++ if (depth != ext_depth(inode) &&
2111 ++ lblk != le32_to_cpu(ext_idx->ei_block))
2112 ++ return 0;
2113 + while (entries) {
2114 + if (!ext4_valid_extent_idx(inode, ext_idx))
2115 + return 0;
2116 ++
2117 ++ /* Check for overlapping index extents */
2118 ++ lblock = le32_to_cpu(ext_idx->ei_block);
2119 ++ if ((lblock <= prev) && prev) {
2120 ++ *pblk = ext4_idx_pblock(ext_idx);
2121 ++ return 0;
2122 ++ }
2123 + ext_idx++;
2124 + entries--;
2125 ++ prev = lblock;
2126 + }
2127 + }
2128 + return 1;
2129 +@@ -396,7 +433,7 @@ static int ext4_valid_extent_entries(struct inode *inode,
2130 +
2131 + static int __ext4_ext_check(const char *function, unsigned int line,
2132 + struct inode *inode, struct ext4_extent_header *eh,
2133 +- int depth, ext4_fsblk_t pblk)
2134 ++ int depth, ext4_fsblk_t pblk, ext4_lblk_t lblk)
2135 + {
2136 + const char *error_msg;
2137 + int max = 0, err = -EFSCORRUPTED;
2138 +@@ -422,7 +459,7 @@ static int __ext4_ext_check(const char *function, unsigned int line,
2139 + error_msg = "invalid eh_entries";
2140 + goto corrupted;
2141 + }
2142 +- if (!ext4_valid_extent_entries(inode, eh, &pblk, depth)) {
2143 ++ if (!ext4_valid_extent_entries(inode, eh, lblk, &pblk, depth)) {
2144 + error_msg = "invalid extent entries";
2145 + goto corrupted;
2146 + }
2147 +@@ -452,7 +489,7 @@ corrupted:
2148 + }
2149 +
2150 + #define ext4_ext_check(inode, eh, depth, pblk) \
2151 +- __ext4_ext_check(__func__, __LINE__, (inode), (eh), (depth), (pblk))
2152 ++ __ext4_ext_check(__func__, __LINE__, (inode), (eh), (depth), (pblk), 0)
2153 +
2154 + int ext4_ext_check_inode(struct inode *inode)
2155 + {
2156 +@@ -485,16 +522,18 @@ static void ext4_cache_extents(struct inode *inode,
2157 +
2158 + static struct buffer_head *
2159 + __read_extent_tree_block(const char *function, unsigned int line,
2160 +- struct inode *inode, ext4_fsblk_t pblk, int depth,
2161 +- int flags)
2162 ++ struct inode *inode, struct ext4_extent_idx *idx,
2163 ++ int depth, int flags)
2164 + {
2165 + struct buffer_head *bh;
2166 + int err;
2167 + gfp_t gfp_flags = __GFP_MOVABLE | GFP_NOFS;
2168 ++ ext4_fsblk_t pblk;
2169 +
2170 + if (flags & EXT4_EX_NOFAIL)
2171 + gfp_flags |= __GFP_NOFAIL;
2172 +
2173 ++ pblk = ext4_idx_pblock(idx);
2174 + bh = sb_getblk_gfp(inode->i_sb, pblk, gfp_flags);
2175 + if (unlikely(!bh))
2176 + return ERR_PTR(-ENOMEM);
2177 +@@ -507,8 +546,8 @@ __read_extent_tree_block(const char *function, unsigned int line,
2178 + }
2179 + if (buffer_verified(bh) && !(flags & EXT4_EX_FORCE_CACHE))
2180 + return bh;
2181 +- err = __ext4_ext_check(function, line, inode,
2182 +- ext_block_hdr(bh), depth, pblk);
2183 ++ err = __ext4_ext_check(function, line, inode, ext_block_hdr(bh),
2184 ++ depth, pblk, le32_to_cpu(idx->ei_block));
2185 + if (err)
2186 + goto errout;
2187 + set_buffer_verified(bh);
2188 +@@ -526,8 +565,8 @@ errout:
2189 +
2190 + }
2191 +
2192 +-#define read_extent_tree_block(inode, pblk, depth, flags) \
2193 +- __read_extent_tree_block(__func__, __LINE__, (inode), (pblk), \
2194 ++#define read_extent_tree_block(inode, idx, depth, flags) \
2195 ++ __read_extent_tree_block(__func__, __LINE__, (inode), (idx), \
2196 + (depth), (flags))
2197 +
2198 + /*
2199 +@@ -577,8 +616,7 @@ int ext4_ext_precache(struct inode *inode)
2200 + i--;
2201 + continue;
2202 + }
2203 +- bh = read_extent_tree_block(inode,
2204 +- ext4_idx_pblock(path[i].p_idx++),
2205 ++ bh = read_extent_tree_block(inode, path[i].p_idx++,
2206 + depth - i - 1,
2207 + EXT4_EX_FORCE_CACHE);
2208 + if (IS_ERR(bh)) {
2209 +@@ -883,8 +921,7 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block,
2210 + path[ppos].p_depth = i;
2211 + path[ppos].p_ext = NULL;
2212 +
2213 +- bh = read_extent_tree_block(inode, path[ppos].p_block, --i,
2214 +- flags);
2215 ++ bh = read_extent_tree_block(inode, path[ppos].p_idx, --i, flags);
2216 + if (IS_ERR(bh)) {
2217 + ret = PTR_ERR(bh);
2218 + goto err;
2219 +@@ -1489,7 +1526,6 @@ static int ext4_ext_search_right(struct inode *inode,
2220 + struct ext4_extent_header *eh;
2221 + struct ext4_extent_idx *ix;
2222 + struct ext4_extent *ex;
2223 +- ext4_fsblk_t block;
2224 + int depth; /* Note, NOT eh_depth; depth from top of tree */
2225 + int ee_len;
2226 +
2227 +@@ -1556,20 +1592,17 @@ got_index:
2228 + * follow it and find the closest allocated
2229 + * block to the right */
2230 + ix++;
2231 +- block = ext4_idx_pblock(ix);
2232 + while (++depth < path->p_depth) {
2233 + /* subtract from p_depth to get proper eh_depth */
2234 +- bh = read_extent_tree_block(inode, block,
2235 +- path->p_depth - depth, 0);
2236 ++ bh = read_extent_tree_block(inode, ix, path->p_depth - depth, 0);
2237 + if (IS_ERR(bh))
2238 + return PTR_ERR(bh);
2239 + eh = ext_block_hdr(bh);
2240 + ix = EXT_FIRST_INDEX(eh);
2241 +- block = ext4_idx_pblock(ix);
2242 + put_bh(bh);
2243 + }
2244 +
2245 +- bh = read_extent_tree_block(inode, block, path->p_depth - depth, 0);
2246 ++ bh = read_extent_tree_block(inode, ix, path->p_depth - depth, 0);
2247 + if (IS_ERR(bh))
2248 + return PTR_ERR(bh);
2249 + eh = ext_block_hdr(bh);
2250 +@@ -2948,9 +2981,9 @@ again:
2251 + ext_debug(inode, "move to level %d (block %llu)\n",
2252 + i + 1, ext4_idx_pblock(path[i].p_idx));
2253 + memset(path + i + 1, 0, sizeof(*path));
2254 +- bh = read_extent_tree_block(inode,
2255 +- ext4_idx_pblock(path[i].p_idx), depth - i - 1,
2256 +- EXT4_EX_NOCACHE);
2257 ++ bh = read_extent_tree_block(inode, path[i].p_idx,
2258 ++ depth - i - 1,
2259 ++ EXT4_EX_NOCACHE);
2260 + if (IS_ERR(bh)) {
2261 + /* should we reset i_size? */
2262 + err = PTR_ERR(bh);
2263 +diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
2264 +index 65afcc3cc68a0..f44c60114379e 100644
2265 +--- a/fs/f2fs/xattr.c
2266 ++++ b/fs/f2fs/xattr.c
2267 +@@ -680,8 +680,17 @@ static int __f2fs_setxattr(struct inode *inode, int index,
2268 + }
2269 +
2270 + last = here;
2271 +- while (!IS_XATTR_LAST_ENTRY(last))
2272 ++ while (!IS_XATTR_LAST_ENTRY(last)) {
2273 ++ if ((void *)(last) + sizeof(__u32) > last_base_addr ||
2274 ++ (void *)XATTR_NEXT_ENTRY(last) > last_base_addr) {
2275 ++ f2fs_err(F2FS_I_SB(inode), "inode (%lu) has invalid last xattr entry, entry_size: %zu",
2276 ++ inode->i_ino, ENTRY_SIZE(last));
2277 ++ set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
2278 ++ error = -EFSCORRUPTED;
2279 ++ goto exit;
2280 ++ }
2281 + last = XATTR_NEXT_ENTRY(last);
2282 ++ }
2283 +
2284 + newsize = XATTR_ALIGN(sizeof(struct f2fs_xattr_entry) + len + size);
2285 +
2286 +diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
2287 +index 459e9a76d7e6f..0c6c1de6f3b77 100644
2288 +--- a/include/linux/tee_drv.h
2289 ++++ b/include/linux/tee_drv.h
2290 +@@ -195,7 +195,7 @@ int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
2291 + * @offset: offset of buffer in user space
2292 + * @pages: locked pages from userspace
2293 + * @num_pages: number of locked pages
2294 +- * @dmabuf: dmabuf used to for exporting to user space
2295 ++ * @refcount: reference counter
2296 + * @flags: defined by TEE_SHM_* in tee_drv.h
2297 + * @id: unique id of a shared memory object on this device
2298 + *
2299 +@@ -210,7 +210,7 @@ struct tee_shm {
2300 + unsigned int offset;
2301 + struct page **pages;
2302 + size_t num_pages;
2303 +- struct dma_buf *dmabuf;
2304 ++ refcount_t refcount;
2305 + u32 flags;
2306 + int id;
2307 + };
2308 +diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
2309 +index 04e87f4b9417c..a960de68ac69e 100644
2310 +--- a/include/linux/virtio_net.h
2311 ++++ b/include/linux/virtio_net.h
2312 +@@ -7,9 +7,27 @@
2313 + #include <uapi/linux/udp.h>
2314 + #include <uapi/linux/virtio_net.h>
2315 +
2316 ++static inline bool virtio_net_hdr_match_proto(__be16 protocol, __u8 gso_type)
2317 ++{
2318 ++ switch (gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
2319 ++ case VIRTIO_NET_HDR_GSO_TCPV4:
2320 ++ return protocol == cpu_to_be16(ETH_P_IP);
2321 ++ case VIRTIO_NET_HDR_GSO_TCPV6:
2322 ++ return protocol == cpu_to_be16(ETH_P_IPV6);
2323 ++ case VIRTIO_NET_HDR_GSO_UDP:
2324 ++ return protocol == cpu_to_be16(ETH_P_IP) ||
2325 ++ protocol == cpu_to_be16(ETH_P_IPV6);
2326 ++ default:
2327 ++ return false;
2328 ++ }
2329 ++}
2330 ++
2331 + static inline int virtio_net_hdr_set_proto(struct sk_buff *skb,
2332 + const struct virtio_net_hdr *hdr)
2333 + {
2334 ++ if (skb->protocol)
2335 ++ return 0;
2336 ++
2337 + switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
2338 + case VIRTIO_NET_HDR_GSO_TCPV4:
2339 + case VIRTIO_NET_HDR_GSO_UDP:
2340 +@@ -88,9 +106,12 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
2341 + if (!skb->protocol) {
2342 + __be16 protocol = dev_parse_header_protocol(skb);
2343 +
2344 +- virtio_net_hdr_set_proto(skb, hdr);
2345 +- if (protocol && protocol != skb->protocol)
2346 ++ if (!protocol)
2347 ++ virtio_net_hdr_set_proto(skb, hdr);
2348 ++ else if (!virtio_net_hdr_match_proto(protocol, hdr->gso_type))
2349 + return -EINVAL;
2350 ++ else
2351 ++ skb->protocol = protocol;
2352 + }
2353 + retry:
2354 + if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys,
2355 +diff --git a/mm/memory-failure.c b/mm/memory-failure.c
2356 +index 01445ddff58d8..aef267c6a7246 100644
2357 +--- a/mm/memory-failure.c
2358 ++++ b/mm/memory-failure.c
2359 +@@ -1938,6 +1938,7 @@ retry:
2360 + else if (ret == 0)
2361 + if (soft_offline_free_page(page) && try_again) {
2362 + try_again = false;
2363 ++ flags &= ~MF_COUNT_INCREASED;
2364 + goto retry;
2365 + }
2366 +
2367 +diff --git a/mm/mempolicy.c b/mm/mempolicy.c
2368 +index 3ca4898f3f249..c8b1592dff73d 100644
2369 +--- a/mm/mempolicy.c
2370 ++++ b/mm/mempolicy.c
2371 +@@ -2222,8 +2222,8 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
2372 + * memory with both reclaim and compact as well.
2373 + */
2374 + if (!page && (gfp & __GFP_DIRECT_RECLAIM))
2375 +- page = __alloc_pages_node(hpage_node,
2376 +- gfp, order);
2377 ++ page = __alloc_pages_nodemask(gfp, order,
2378 ++ hpage_node, nmask);
2379 +
2380 + goto out;
2381 + }
2382 +diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
2383 +index 269ee89d2c2be..22278807b3f36 100644
2384 +--- a/net/ax25/af_ax25.c
2385 ++++ b/net/ax25/af_ax25.c
2386 +@@ -85,8 +85,10 @@ static void ax25_kill_by_device(struct net_device *dev)
2387 + again:
2388 + ax25_for_each(s, &ax25_list) {
2389 + if (s->ax25_dev == ax25_dev) {
2390 +- s->ax25_dev = NULL;
2391 + spin_unlock_bh(&ax25_list_lock);
2392 ++ lock_sock(s->sk);
2393 ++ s->ax25_dev = NULL;
2394 ++ release_sock(s->sk);
2395 + ax25_disconnect(s, ENETUNREACH);
2396 + spin_lock_bh(&ax25_list_lock);
2397 +
2398 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
2399 +index e429dbb10df71..d46ed4cbe7717 100644
2400 +--- a/net/mac80211/cfg.c
2401 ++++ b/net/mac80211/cfg.c
2402 +@@ -1217,7 +1217,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
2403 + return 0;
2404 +
2405 + error:
2406 ++ mutex_lock(&local->mtx);
2407 + ieee80211_vif_release_channel(sdata);
2408 ++ mutex_unlock(&local->mtx);
2409 ++
2410 + return err;
2411 + }
2412 +
2413 +diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
2414 +index b35e8d9a5b37e..33c13edbca4bb 100644
2415 +--- a/net/netfilter/nfnetlink_log.c
2416 ++++ b/net/netfilter/nfnetlink_log.c
2417 +@@ -557,7 +557,8 @@ __build_packet_message(struct nfnl_log_net *log,
2418 + goto nla_put_failure;
2419 +
2420 + if (indev && skb->dev &&
2421 +- skb->mac_header != skb->network_header) {
2422 ++ skb_mac_header_was_set(skb) &&
2423 ++ skb_mac_header_len(skb) != 0) {
2424 + struct nfulnl_msg_packet_hw phw;
2425 + int len;
2426 +
2427 +diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
2428 +index 98994fe677fe9..b0358f30947ea 100644
2429 +--- a/net/netfilter/nfnetlink_queue.c
2430 ++++ b/net/netfilter/nfnetlink_queue.c
2431 +@@ -562,7 +562,8 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
2432 + goto nla_put_failure;
2433 +
2434 + if (indev && entskb->dev &&
2435 +- skb_mac_header_was_set(entskb)) {
2436 ++ skb_mac_header_was_set(entskb) &&
2437 ++ skb_mac_header_len(entskb) != 0) {
2438 + struct nfqnl_msg_packet_hw phw;
2439 + int len;
2440 +
2441 +diff --git a/net/phonet/pep.c b/net/phonet/pep.c
2442 +index a1525916885ae..72018e5e4d8ef 100644
2443 +--- a/net/phonet/pep.c
2444 ++++ b/net/phonet/pep.c
2445 +@@ -946,6 +946,8 @@ static int pep_ioctl(struct sock *sk, int cmd, unsigned long arg)
2446 + ret = -EBUSY;
2447 + else if (sk->sk_state == TCP_ESTABLISHED)
2448 + ret = -EISCONN;
2449 ++ else if (!pn->pn_sk.sobject)
2450 ++ ret = -EADDRNOTAVAIL;
2451 + else
2452 + ret = pep_sock_enable(sk, NULL, 0);
2453 + release_sock(sk);
2454 +diff --git a/sound/core/jack.c b/sound/core/jack.c
2455 +index 503c8af79d550..d6502dff247a8 100644
2456 +--- a/sound/core/jack.c
2457 ++++ b/sound/core/jack.c
2458 +@@ -220,6 +220,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
2459 + return -ENOMEM;
2460 +
2461 + jack->id = kstrdup(id, GFP_KERNEL);
2462 ++ if (jack->id == NULL) {
2463 ++ kfree(jack);
2464 ++ return -ENOMEM;
2465 ++ }
2466 +
2467 + /* don't creat input device for phantom jack */
2468 + if (!phantom_jack) {
2469 +diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c
2470 +index eb23c55323ae1..a2583a30c45ad 100644
2471 +--- a/sound/drivers/opl3/opl3_midi.c
2472 ++++ b/sound/drivers/opl3/opl3_midi.c
2473 +@@ -398,7 +398,7 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)
2474 + }
2475 + if (instr_4op) {
2476 + vp2 = &opl3->voices[voice + 3];
2477 +- if (vp->state > 0) {
2478 ++ if (vp2->state > 0) {
2479 + opl3_reg = reg_side | (OPL3_REG_KEYON_BLOCK +
2480 + voice_offset + 3);
2481 + reg_val = vp->keyon_reg & ~OPL3_KEYON_BIT;
2482 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2483 +index bed2a93001635..14ce48f1a8e47 100644
2484 +--- a/sound/pci/hda/patch_realtek.c
2485 ++++ b/sound/pci/hda/patch_realtek.c
2486 +@@ -6492,6 +6492,23 @@ static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
2487 + alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
2488 + }
2489 +
2490 ++static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
2491 ++ const struct hda_fixup *fix,
2492 ++ int action)
2493 ++{
2494 ++ /*
2495 ++ * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
2496 ++ * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
2497 ++ * needs an additional quirk for sound working after suspend and resume.
2498 ++ */
2499 ++ if (codec->core.vendor_id == 0x10ec0256) {
2500 ++ alc_update_coef_idx(codec, 0x10, 1<<9, 0);
2501 ++ snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
2502 ++ } else {
2503 ++ snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
2504 ++ }
2505 ++}
2506 ++
2507 + enum {
2508 + ALC269_FIXUP_GPIO2,
2509 + ALC269_FIXUP_SONY_VAIO,
2510 +@@ -6711,6 +6728,7 @@ enum {
2511 + ALC256_FIXUP_SET_COEF_DEFAULTS,
2512 + ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
2513 + ALC233_FIXUP_NO_AUDIO_JACK,
2514 ++ ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
2515 + };
2516 +
2517 + static const struct hda_fixup alc269_fixups[] = {
2518 +@@ -8429,6 +8447,12 @@ static const struct hda_fixup alc269_fixups[] = {
2519 + .type = HDA_FIXUP_FUNC,
2520 + .v.func = alc233_fixup_no_audio_jack,
2521 + },
2522 ++ [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
2523 ++ .type = HDA_FIXUP_FUNC,
2524 ++ .v.func = alc256_fixup_mic_no_presence_and_resume,
2525 ++ .chained = true,
2526 ++ .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
2527 ++ },
2528 + };
2529 +
2530 + static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2531 +@@ -8599,6 +8623,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2532 + SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
2533 + SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
2534 + SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
2535 ++ SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
2536 + SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
2537 + SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
2538 + SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
2539 +@@ -8766,7 +8791,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2540 + SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
2541 + SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2542 + SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2543 +- SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2544 ++ SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
2545 + SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2546 + SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2547 + SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2548 +@@ -9060,6 +9085,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
2549 + {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
2550 + {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
2551 + {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
2552 ++ {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
2553 + {}
2554 + };
2555 + #define ALC225_STANDARD_PINS \
2556 +diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
2557 +index 41827cdf26a39..aaef76cc151fa 100644
2558 +--- a/sound/soc/codecs/rt5682.c
2559 ++++ b/sound/soc/codecs/rt5682.c
2560 +@@ -924,6 +924,8 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
2561 + unsigned int val, count;
2562 +
2563 + if (jack_insert) {
2564 ++ snd_soc_dapm_mutex_lock(dapm);
2565 ++
2566 + snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1,
2567 + RT5682_PWR_VREF2 | RT5682_PWR_MB,
2568 + RT5682_PWR_VREF2 | RT5682_PWR_MB);
2569 +@@ -968,6 +970,8 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
2570 + snd_soc_component_update_bits(component, RT5682_MICBIAS_2,
2571 + RT5682_PWR_CLK25M_MASK | RT5682_PWR_CLK1M_MASK,
2572 + RT5682_PWR_CLK25M_PU | RT5682_PWR_CLK1M_PU);
2573 ++
2574 ++ snd_soc_dapm_mutex_unlock(dapm);
2575 + } else {
2576 + rt5682_enable_push_button_irq(component, false);
2577 + snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
2578 +diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c
2579 +index a91a0a31e74d1..61c3238bc2656 100644
2580 +--- a/sound/soc/codecs/tas2770.c
2581 ++++ b/sound/soc/codecs/tas2770.c
2582 +@@ -291,11 +291,11 @@ static int tas2770_set_samplerate(struct tas2770_priv *tas2770, int samplerate)
2583 + ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_44_1KHZ |
2584 + TAS2770_TDM_CFG_REG0_31_88_2_96KHZ;
2585 + break;
2586 +- case 19200:
2587 ++ case 192000:
2588 + ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_48KHZ |
2589 + TAS2770_TDM_CFG_REG0_31_176_4_192KHZ;
2590 + break;
2591 +- case 17640:
2592 ++ case 176400:
2593 + ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_44_1KHZ |
2594 + TAS2770_TDM_CFG_REG0_31_176_4_192KHZ;
2595 + break;
2596 +diff --git a/sound/soc/meson/aiu-encoder-i2s.c b/sound/soc/meson/aiu-encoder-i2s.c
2597 +index 9322245521463..67729de41a73e 100644
2598 +--- a/sound/soc/meson/aiu-encoder-i2s.c
2599 ++++ b/sound/soc/meson/aiu-encoder-i2s.c
2600 +@@ -18,7 +18,6 @@
2601 + #define AIU_RST_SOFT_I2S_FAST BIT(0)
2602 +
2603 + #define AIU_I2S_DAC_CFG_MSB_FIRST BIT(2)
2604 +-#define AIU_I2S_MISC_HOLD_EN BIT(2)
2605 + #define AIU_CLK_CTRL_I2S_DIV_EN BIT(0)
2606 + #define AIU_CLK_CTRL_I2S_DIV GENMASK(3, 2)
2607 + #define AIU_CLK_CTRL_AOCLK_INVERT BIT(6)
2608 +@@ -36,37 +35,6 @@ static void aiu_encoder_i2s_divider_enable(struct snd_soc_component *component,
2609 + enable ? AIU_CLK_CTRL_I2S_DIV_EN : 0);
2610 + }
2611 +
2612 +-static void aiu_encoder_i2s_hold(struct snd_soc_component *component,
2613 +- bool enable)
2614 +-{
2615 +- snd_soc_component_update_bits(component, AIU_I2S_MISC,
2616 +- AIU_I2S_MISC_HOLD_EN,
2617 +- enable ? AIU_I2S_MISC_HOLD_EN : 0);
2618 +-}
2619 +-
2620 +-static int aiu_encoder_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
2621 +- struct snd_soc_dai *dai)
2622 +-{
2623 +- struct snd_soc_component *component = dai->component;
2624 +-
2625 +- switch (cmd) {
2626 +- case SNDRV_PCM_TRIGGER_START:
2627 +- case SNDRV_PCM_TRIGGER_RESUME:
2628 +- case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
2629 +- aiu_encoder_i2s_hold(component, false);
2630 +- return 0;
2631 +-
2632 +- case SNDRV_PCM_TRIGGER_STOP:
2633 +- case SNDRV_PCM_TRIGGER_SUSPEND:
2634 +- case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
2635 +- aiu_encoder_i2s_hold(component, true);
2636 +- return 0;
2637 +-
2638 +- default:
2639 +- return -EINVAL;
2640 +- }
2641 +-}
2642 +-
2643 + static int aiu_encoder_i2s_setup_desc(struct snd_soc_component *component,
2644 + struct snd_pcm_hw_params *params)
2645 + {
2646 +@@ -353,7 +321,6 @@ static void aiu_encoder_i2s_shutdown(struct snd_pcm_substream *substream,
2647 + }
2648 +
2649 + const struct snd_soc_dai_ops aiu_encoder_i2s_dai_ops = {
2650 +- .trigger = aiu_encoder_i2s_trigger,
2651 + .hw_params = aiu_encoder_i2s_hw_params,
2652 + .hw_free = aiu_encoder_i2s_hw_free,
2653 + .set_fmt = aiu_encoder_i2s_set_fmt,
2654 +diff --git a/sound/soc/meson/aiu-fifo-i2s.c b/sound/soc/meson/aiu-fifo-i2s.c
2655 +index d91b0d874342f..2cbd127101d35 100644
2656 +--- a/sound/soc/meson/aiu-fifo-i2s.c
2657 ++++ b/sound/soc/meson/aiu-fifo-i2s.c
2658 +@@ -20,6 +20,8 @@
2659 + #define AIU_MEM_I2S_CONTROL_MODE_16BIT BIT(6)
2660 + #define AIU_MEM_I2S_BUF_CNTL_INIT BIT(0)
2661 + #define AIU_RST_SOFT_I2S_FAST BIT(0)
2662 ++#define AIU_I2S_MISC_HOLD_EN BIT(2)
2663 ++#define AIU_I2S_MISC_FORCE_LEFT_RIGHT BIT(4)
2664 +
2665 + #define AIU_FIFO_I2S_BLOCK 256
2666 +
2667 +@@ -90,6 +92,10 @@ static int aiu_fifo_i2s_hw_params(struct snd_pcm_substream *substream,
2668 + unsigned int val;
2669 + int ret;
2670 +
2671 ++ snd_soc_component_update_bits(component, AIU_I2S_MISC,
2672 ++ AIU_I2S_MISC_HOLD_EN,
2673 ++ AIU_I2S_MISC_HOLD_EN);
2674 ++
2675 + ret = aiu_fifo_hw_params(substream, params, dai);
2676 + if (ret)
2677 + return ret;
2678 +@@ -117,6 +123,19 @@ static int aiu_fifo_i2s_hw_params(struct snd_pcm_substream *substream,
2679 + snd_soc_component_update_bits(component, AIU_MEM_I2S_MASKS,
2680 + AIU_MEM_I2S_MASKS_IRQ_BLOCK, val);
2681 +
2682 ++ /*
2683 ++ * Most (all?) supported SoCs have this bit set by default. The vendor
2684 ++ * driver however sets it manually (depending on the version either
2685 ++ * while un-setting AIU_I2S_MISC_HOLD_EN or right before that). Follow
2686 ++ * the same approach for consistency with the vendor driver.
2687 ++ */
2688 ++ snd_soc_component_update_bits(component, AIU_I2S_MISC,
2689 ++ AIU_I2S_MISC_FORCE_LEFT_RIGHT,
2690 ++ AIU_I2S_MISC_FORCE_LEFT_RIGHT);
2691 ++
2692 ++ snd_soc_component_update_bits(component, AIU_I2S_MISC,
2693 ++ AIU_I2S_MISC_HOLD_EN, 0);
2694 ++
2695 + return 0;
2696 + }
2697 +
2698 +diff --git a/sound/soc/meson/aiu-fifo.c b/sound/soc/meson/aiu-fifo.c
2699 +index aa88aae8e517d..3efc3cad0b4ec 100644
2700 +--- a/sound/soc/meson/aiu-fifo.c
2701 ++++ b/sound/soc/meson/aiu-fifo.c
2702 +@@ -5,6 +5,7 @@
2703 +
2704 + #include <linux/bitfield.h>
2705 + #include <linux/clk.h>
2706 ++#include <linux/dma-mapping.h>
2707 + #include <sound/pcm_params.h>
2708 + #include <sound/soc.h>
2709 + #include <sound/soc-dai.h>
2710 +@@ -192,6 +193,11 @@ int aiu_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd,
2711 + struct snd_card *card = rtd->card->snd_card;
2712 + struct aiu_fifo *fifo = dai->playback_dma_data;
2713 + size_t size = fifo->pcm->buffer_bytes_max;
2714 ++ int ret;
2715 ++
2716 ++ ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
2717 ++ if (ret)
2718 ++ return ret;
2719 +
2720 + snd_pcm_lib_preallocate_pages(substream,
2721 + SNDRV_DMA_TYPE_DEV,