diff options
author | Mike Pagano <mpagano@gentoo.org> | 2021-12-29 08:06:24 -0500 |
---|---|---|
committer | Mike Pagano <mpagano@gentoo.org> | 2021-12-29 08:06:24 -0500 |
commit | bd0c2b6eb76e3e0c39aa3f953a7cd3546013b9d8 (patch) | |
tree | df9ac9fb62f0b8e4b91eed45d7fb3247fa99f720 | |
parent | Linux patch 5.10.88 (diff) | |
download | linux-patches-bd0c2b6e.tar.gz linux-patches-bd0c2b6e.tar.bz2 linux-patches-bd0c2b6e.zip |
Linux patch 5.10.895.10-96
Signed-off-by: Mike Pagano <mpagano@gentoo.org>
-rw-r--r-- | 0000_README | 4 | ||||
-rw-r--r-- | 1088_linux-5.10.89.patch | 2684 |
2 files changed, 2688 insertions, 0 deletions
diff --git a/0000_README b/0000_README index a6cd68ff..aa52e9d4 100644 --- a/0000_README +++ b/0000_README @@ -395,6 +395,10 @@ Patch: 1087_linux-5.10.88.patch From: http://www.kernel.org Desc: Linux 5.10.88 +Patch: 1088_linux-5.10.89.patch +From: http://www.kernel.org +Desc: Linux 5.10.89 + Patch: 1500_XATTR_USER_PREFIX.patch From: https://bugs.gentoo.org/show_bug.cgi?id=470644 Desc: Support for namespace user.pax.* on tmpfs. diff --git a/1088_linux-5.10.89.patch b/1088_linux-5.10.89.patch new file mode 100644 index 00000000..80aaf5db --- /dev/null +++ b/1088_linux-5.10.89.patch @@ -0,0 +1,2684 @@ +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt +index 516499f9ccae4..ccaa72562538e 100644 +--- a/Documentation/admin-guide/kernel-parameters.txt ++++ b/Documentation/admin-guide/kernel-parameters.txt +@@ -2294,8 +2294,12 @@ + Default is 1 (enabled) + + kvm-intel.emulate_invalid_guest_state= +- [KVM,Intel] Enable emulation of invalid guest states +- Default is 0 (disabled) ++ [KVM,Intel] Disable emulation of invalid guest state. ++ Ignored if kvm-intel.enable_unrestricted_guest=1, as ++ guest state is never invalid for unrestricted guests. ++ This param doesn't apply to nested guests (L2), as KVM ++ never emulates invalid L2 guest state. ++ Default is 1 (enabled) + + kvm-intel.flexpriority= + [KVM,Intel] Disable FlexPriority feature (TPR shadow). +diff --git a/Documentation/hwmon/lm90.rst b/Documentation/hwmon/lm90.rst +index 3da8c6e06a365..05391fb4042d9 100644 +--- a/Documentation/hwmon/lm90.rst ++++ b/Documentation/hwmon/lm90.rst +@@ -265,6 +265,16 @@ Supported chips: + + https://www.ti.com/litv/pdf/sbos686 + ++ * Texas Instruments TMP461 ++ ++ Prefix: 'tmp461' ++ ++ Addresses scanned: I2C 0x48 through 0x4F ++ ++ Datasheet: Publicly available at TI website ++ ++ https://www.ti.com/lit/gpn/tmp461 ++ + Author: Jean Delvare <jdelvare@suse.de> + + +diff --git a/Documentation/networking/bonding.rst b/Documentation/networking/bonding.rst +index adc314639085b..413dca513e1db 100644 +--- a/Documentation/networking/bonding.rst ++++ b/Documentation/networking/bonding.rst +@@ -196,11 +196,12 @@ ad_actor_sys_prio + ad_actor_system + + In an AD system, this specifies the mac-address for the actor in +- protocol packet exchanges (LACPDUs). The value cannot be NULL or +- multicast. It is preferred to have the local-admin bit set for this +- mac but driver does not enforce it. If the value is not given then +- system defaults to using the masters' mac address as actors' system +- address. ++ protocol packet exchanges (LACPDUs). The value cannot be a multicast ++ address. If the all-zeroes MAC is specified, bonding will internally ++ use the MAC of the bond itself. It is preferred to have the ++ local-admin bit set for this mac but driver does not enforce it. If ++ the value is not given then system defaults to using the masters' ++ mac address as actors' system address. + + This parameter has effect only in 802.3ad mode and is available through + SysFs interface. +diff --git a/Documentation/sound/hd-audio/models.rst b/Documentation/sound/hd-audio/models.rst +index 0ea967d345838..d25335993e553 100644 +--- a/Documentation/sound/hd-audio/models.rst ++++ b/Documentation/sound/hd-audio/models.rst +@@ -326,6 +326,8 @@ usi-headset + Headset support on USI machines + dual-codecs + Lenovo laptops with dual codecs ++alc285-hp-amp-init ++ HP laptops which require speaker amplifier initialization (ALC285) + + ALC680 + ====== +diff --git a/Makefile b/Makefile +index 0b74b414f4e57..1500ea340424d 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 10 +-SUBLEVEL = 88 ++SUBLEVEL = 89 + EXTRAVERSION = + NAME = Dare mighty things + +diff --git a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi +index c070893c509ee..5bad982bc5a05 100644 +--- a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi +@@ -289,6 +289,7 @@ + + ethphy: ethernet-phy@1 { + reg = <1>; ++ qca,clk-out-frequency = <125000000>; + }; + }; + }; +diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S +index 1c9e6d1452c5b..63fbcdc97ded9 100644 +--- a/arch/arm/kernel/entry-armv.S ++++ b/arch/arm/kernel/entry-armv.S +@@ -596,11 +596,9 @@ call_fpe: + tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2 + reteq lr + and r8, r0, #0x00000f00 @ mask out CP number +- THUMB( lsr r8, r8, #8 ) + mov r7, #1 +- add r6, r10, #TI_USED_CP +- ARM( strb r7, [r6, r8, lsr #8] ) @ set appropriate used_cp[] +- THUMB( strb r7, [r6, r8] ) @ set appropriate used_cp[] ++ add r6, r10, r8, lsr #8 @ add used_cp[] array offset first ++ strb r7, [r6, #TI_USED_CP] @ set appropriate used_cp[] + #ifdef CONFIG_IWMMXT + @ Test if we need to give access to iWMMXt coprocessors + ldr r5, [r10, #TI_FLAGS] +@@ -609,7 +607,7 @@ call_fpe: + bcs iwmmxt_task_enable + #endif + ARM( add pc, pc, r8, lsr #6 ) +- THUMB( lsl r8, r8, #2 ) ++ THUMB( lsr r8, r8, #6 ) + THUMB( add pc, r8 ) + nop + +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig +index 5e5cf3af63515..3da71fe56b922 100644 +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -1265,7 +1265,8 @@ config KUSER_HELPERS + + config COMPAT_VDSO + bool "Enable vDSO for 32-bit applications" +- depends on !CPU_BIG_ENDIAN && "$(CROSS_COMPILE_COMPAT)" != "" ++ depends on !CPU_BIG_ENDIAN ++ depends on (CC_IS_CLANG && LD_IS_LLD) || "$(CROSS_COMPILE_COMPAT)" != "" + select GENERIC_COMPAT_VDSO + default y + help +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 +index ef5ca64442203..de448ca51e216 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus.dts +@@ -69,7 +69,7 @@ + pinctrl-0 = <&emac_rgmii_pins>; + phy-supply = <®_gmac_3v3>; + phy-handle = <&ext_rgmii_phy>; +- phy-mode = "rgmii"; ++ phy-mode = "rgmii-id"; + status = "okay"; + }; + +diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile +index a463b9bceed41..abad38c576e1d 100644 +--- a/arch/arm64/kernel/vdso32/Makefile ++++ b/arch/arm64/kernel/vdso32/Makefile +@@ -10,26 +10,15 @@ include $(srctree)/lib/vdso/Makefile + + # Same as cc-*option, but using CC_COMPAT instead of CC + ifeq ($(CONFIG_CC_IS_CLANG), y) +-COMPAT_GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE_COMPAT)elfedit)) +-COMPAT_GCC_TOOLCHAIN := $(realpath $(COMPAT_GCC_TOOLCHAIN_DIR)/..) +- +-CC_COMPAT_CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%)) +-CC_COMPAT_CLANG_FLAGS += --prefix=$(COMPAT_GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE_COMPAT)) +-CC_COMPAT_CLANG_FLAGS += -no-integrated-as -Qunused-arguments +-ifneq ($(COMPAT_GCC_TOOLCHAIN),) +-CC_COMPAT_CLANG_FLAGS += --gcc-toolchain=$(COMPAT_GCC_TOOLCHAIN) +-endif +- + CC_COMPAT ?= $(CC) +-CC_COMPAT += $(CC_COMPAT_CLANG_FLAGS) +- +-ifneq ($(LLVM),) +-LD_COMPAT ?= $(LD) ++CC_COMPAT += --target=arm-linux-gnueabi + else +-LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)ld ++CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc + endif ++ ++ifeq ($(CONFIG_LD_IS_LLD), y) ++LD_COMPAT ?= $(LD) + else +-CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc + LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)ld + endif + +@@ -55,10 +44,6 @@ VDSO_CPPFLAGS += $(LINUXINCLUDE) + # Common C and assembly flags + # From top-level Makefile + VDSO_CAFLAGS := $(VDSO_CPPFLAGS) +-ifneq ($(shell $(CC_COMPAT) --version 2>&1 | head -n 1 | grep clang),) +-VDSO_CAFLAGS += --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%)) +-endif +- + VDSO_CAFLAGS += $(call cc32-option,-fno-PIE) + ifdef CONFIG_DEBUG_INFO + VDSO_CAFLAGS += -g +diff --git a/arch/parisc/include/asm/futex.h b/arch/parisc/include/asm/futex.h +index fceb9cf02fb3a..71aa0921d6c72 100644 +--- a/arch/parisc/include/asm/futex.h ++++ b/arch/parisc/include/asm/futex.h +@@ -16,7 +16,7 @@ static inline void + _futex_spin_lock_irqsave(u32 __user *uaddr, unsigned long int *flags) + { + extern u32 lws_lock_start[]; +- long index = ((long)uaddr & 0x3f8) >> 1; ++ long index = ((long)uaddr & 0x7f8) >> 1; + arch_spinlock_t *s = (arch_spinlock_t *)&lws_lock_start[index]; + local_irq_save(*flags); + arch_spin_lock(s); +@@ -26,7 +26,7 @@ static inline void + _futex_spin_unlock_irqrestore(u32 __user *uaddr, unsigned long int *flags) + { + extern u32 lws_lock_start[]; +- long index = ((long)uaddr & 0x3f8) >> 1; ++ long index = ((long)uaddr & 0x7f8) >> 1; + arch_spinlock_t *s = (arch_spinlock_t *)&lws_lock_start[index]; + arch_spin_unlock(s); + local_irq_restore(*flags); +diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S +index 322503780db61..4e53515cf81f1 100644 +--- a/arch/parisc/kernel/syscall.S ++++ b/arch/parisc/kernel/syscall.S +@@ -478,7 +478,7 @@ lws_start: + extrd,u %r1,PSW_W_BIT,1,%r1 + /* sp must be aligned on 4, so deposit the W bit setting into + * the bottom of sp temporarily */ +- or,ev %r1,%r30,%r30 ++ or,od %r1,%r30,%r30 + + /* Clip LWS number to a 32-bit value for 32-bit processes */ + depdi 0, 31, 32, %r20 +diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h +index a02c67291cfcb..87de9f2d71cf2 100644 +--- a/arch/x86/include/asm/pgtable.h ++++ b/arch/x86/include/asm/pgtable.h +@@ -1360,8 +1360,8 @@ static inline pmd_t pmd_swp_clear_uffd_wp(pmd_t pmd) + } + #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_WP */ + +-#define PKRU_AD_BIT 0x1 +-#define PKRU_WD_BIT 0x2 ++#define PKRU_AD_BIT 0x1u ++#define PKRU_WD_BIT 0x2u + #define PKRU_BITS_PER_PKEY 2 + + #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c +index 5b7664d51dc2b..38c453f28f1f0 100644 +--- a/arch/x86/kvm/vmx/vmx.c ++++ b/arch/x86/kvm/vmx/vmx.c +@@ -4007,8 +4007,7 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) + if (pi_test_and_set_on(&vmx->pi_desc)) + return 0; + +- if (vcpu != kvm_get_running_vcpu() && +- !kvm_vcpu_trigger_posted_interrupt(vcpu, false)) ++ if (!kvm_vcpu_trigger_posted_interrupt(vcpu, false)) + kvm_vcpu_kick(vcpu); + + return 0; +diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c +index 38b545bef05a3..8f147274f826a 100644 +--- a/drivers/char/ipmi/ipmi_msghandler.c ++++ b/drivers/char/ipmi/ipmi_msghandler.c +@@ -2945,7 +2945,7 @@ cleanup_bmc_device(struct kref *ref) + * with removing the device attributes while reading a device + * attribute. + */ +- schedule_work(&bmc->remove_work); ++ queue_work(remove_work_wq, &bmc->remove_work); + } + + /* +@@ -5161,22 +5161,27 @@ static int ipmi_init_msghandler(void) + if (initialized) + goto out; + +- init_srcu_struct(&ipmi_interfaces_srcu); +- +- timer_setup(&ipmi_timer, ipmi_timeout, 0); +- mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); +- +- atomic_notifier_chain_register(&panic_notifier_list, &panic_block); ++ rv = init_srcu_struct(&ipmi_interfaces_srcu); ++ if (rv) ++ goto out; + + remove_work_wq = create_singlethread_workqueue("ipmi-msghandler-remove-wq"); + if (!remove_work_wq) { + pr_err("unable to create ipmi-msghandler-remove-wq workqueue"); + rv = -ENOMEM; +- goto out; ++ goto out_wq; + } + ++ timer_setup(&ipmi_timer, ipmi_timeout, 0); ++ mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); ++ ++ atomic_notifier_chain_register(&panic_notifier_list, &panic_block); ++ + initialized = true; + ++out_wq: ++ if (rv) ++ cleanup_srcu_struct(&ipmi_interfaces_srcu); + out: + mutex_unlock(&ipmi_interfaces_mutex); + return rv; +diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c +index 0416b9c9d4105..3de679723648b 100644 +--- a/drivers/char/ipmi/ipmi_ssif.c ++++ b/drivers/char/ipmi/ipmi_ssif.c +@@ -1700,6 +1700,9 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) + } + } + ++ ssif_info->client = client; ++ i2c_set_clientdata(client, ssif_info); ++ + rv = ssif_check_and_remove(client, ssif_info); + /* If rv is 0 and addr source is not SI_ACPI, continue probing */ + if (!rv && ssif_info->addr_source == SI_ACPI) { +@@ -1720,9 +1723,6 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) + ipmi_addr_src_to_str(ssif_info->addr_source), + client->addr, client->adapter->name, slave_addr); + +- ssif_info->client = client; +- i2c_set_clientdata(client, ssif_info); +- + /* Now check for system interface capabilities */ + msg[0] = IPMI_NETFN_APP_REQUEST << 2; + msg[1] = IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_CMD; +@@ -1922,6 +1922,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) + + dev_err(&ssif_info->client->dev, + "Unable to start IPMI SSIF: %d\n", rv); ++ i2c_set_clientdata(client, NULL); + kfree(ssif_info); + } + kfree(resp); +diff --git a/drivers/gpio/gpio-dln2.c b/drivers/gpio/gpio-dln2.c +index 4c5f6d0c8d745..22f11dd5210db 100644 +--- a/drivers/gpio/gpio-dln2.c ++++ b/drivers/gpio/gpio-dln2.c +@@ -46,6 +46,7 @@ + struct dln2_gpio { + struct platform_device *pdev; + struct gpio_chip gpio; ++ struct irq_chip irqchip; + + /* + * Cache pin direction to save us one transfer, since the hardware has +@@ -383,15 +384,6 @@ static void dln2_irq_bus_unlock(struct irq_data *irqd) + mutex_unlock(&dln2->irq_lock); + } + +-static struct irq_chip dln2_gpio_irqchip = { +- .name = "dln2-irq", +- .irq_mask = dln2_irq_mask, +- .irq_unmask = dln2_irq_unmask, +- .irq_set_type = dln2_irq_set_type, +- .irq_bus_lock = dln2_irq_bus_lock, +- .irq_bus_sync_unlock = dln2_irq_bus_unlock, +-}; +- + static void dln2_gpio_event(struct platform_device *pdev, u16 echo, + const void *data, int len) + { +@@ -477,8 +469,15 @@ static int dln2_gpio_probe(struct platform_device *pdev) + dln2->gpio.direction_output = dln2_gpio_direction_output; + dln2->gpio.set_config = dln2_gpio_set_config; + ++ dln2->irqchip.name = "dln2-irq", ++ dln2->irqchip.irq_mask = dln2_irq_mask, ++ dln2->irqchip.irq_unmask = dln2_irq_unmask, ++ dln2->irqchip.irq_set_type = dln2_irq_set_type, ++ dln2->irqchip.irq_bus_lock = dln2_irq_bus_lock, ++ dln2->irqchip.irq_bus_sync_unlock = dln2_irq_bus_unlock, ++ + girq = &dln2->gpio.irq; +- girq->chip = &dln2_gpio_irqchip; ++ girq->chip = &dln2->irqchip; + /* The event comes from the outside so no parent handler */ + girq->parent_handler = NULL; + girq->num_parents = 0; +diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c +index b7172c48ef9f0..7c907939bfae1 100644 +--- a/drivers/hid/hid-holtek-mouse.c ++++ b/drivers/hid/hid-holtek-mouse.c +@@ -65,8 +65,23 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, + static int holtek_mouse_probe(struct hid_device *hdev, + const struct hid_device_id *id) + { ++ int ret; ++ + if (!hid_is_usb(hdev)) + return -EINVAL; ++ ++ ret = hid_parse(hdev); ++ if (ret) { ++ hid_err(hdev, "hid parse failed: %d\n", ret); ++ return ret; ++ } ++ ++ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); ++ if (ret) { ++ hid_err(hdev, "hw start failed: %d\n", ret); ++ return ret; ++ } ++ + return 0; + } + +diff --git a/drivers/hid/hid-vivaldi.c b/drivers/hid/hid-vivaldi.c +index cd7ada48b1d9f..72957a9f71170 100644 +--- a/drivers/hid/hid-vivaldi.c ++++ b/drivers/hid/hid-vivaldi.c +@@ -57,6 +57,9 @@ static int vivaldi_probe(struct hid_device *hdev, + int ret; + + drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); ++ if (!drvdata) ++ return -ENOMEM; ++ + hid_set_drvdata(hdev, drvdata); + + ret = hid_parse(hdev); +diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig +index a850e4f0e0bde..0c2b032ee6176 100644 +--- a/drivers/hwmon/Kconfig ++++ b/drivers/hwmon/Kconfig +@@ -1275,7 +1275,7 @@ config SENSORS_LM90 + Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6654, MAX6657, MAX6658, + MAX6659, MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, + ON Semiconductor NCT1008, Winbond/Nuvoton W83L771W/G/AWG/ASG, +- Philips SA56004, GMT G781, and Texas Instruments TMP451 ++ Philips SA56004, GMT G781, Texas Instruments TMP451 and TMP461 + sensor chips. + + This driver can also be built as a module. If so, the module +diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c +index ebbfd5f352c06..959446b0137bc 100644 +--- a/drivers/hwmon/lm90.c ++++ b/drivers/hwmon/lm90.c +@@ -35,13 +35,14 @@ + * explicitly as max6659, or if its address is not 0x4c. + * These chips lack the remote temperature offset feature. + * +- * This driver also supports the MAX6654 chip made by Maxim. This chip can +- * be at 9 different addresses, similar to MAX6680/MAX6681. The MAX6654 is +- * otherwise similar to MAX6657/MAX6658/MAX6659. Extended range is available +- * by setting the configuration register accordingly, and is done during +- * initialization. Extended precision is only available at conversion rates +- * of 1 Hz and slower. Note that extended precision is not enabled by +- * default, as this driver initializes all chips to 2 Hz by design. ++ * This driver also supports the MAX6654 chip made by Maxim. This chip can be ++ * at 9 different addresses, similar to MAX6680/MAX6681. The MAX6654 is similar ++ * to MAX6657/MAX6658/MAX6659, but does not support critical temperature ++ * limits. Extended range is available by setting the configuration register ++ * accordingly, and is done during initialization. Extended precision is only ++ * available at conversion rates of 1 Hz and slower. Note that extended ++ * precision is not enabled by default, as this driver initializes all chips ++ * to 2 Hz by design. + * + * This driver also supports the MAX6646, MAX6647, MAX6648, MAX6649 and + * MAX6692 chips made by Maxim. These are again similar to the LM86, +@@ -69,10 +70,10 @@ + * This driver also supports the G781 from GMT. This device is compatible + * with the ADM1032. + * +- * This driver also supports TMP451 from Texas Instruments. This device is +- * supported in both compatibility and extended mode. It's mostly compatible +- * with ADT7461 except for local temperature low byte register and max +- * conversion rate. ++ * This driver also supports TMP451 and TMP461 from Texas Instruments. ++ * Those devices are supported in both compatibility and extended mode. ++ * They are mostly compatible with ADT7461 except for local temperature ++ * low byte register and max conversion rate. + * + * Since the LM90 was the first chipset supported by this driver, most + * comments will refer to this chipset, but are actually general and +@@ -112,7 +113,7 @@ static const unsigned short normal_i2c[] = { + 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; + + enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680, +- max6646, w83l771, max6696, sa56004, g781, tmp451, max6654 }; ++ max6646, w83l771, max6696, sa56004, g781, tmp451, tmp461, max6654 }; + + /* + * The LM90 registers +@@ -168,8 +169,12 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680, + + #define LM90_MAX_CONVRATE_MS 16000 /* Maximum conversion rate in ms */ + +-/* TMP451 registers */ ++/* TMP451/TMP461 registers */ + #define TMP451_REG_R_LOCAL_TEMPL 0x15 ++#define TMP451_REG_CONALERT 0x22 ++ ++#define TMP461_REG_CHEN 0x16 ++#define TMP461_REG_DFC 0x24 + + /* + * Device flags +@@ -182,7 +187,10 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680, + #define LM90_HAVE_EMERGENCY_ALARM (1 << 5)/* emergency alarm */ + #define LM90_HAVE_TEMP3 (1 << 6) /* 3rd temperature sensor */ + #define LM90_HAVE_BROKEN_ALERT (1 << 7) /* Broken alert */ +-#define LM90_PAUSE_FOR_CONFIG (1 << 8) /* Pause conversion for config */ ++#define LM90_HAVE_EXTENDED_TEMP (1 << 8) /* extended temperature support*/ ++#define LM90_PAUSE_FOR_CONFIG (1 << 9) /* Pause conversion for config */ ++#define LM90_HAVE_CRIT (1 << 10)/* Chip supports CRIT/OVERT register */ ++#define LM90_HAVE_CRIT_ALRM_SWP (1 << 11)/* critical alarm bits swapped */ + + /* LM90 status */ + #define LM90_STATUS_LTHRM (1 << 0) /* local THERM limit tripped */ +@@ -192,6 +200,7 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680, + #define LM90_STATUS_RHIGH (1 << 4) /* remote high temp limit tripped */ + #define LM90_STATUS_LLOW (1 << 5) /* local low temp limit tripped */ + #define LM90_STATUS_LHIGH (1 << 6) /* local high temp limit tripped */ ++#define LM90_STATUS_BUSY (1 << 7) /* conversion is ongoing */ + + #define MAX6696_STATUS2_R2THRM (1 << 1) /* remote2 THERM limit tripped */ + #define MAX6696_STATUS2_R2OPEN (1 << 2) /* remote2 is an open circuit */ +@@ -229,6 +238,7 @@ static const struct i2c_device_id lm90_id[] = { + { "w83l771", w83l771 }, + { "sa56004", sa56004 }, + { "tmp451", tmp451 }, ++ { "tmp461", tmp461 }, + { } + }; + MODULE_DEVICE_TABLE(i2c, lm90_id); +@@ -326,6 +336,10 @@ static const struct of_device_id __maybe_unused lm90_of_match[] = { + .compatible = "ti,tmp451", + .data = (void *)tmp451 + }, ++ { ++ .compatible = "ti,tmp461", ++ .data = (void *)tmp461 ++ }, + { }, + }; + MODULE_DEVICE_TABLE(of, lm90_of_match); +@@ -344,38 +358,43 @@ struct lm90_params { + static const struct lm90_params lm90_params[] = { + [adm1032] = { + .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT +- | LM90_HAVE_BROKEN_ALERT, ++ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT, + .alert_alarms = 0x7c, + .max_convrate = 10, + }, + [adt7461] = { + .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT +- | LM90_HAVE_BROKEN_ALERT, ++ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP ++ | LM90_HAVE_CRIT, + .alert_alarms = 0x7c, + .max_convrate = 10, + }, + [g781] = { + .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT +- | LM90_HAVE_BROKEN_ALERT, ++ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT, + .alert_alarms = 0x7c, + .max_convrate = 8, + }, + [lm86] = { +- .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT, ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT ++ | LM90_HAVE_CRIT, + .alert_alarms = 0x7b, + .max_convrate = 9, + }, + [lm90] = { +- .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT, ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT ++ | LM90_HAVE_CRIT, + .alert_alarms = 0x7b, + .max_convrate = 9, + }, + [lm99] = { +- .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT, ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT ++ | LM90_HAVE_CRIT, + .alert_alarms = 0x7b, + .max_convrate = 9, + }, + [max6646] = { ++ .flags = LM90_HAVE_CRIT, + .alert_alarms = 0x7c, + .max_convrate = 6, + .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, +@@ -386,43 +405,51 @@ static const struct lm90_params lm90_params[] = { + .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, + }, + [max6657] = { +- .flags = LM90_PAUSE_FOR_CONFIG, ++ .flags = LM90_PAUSE_FOR_CONFIG | LM90_HAVE_CRIT, + .alert_alarms = 0x7c, + .max_convrate = 8, + .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, + }, + [max6659] = { +- .flags = LM90_HAVE_EMERGENCY, ++ .flags = LM90_HAVE_EMERGENCY | LM90_HAVE_CRIT, + .alert_alarms = 0x7c, + .max_convrate = 8, + .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, + }, + [max6680] = { +- .flags = LM90_HAVE_OFFSET, ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_CRIT ++ | LM90_HAVE_CRIT_ALRM_SWP, + .alert_alarms = 0x7c, + .max_convrate = 7, + }, + [max6696] = { + .flags = LM90_HAVE_EMERGENCY +- | LM90_HAVE_EMERGENCY_ALARM | LM90_HAVE_TEMP3, ++ | LM90_HAVE_EMERGENCY_ALARM | LM90_HAVE_TEMP3 | LM90_HAVE_CRIT, + .alert_alarms = 0x1c7c, + .max_convrate = 6, + .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, + }, + [w83l771] = { +- .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT, ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT | LM90_HAVE_CRIT, + .alert_alarms = 0x7c, + .max_convrate = 8, + }, + [sa56004] = { +- .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT, ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT | LM90_HAVE_CRIT, + .alert_alarms = 0x7b, + .max_convrate = 9, + .reg_local_ext = SA56004_REG_R_LOCAL_TEMPL, + }, + [tmp451] = { + .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT +- | LM90_HAVE_BROKEN_ALERT, ++ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP | LM90_HAVE_CRIT, ++ .alert_alarms = 0x7c, ++ .max_convrate = 9, ++ .reg_local_ext = TMP451_REG_R_LOCAL_TEMPL, ++ }, ++ [tmp461] = { ++ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT ++ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP | LM90_HAVE_CRIT, + .alert_alarms = 0x7c, + .max_convrate = 9, + .reg_local_ext = TMP451_REG_R_LOCAL_TEMPL, +@@ -650,20 +677,22 @@ static int lm90_update_limits(struct device *dev) + struct i2c_client *client = data->client; + int val; + +- val = lm90_read_reg(client, LM90_REG_R_LOCAL_CRIT); +- if (val < 0) +- return val; +- data->temp8[LOCAL_CRIT] = val; ++ if (data->flags & LM90_HAVE_CRIT) { ++ val = lm90_read_reg(client, LM90_REG_R_LOCAL_CRIT); ++ if (val < 0) ++ return val; ++ data->temp8[LOCAL_CRIT] = val; + +- val = lm90_read_reg(client, LM90_REG_R_REMOTE_CRIT); +- if (val < 0) +- return val; +- data->temp8[REMOTE_CRIT] = val; ++ val = lm90_read_reg(client, LM90_REG_R_REMOTE_CRIT); ++ if (val < 0) ++ return val; ++ data->temp8[REMOTE_CRIT] = val; + +- val = lm90_read_reg(client, LM90_REG_R_TCRIT_HYST); +- if (val < 0) +- return val; +- data->temp_hyst = val; ++ val = lm90_read_reg(client, LM90_REG_R_TCRIT_HYST); ++ if (val < 0) ++ return val; ++ data->temp_hyst = val; ++ } + + val = lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH); + if (val < 0) +@@ -791,7 +820,7 @@ static int lm90_update_device(struct device *dev) + val = lm90_read_reg(client, LM90_REG_R_STATUS); + if (val < 0) + return val; +- data->alarms = val; /* lower 8 bit of alarms */ ++ data->alarms = val & ~LM90_STATUS_BUSY; + + if (data->kind == max6696) { + val = lm90_select_remote_channel(data, 1); +@@ -997,7 +1026,7 @@ static int lm90_get_temp11(struct lm90_data *data, int index) + s16 temp11 = data->temp11[index]; + int temp; + +- if (data->kind == adt7461 || data->kind == tmp451) ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP) + temp = temp_from_u16_adt7461(data, temp11); + else if (data->kind == max6646) + temp = temp_from_u16(temp11); +@@ -1031,7 +1060,7 @@ static int lm90_set_temp11(struct lm90_data *data, int index, long val) + if (data->kind == lm99 && index <= 2) + val -= 16000; + +- if (data->kind == adt7461 || data->kind == tmp451) ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP) + data->temp11[index] = temp_to_u16_adt7461(data, val); + else if (data->kind == max6646) + data->temp11[index] = temp_to_u8(val) << 8; +@@ -1058,7 +1087,7 @@ static int lm90_get_temp8(struct lm90_data *data, int index) + s8 temp8 = data->temp8[index]; + int temp; + +- if (data->kind == adt7461 || data->kind == tmp451) ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP) + temp = temp_from_u8_adt7461(data, temp8); + else if (data->kind == max6646) + temp = temp_from_u8(temp8); +@@ -1091,7 +1120,7 @@ static int lm90_set_temp8(struct lm90_data *data, int index, long val) + if (data->kind == lm99 && index == 3) + val -= 16000; + +- if (data->kind == adt7461 || data->kind == tmp451) ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP) + data->temp8[index] = temp_to_u8_adt7461(data, val); + else if (data->kind == max6646) + data->temp8[index] = temp_to_u8(val); +@@ -1109,7 +1138,7 @@ static int lm90_get_temphyst(struct lm90_data *data, int index) + { + int temp; + +- if (data->kind == adt7461 || data->kind == tmp451) ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP) + temp = temp_from_u8_adt7461(data, data->temp8[index]); + else if (data->kind == max6646) + temp = temp_from_u8(data->temp8[index]); +@@ -1129,7 +1158,7 @@ static int lm90_set_temphyst(struct lm90_data *data, long val) + int temp; + int err; + +- if (data->kind == adt7461 || data->kind == tmp451) ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP) + temp = temp_from_u8_adt7461(data, data->temp8[LOCAL_CRIT]); + else if (data->kind == max6646) + temp = temp_from_u8(data->temp8[LOCAL_CRIT]); +@@ -1165,6 +1194,7 @@ static const u8 lm90_temp_emerg_index[3] = { + static const u8 lm90_min_alarm_bits[3] = { 5, 3, 11 }; + static const u8 lm90_max_alarm_bits[3] = { 6, 4, 12 }; + static const u8 lm90_crit_alarm_bits[3] = { 0, 1, 9 }; ++static const u8 lm90_crit_alarm_bits_swapped[3] = { 1, 0, 9 }; + static const u8 lm90_emergency_alarm_bits[3] = { 15, 13, 14 }; + static const u8 lm90_fault_bits[3] = { 0, 2, 10 }; + +@@ -1190,7 +1220,10 @@ static int lm90_temp_read(struct device *dev, u32 attr, int channel, long *val) + *val = (data->alarms >> lm90_max_alarm_bits[channel]) & 1; + break; + case hwmon_temp_crit_alarm: +- *val = (data->alarms >> lm90_crit_alarm_bits[channel]) & 1; ++ if (data->flags & LM90_HAVE_CRIT_ALRM_SWP) ++ *val = (data->alarms >> lm90_crit_alarm_bits_swapped[channel]) & 1; ++ else ++ *val = (data->alarms >> lm90_crit_alarm_bits[channel]) & 1; + break; + case hwmon_temp_emergency_alarm: + *val = (data->alarms >> lm90_emergency_alarm_bits[channel]) & 1; +@@ -1438,12 +1471,11 @@ static int lm90_detect(struct i2c_client *client, + if (man_id < 0 || chip_id < 0 || config1 < 0 || convrate < 0) + return -ENODEV; + +- if (man_id == 0x01 || man_id == 0x5C || man_id == 0x41) { ++ if (man_id == 0x01 || man_id == 0x5C || man_id == 0xA1) { + config2 = i2c_smbus_read_byte_data(client, LM90_REG_R_CONFIG2); + if (config2 < 0) + return -ENODEV; +- } else +- config2 = 0; /* Make compiler happy */ ++ } + + if ((address == 0x4C || address == 0x4D) + && man_id == 0x01) { /* National Semiconductor */ +@@ -1617,18 +1649,26 @@ static int lm90_detect(struct i2c_client *client, + && convrate <= 0x08) + name = "g781"; + } else +- if (address == 0x4C +- && man_id == 0x55) { /* Texas Instruments */ +- int local_ext; ++ if (man_id == 0x55 && chip_id == 0x00 && ++ (config1 & 0x1B) == 0x00 && convrate <= 0x09) { ++ int local_ext, conalert, chen, dfc; + + local_ext = i2c_smbus_read_byte_data(client, + TMP451_REG_R_LOCAL_TEMPL); +- +- if (chip_id == 0x00 /* TMP451 */ +- && (config1 & 0x1B) == 0x00 +- && convrate <= 0x09 +- && (local_ext & 0x0F) == 0x00) +- name = "tmp451"; ++ conalert = i2c_smbus_read_byte_data(client, ++ TMP451_REG_CONALERT); ++ chen = i2c_smbus_read_byte_data(client, TMP461_REG_CHEN); ++ dfc = i2c_smbus_read_byte_data(client, TMP461_REG_DFC); ++ ++ if ((local_ext & 0x0F) == 0x00 && ++ (conalert & 0xf1) == 0x01 && ++ (chen & 0xfc) == 0x00 && ++ (dfc & 0xfc) == 0x00) { ++ if (address == 0x4c && !(chen & 0x03)) ++ name = "tmp451"; ++ else if (address >= 0x48 && address <= 0x4f) ++ name = "tmp461"; ++ } + } + + if (!name) { /* identification failed */ +@@ -1675,7 +1715,7 @@ static int lm90_init_client(struct i2c_client *client, struct lm90_data *data) + lm90_set_convrate(client, data, 500); /* 500ms; 2Hz conversion rate */ + + /* Check Temperature Range Select */ +- if (data->kind == adt7461 || data->kind == tmp451) { ++ if (data->flags & LM90_HAVE_EXTENDED_TEMP) { + if (config & 0x04) + data->flags |= LM90_FLAG_ADT7461_EXT; + } +@@ -1842,11 +1882,14 @@ static int lm90_probe(struct i2c_client *client) + info->config = data->channel_config; + + data->channel_config[0] = HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX | +- HWMON_T_CRIT | HWMON_T_CRIT_HYST | HWMON_T_MIN_ALARM | +- HWMON_T_MAX_ALARM | HWMON_T_CRIT_ALARM; ++ HWMON_T_MIN_ALARM | HWMON_T_MAX_ALARM; + data->channel_config[1] = HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX | +- HWMON_T_CRIT | HWMON_T_CRIT_HYST | HWMON_T_MIN_ALARM | +- HWMON_T_MAX_ALARM | HWMON_T_CRIT_ALARM | HWMON_T_FAULT; ++ HWMON_T_MIN_ALARM | HWMON_T_MAX_ALARM | HWMON_T_FAULT; ++ ++ if (data->flags & LM90_HAVE_CRIT) { ++ data->channel_config[0] |= HWMON_T_CRIT | HWMON_T_CRIT_ALARM | HWMON_T_CRIT_HYST; ++ data->channel_config[1] |= HWMON_T_CRIT | HWMON_T_CRIT_ALARM | HWMON_T_CRIT_HYST; ++ } + + if (data->flags & LM90_HAVE_OFFSET) + data->channel_config[1] |= HWMON_T_OFFSET; +diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c +index f27523e1a12d7..08df97e0a6654 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_srq.c ++++ b/drivers/infiniband/hw/hns/hns_roce_srq.c +@@ -277,7 +277,7 @@ static int alloc_srq_wrid(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq) + + static void free_srq_wrid(struct hns_roce_srq *srq) + { +- kfree(srq->wrid); ++ kvfree(srq->wrid); + srq->wrid = NULL; + } + +diff --git a/drivers/infiniband/hw/qib/qib_user_sdma.c b/drivers/infiniband/hw/qib/qib_user_sdma.c +index ac11943a5ddb0..bf2f30d67949d 100644 +--- a/drivers/infiniband/hw/qib/qib_user_sdma.c ++++ b/drivers/infiniband/hw/qib/qib_user_sdma.c +@@ -941,7 +941,7 @@ static int qib_user_sdma_queue_pkts(const struct qib_devdata *dd, + &addrlimit) || + addrlimit > type_max(typeof(pkt->addrlimit))) { + ret = -EINVAL; +- goto free_pbc; ++ goto free_pkt; + } + pkt->addrlimit = addrlimit; + +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c +index 4357d30c15c56..2e53ea261e014 100644 +--- a/drivers/input/mouse/elantech.c ++++ b/drivers/input/mouse/elantech.c +@@ -1588,7 +1588,13 @@ static const struct dmi_system_id no_hw_res_dmi_table[] = { + */ + static int elantech_change_report_id(struct psmouse *psmouse) + { +- unsigned char param[2] = { 0x10, 0x03 }; ++ /* ++ * NOTE: the code is expecting to receive param[] as an array of 3 ++ * items (see __ps2_command()), even if in this case only 2 are ++ * actually needed. Make sure the array size is 3 to avoid potential ++ * stack out-of-bound accesses. ++ */ ++ unsigned char param[3] = { 0x10, 0x03 }; + + if (elantech_write_reg_params(psmouse, 0x7, param) || + elantech_read_reg_params(psmouse, 0x7, param) || +diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c +index b6f75367a284a..8df402a1ed446 100644 +--- a/drivers/input/touchscreen/atmel_mxt_ts.c ++++ b/drivers/input/touchscreen/atmel_mxt_ts.c +@@ -1839,7 +1839,7 @@ static int mxt_read_info_block(struct mxt_data *data) + if (error) { + dev_err(&client->dev, "Error %d parsing object table\n", error); + mxt_free_object_table(data); +- goto err_free_mem; ++ return error; + } + + data->object_table = (struct mxt_object *)(id_buf + MXT_OBJECT_START); +diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c +index 03a4825359448..c09aefa2661dd 100644 +--- a/drivers/input/touchscreen/elants_i2c.c ++++ b/drivers/input/touchscreen/elants_i2c.c +@@ -109,6 +109,19 @@ + #define ELAN_POWERON_DELAY_USEC 500 + #define ELAN_RESET_DELAY_MSEC 20 + ++/* FW boot code version */ ++#define BC_VER_H_BYTE_FOR_EKTH3900x1_I2C 0x72 ++#define BC_VER_H_BYTE_FOR_EKTH3900x2_I2C 0x82 ++#define BC_VER_H_BYTE_FOR_EKTH3900x3_I2C 0x92 ++#define BC_VER_H_BYTE_FOR_EKTH5312x1_I2C 0x6D ++#define BC_VER_H_BYTE_FOR_EKTH5312x2_I2C 0x6E ++#define BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C 0x77 ++#define BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C 0x78 ++#define BC_VER_H_BYTE_FOR_EKTH5312x1_I2C_USB 0x67 ++#define BC_VER_H_BYTE_FOR_EKTH5312x2_I2C_USB 0x68 ++#define BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C_USB 0x74 ++#define BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C_USB 0x75 ++ + enum elants_state { + ELAN_STATE_NORMAL, + ELAN_WAIT_QUEUE_HEADER, +@@ -663,6 +676,37 @@ static int elants_i2c_validate_remark_id(struct elants_data *ts, + return 0; + } + ++static bool elants_i2c_should_check_remark_id(struct elants_data *ts) ++{ ++ struct i2c_client *client = ts->client; ++ const u8 bootcode_version = ts->iap_version; ++ bool check; ++ ++ /* I2C eKTH3900 and eKTH5312 are NOT support Remark ID */ ++ if ((bootcode_version == BC_VER_H_BYTE_FOR_EKTH3900x1_I2C) || ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH3900x2_I2C) || ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH3900x3_I2C) || ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x1_I2C) || ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x2_I2C) || ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C) || ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C) || ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x1_I2C_USB) || ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312x2_I2C_USB) || ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx1_I2C_USB) || ++ (bootcode_version == BC_VER_H_BYTE_FOR_EKTH5312cx2_I2C_USB)) { ++ dev_dbg(&client->dev, ++ "eKTH3900/eKTH5312(0x%02x) are not support remark id\n", ++ bootcode_version); ++ check = false; ++ } else if (bootcode_version >= 0x60) { ++ check = true; ++ } else { ++ check = false; ++ } ++ ++ return check; ++} ++ + static int elants_i2c_do_update_firmware(struct i2c_client *client, + const struct firmware *fw, + bool force) +@@ -676,7 +720,7 @@ static int elants_i2c_do_update_firmware(struct i2c_client *client, + u16 send_id; + int page, n_fw_pages; + int error; +- bool check_remark_id = ts->iap_version >= 0x60; ++ bool check_remark_id = elants_i2c_should_check_remark_id(ts); + + /* Recovery mode detection! */ + if (force) { +diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c +index a06385c55af2a..5fc789f717c8a 100644 +--- a/drivers/input/touchscreen/goodix.c ++++ b/drivers/input/touchscreen/goodix.c +@@ -162,6 +162,7 @@ static const struct goodix_chip_id goodix_chip_ids[] = { + { .id = "911", .data = >911_chip_data }, + { .id = "9271", .data = >911_chip_data }, + { .id = "9110", .data = >911_chip_data }, ++ { .id = "9111", .data = >911_chip_data }, + { .id = "927", .data = >911_chip_data }, + { .id = "928", .data = >911_chip_data }, + +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index b5f3f160c8420..eb82f6aac951f 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -2327,7 +2327,7 @@ void mmc_start_host(struct mmc_host *host) + _mmc_detect_change(host, 0, false); + } + +-void mmc_stop_host(struct mmc_host *host) ++void __mmc_stop_host(struct mmc_host *host) + { + if (host->slot.cd_irq >= 0) { + mmc_gpio_set_cd_wake(host, false); +@@ -2336,6 +2336,11 @@ void mmc_stop_host(struct mmc_host *host) + + host->rescan_disable = 1; + cancel_delayed_work_sync(&host->detect); ++} ++ ++void mmc_stop_host(struct mmc_host *host) ++{ ++ __mmc_stop_host(host); + + /* clear pm flags now and let card drivers set them as needed */ + host->pm_flags = 0; +diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h +index db3c9c68875d8..a6c814fdbf0a9 100644 +--- a/drivers/mmc/core/core.h ++++ b/drivers/mmc/core/core.h +@@ -69,6 +69,7 @@ static inline void mmc_delay(unsigned int ms) + + void mmc_rescan(struct work_struct *work); + void mmc_start_host(struct mmc_host *host); ++void __mmc_stop_host(struct mmc_host *host); + void mmc_stop_host(struct mmc_host *host); + + void _mmc_detect_change(struct mmc_host *host, unsigned long delay, +diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c +index 58112999a69ab..864c8c205ff78 100644 +--- a/drivers/mmc/core/host.c ++++ b/drivers/mmc/core/host.c +@@ -79,9 +79,18 @@ static void mmc_host_classdev_release(struct device *dev) + kfree(host); + } + ++static int mmc_host_classdev_shutdown(struct device *dev) ++{ ++ struct mmc_host *host = cls_dev_to_mmc_host(dev); ++ ++ __mmc_stop_host(host); ++ return 0; ++} ++ + static struct class mmc_host_class = { + .name = "mmc_host", + .dev_release = mmc_host_classdev_release, ++ .shutdown_pre = mmc_host_classdev_shutdown, + .pm = MMC_HOST_CLASS_DEV_PM_OPS, + }; + +diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c +index 7cd9c0ec2fcfe..8fdd0bbbfa21f 100644 +--- a/drivers/mmc/host/meson-mx-sdhc-mmc.c ++++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c +@@ -135,6 +135,7 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc, + struct mmc_command *cmd) + { + struct meson_mx_sdhc_host *host = mmc_priv(mmc); ++ bool manual_stop = false; + u32 ictl, send; + int pack_len; + +@@ -172,12 +173,27 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc, + else + /* software flush: */ + ictl |= MESON_SDHC_ICTL_DATA_XFER_OK; ++ ++ /* ++ * Mimic the logic from the vendor driver where (only) ++ * SD_IO_RW_EXTENDED commands with more than one block set the ++ * MESON_SDHC_MISC_MANUAL_STOP bit. This fixes the firmware ++ * download in the brcmfmac driver for a BCM43362/1 card. ++ * Without this sdio_memcpy_toio() (with a size of 219557 ++ * bytes) times out if MESON_SDHC_MISC_MANUAL_STOP is not set. ++ */ ++ manual_stop = cmd->data->blocks > 1 && ++ cmd->opcode == SD_IO_RW_EXTENDED; + } else { + pack_len = 0; + + ictl |= MESON_SDHC_ICTL_RESP_OK; + } + ++ regmap_update_bits(host->regmap, MESON_SDHC_MISC, ++ MESON_SDHC_MISC_MANUAL_STOP, ++ manual_stop ? MESON_SDHC_MISC_MANUAL_STOP : 0); ++ + if (cmd->opcode == MMC_STOP_TRANSMISSION) + send |= MESON_SDHC_SEND_DATA_STOP; + +diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c +index fdaa11f92fe6f..a75d3dd34d18c 100644 +--- a/drivers/mmc/host/mmci_stm32_sdmmc.c ++++ b/drivers/mmc/host/mmci_stm32_sdmmc.c +@@ -441,6 +441,8 @@ static int sdmmc_dlyb_phase_tuning(struct mmci_host *host, u32 opcode) + return -EINVAL; + } + ++ writel_relaxed(0, dlyb->base + DLYB_CR); ++ + phase = end_of_len - max_len / 2; + sdmmc_dlyb_set_cfgr(dlyb, dlyb->unit, phase, false); + +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c +index 8ea9132ebca4e..d50b691f6c44e 100644 +--- a/drivers/mmc/host/sdhci-tegra.c ++++ b/drivers/mmc/host/sdhci-tegra.c +@@ -354,23 +354,6 @@ static void tegra_sdhci_set_tap(struct sdhci_host *host, unsigned int tap) + } + } + +-static void tegra_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc, +- struct mmc_ios *ios) +-{ +- struct sdhci_host *host = mmc_priv(mmc); +- u32 val; +- +- val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL); +- +- if (ios->enhanced_strobe) +- val |= SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE; +- else +- val &= ~SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE; +- +- sdhci_writel(host, val, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL); +- +-} +- + static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask) + { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); +@@ -791,6 +774,32 @@ static void tegra_sdhci_set_clock(struct sdhci_host *host, unsigned int clock) + } + } + ++static void tegra_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc, ++ struct mmc_ios *ios) ++{ ++ struct sdhci_host *host = mmc_priv(mmc); ++ u32 val; ++ ++ val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL); ++ ++ if (ios->enhanced_strobe) { ++ val |= SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE; ++ /* ++ * When CMD13 is sent from mmc_select_hs400es() after ++ * switching to HS400ES mode, the bus is operating at ++ * either MMC_HIGH_26_MAX_DTR or MMC_HIGH_52_MAX_DTR. ++ * To meet Tegra SDHCI requirement at HS400ES mode, force SDHCI ++ * interface clock to MMC_HS200_MAX_DTR (200 MHz) so that host ++ * controller CAR clock and the interface clock are rate matched. ++ */ ++ tegra_sdhci_set_clock(host, MMC_HS200_MAX_DTR); ++ } else { ++ val &= ~SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE; ++ } ++ ++ sdhci_writel(host, val, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL); ++} ++ + static unsigned int tegra_sdhci_get_max_clock(struct sdhci_host *host) + { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); +diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c +index a4e4e15f574df..fe55c81608daa 100644 +--- a/drivers/net/bonding/bond_options.c ++++ b/drivers/net/bonding/bond_options.c +@@ -1466,7 +1466,7 @@ static int bond_option_ad_actor_system_set(struct bonding *bond, + mac = (u8 *)&newval->value; + } + +- if (!is_valid_ether_addr(mac)) ++ if (is_multicast_ether_addr(mac)) + goto err; + + netdev_dbg(bond->dev, "Setting ad_actor_system to %pM\n", mac); +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c +index 1662c0985eca4..f854d41c6c94d 100644 +--- a/drivers/net/ethernet/intel/igb/igb_main.c ++++ b/drivers/net/ethernet/intel/igb/igb_main.c +@@ -9260,7 +9260,7 @@ static int __maybe_unused igb_suspend(struct device *dev) + return __igb_shutdown(to_pci_dev(dev), NULL, 0); + } + +-static int __maybe_unused igb_resume(struct device *dev) ++static int __maybe_unused __igb_resume(struct device *dev, bool rpm) + { + struct pci_dev *pdev = to_pci_dev(dev); + struct net_device *netdev = pci_get_drvdata(pdev); +@@ -9303,17 +9303,24 @@ static int __maybe_unused igb_resume(struct device *dev) + + wr32(E1000_WUS, ~0); + +- rtnl_lock(); ++ if (!rpm) ++ rtnl_lock(); + if (!err && netif_running(netdev)) + err = __igb_open(netdev, true); + + if (!err) + netif_device_attach(netdev); +- rtnl_unlock(); ++ if (!rpm) ++ rtnl_unlock(); + + return err; + } + ++static int __maybe_unused igb_resume(struct device *dev) ++{ ++ return __igb_resume(dev, false); ++} ++ + static int __maybe_unused igb_runtime_idle(struct device *dev) + { + struct net_device *netdev = dev_get_drvdata(dev); +@@ -9332,7 +9339,7 @@ static int __maybe_unused igb_runtime_suspend(struct device *dev) + + static int __maybe_unused igb_runtime_resume(struct device *dev) + { +- return igb_resume(dev); ++ return __igb_resume(dev, true); + } + + static void igb_shutdown(struct pci_dev *pdev) +@@ -9448,7 +9455,7 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev, + * @pdev: Pointer to PCI device + * + * Restart the card from scratch, as if from a cold-boot. Implementation +- * resembles the first-half of the igb_resume routine. ++ * resembles the first-half of the __igb_resume routine. + **/ + static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev) + { +@@ -9488,7 +9495,7 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev) + * + * This callback is called when the error recovery driver tells us that + * its OK to resume normal operation. Implementation resembles the +- * second-half of the igb_resume routine. ++ * second-half of the __igb_resume routine. + */ + static void igb_io_resume(struct pci_dev *pdev) + { +diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c +index feb69fcd908e3..f406f5b517b02 100644 +--- a/drivers/net/ethernet/marvell/prestera/prestera_main.c ++++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c +@@ -50,12 +50,14 @@ int prestera_port_pvid_set(struct prestera_port *port, u16 vid) + struct prestera_port *prestera_port_find_by_hwid(struct prestera_switch *sw, + u32 dev_id, u32 hw_id) + { +- struct prestera_port *port = NULL; ++ struct prestera_port *port = NULL, *tmp; + + read_lock(&sw->port_list_lock); +- list_for_each_entry(port, &sw->port_list, list) { +- if (port->dev_id == dev_id && port->hw_id == hw_id) ++ list_for_each_entry(tmp, &sw->port_list, list) { ++ if (tmp->dev_id == dev_id && tmp->hw_id == hw_id) { ++ port = tmp; + break; ++ } + } + read_unlock(&sw->port_list_lock); + +@@ -64,12 +66,14 @@ struct prestera_port *prestera_port_find_by_hwid(struct prestera_switch *sw, + + struct prestera_port *prestera_find_port(struct prestera_switch *sw, u32 id) + { +- struct prestera_port *port = NULL; ++ struct prestera_port *port = NULL, *tmp; + + read_lock(&sw->port_list_lock); +- list_for_each_entry(port, &sw->port_list, list) { +- if (port->id == id) ++ list_for_each_entry(tmp, &sw->port_list, list) { ++ if (tmp->id == id) { ++ port = tmp; + break; ++ } + } + read_unlock(&sw->port_list_lock); + +diff --git a/drivers/net/ethernet/micrel/ks8851_par.c b/drivers/net/ethernet/micrel/ks8851_par.c +index 3bab0cb2b1a56..c7c99cc54ca11 100644 +--- a/drivers/net/ethernet/micrel/ks8851_par.c ++++ b/drivers/net/ethernet/micrel/ks8851_par.c +@@ -323,6 +323,8 @@ static int ks8851_probe_par(struct platform_device *pdev) + return ret; + + netdev->irq = platform_get_irq(pdev, 0); ++ if (netdev->irq < 0) ++ return netdev->irq; + + return ks8851_probe_common(netdev, dev, msg_enable); + } +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h +index 7160b42f51ddd..d0111cb3b40e1 100644 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov.h +@@ -201,7 +201,7 @@ int qlcnic_sriov_get_vf_vport_info(struct qlcnic_adapter *, + struct qlcnic_info *, u16); + int qlcnic_sriov_cfg_vf_guest_vlan(struct qlcnic_adapter *, u16, u8); + void qlcnic_sriov_free_vlans(struct qlcnic_adapter *); +-void qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *); ++int qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *); + bool qlcnic_sriov_check_any_vlan(struct qlcnic_vf_info *); + void qlcnic_sriov_del_vlan_id(struct qlcnic_sriov *, + struct qlcnic_vf_info *, u16); +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +index 30e52f9697593..8367891bfb139 100644 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +@@ -432,7 +432,7 @@ static int qlcnic_sriov_set_guest_vlan_mode(struct qlcnic_adapter *adapter, + struct qlcnic_cmd_args *cmd) + { + struct qlcnic_sriov *sriov = adapter->ahw->sriov; +- int i, num_vlans; ++ int i, num_vlans, ret; + u16 *vlans; + + if (sriov->allowed_vlans) +@@ -443,7 +443,9 @@ static int qlcnic_sriov_set_guest_vlan_mode(struct qlcnic_adapter *adapter, + dev_info(&adapter->pdev->dev, "Number of allowed Guest VLANs = %d\n", + sriov->num_allowed_vlans); + +- qlcnic_sriov_alloc_vlans(adapter); ++ ret = qlcnic_sriov_alloc_vlans(adapter); ++ if (ret) ++ return ret; + + if (!sriov->any_vlan) + return 0; +@@ -2159,7 +2161,7 @@ static int qlcnic_sriov_vf_resume(struct qlcnic_adapter *adapter) + return err; + } + +-void qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *adapter) ++int qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *adapter) + { + struct qlcnic_sriov *sriov = adapter->ahw->sriov; + struct qlcnic_vf_info *vf; +@@ -2169,7 +2171,11 @@ void qlcnic_sriov_alloc_vlans(struct qlcnic_adapter *adapter) + vf = &sriov->vf_info[i]; + vf->sriov_vlans = kcalloc(sriov->num_allowed_vlans, + sizeof(*vf->sriov_vlans), GFP_KERNEL); ++ if (!vf->sriov_vlans) ++ return -ENOMEM; + } ++ ++ return 0; + } + + void qlcnic_sriov_free_vlans(struct qlcnic_adapter *adapter) +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +index 447720b93e5ab..e90fa97c0ae6c 100644 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +@@ -597,7 +597,9 @@ static int __qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter, + if (err) + goto del_flr_queue; + +- qlcnic_sriov_alloc_vlans(adapter); ++ err = qlcnic_sriov_alloc_vlans(adapter); ++ if (err) ++ goto del_flr_queue; + + return err; + +diff --git a/drivers/net/ethernet/sfc/falcon/rx.c b/drivers/net/ethernet/sfc/falcon/rx.c +index 966f13e7475dd..11a6aee852e92 100644 +--- a/drivers/net/ethernet/sfc/falcon/rx.c ++++ b/drivers/net/ethernet/sfc/falcon/rx.c +@@ -728,7 +728,10 @@ static void ef4_init_rx_recycle_ring(struct ef4_nic *efx, + efx->rx_bufs_per_page); + rx_queue->page_ring = kcalloc(page_ring_size, + sizeof(*rx_queue->page_ring), GFP_KERNEL); +- rx_queue->page_ptr_mask = page_ring_size - 1; ++ if (!rx_queue->page_ring) ++ rx_queue->page_ptr_mask = 0; ++ else ++ rx_queue->page_ptr_mask = page_ring_size - 1; + } + + void ef4_init_rx_queue(struct ef4_rx_queue *rx_queue) +diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c +index 19cf7cac1e6e9..8834bcb12fa97 100644 +--- a/drivers/net/ethernet/sfc/rx_common.c ++++ b/drivers/net/ethernet/sfc/rx_common.c +@@ -150,7 +150,10 @@ static void efx_init_rx_recycle_ring(struct efx_rx_queue *rx_queue) + efx->rx_bufs_per_page); + rx_queue->page_ring = kcalloc(page_ring_size, + sizeof(*rx_queue->page_ring), GFP_KERNEL); +- rx_queue->page_ptr_mask = page_ring_size - 1; ++ if (!rx_queue->page_ring) ++ rx_queue->page_ptr_mask = 0; ++ else ++ rx_queue->page_ptr_mask = page_ring_size - 1; + } + + static void efx_fini_rx_recycle_ring(struct efx_rx_queue *rx_queue) +diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c +index 01069dfaf75c9..288b420f88d42 100644 +--- a/drivers/net/ethernet/smsc/smc911x.c ++++ b/drivers/net/ethernet/smsc/smc911x.c +@@ -2069,6 +2069,11 @@ static int smc911x_drv_probe(struct platform_device *pdev) + + ndev->dma = (unsigned char)-1; + ndev->irq = platform_get_irq(pdev, 0); ++ if (ndev->irq < 0) { ++ ret = ndev->irq; ++ goto release_both; ++ } ++ + lp = netdev_priv(ndev); + lp->netdev = ndev; + #ifdef SMC_DYNAMIC_BUS_CONFIG +diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c +index e449d94661225..2a569eea4ee8f 100644 +--- a/drivers/net/fjes/fjes_main.c ++++ b/drivers/net/fjes/fjes_main.c +@@ -1269,6 +1269,11 @@ static int fjes_probe(struct platform_device *plat_dev) + hw->hw_res.start = res->start; + hw->hw_res.size = resource_size(res); + hw->hw_res.irq = platform_get_irq(plat_dev, 0); ++ if (hw->hw_res.irq < 0) { ++ err = hw->hw_res.irq; ++ goto err_free_control_wq; ++ } ++ + err = fjes_hw_init(&adapter->hw); + if (err) + goto err_free_control_wq; +diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c +index 920e9f888cc35..63502a85a9751 100644 +--- a/drivers/net/hamradio/mkiss.c ++++ b/drivers/net/hamradio/mkiss.c +@@ -792,13 +792,14 @@ static void mkiss_close(struct tty_struct *tty) + */ + netif_stop_queue(ax->dev); + +- /* Free all AX25 frame buffers. */ ++ unregister_netdev(ax->dev); ++ ++ /* Free all AX25 frame buffers after unreg. */ + kfree(ax->rbuff); + kfree(ax->xbuff); + + ax->tty = NULL; + +- unregister_netdev(ax->dev); + free_netdev(ax->dev); + } + +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index c666e990900b9..6f7b70522d926 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -64,6 +64,8 @@ + #define LAN7801_USB_PRODUCT_ID (0x7801) + #define LAN78XX_EEPROM_MAGIC (0x78A5) + #define LAN78XX_OTP_MAGIC (0x78F3) ++#define AT29M2AF_USB_VENDOR_ID (0x07C9) ++#define AT29M2AF_USB_PRODUCT_ID (0x0012) + + #define MII_READ 1 + #define MII_WRITE 0 +@@ -4142,6 +4144,10 @@ static const struct usb_device_id products[] = { + /* LAN7801 USB Gigabit Ethernet Device */ + USB_DEVICE(LAN78XX_USB_VENDOR_ID, LAN7801_USB_PRODUCT_ID), + }, ++ { ++ /* ATM2-AF USB Gigabit Ethernet Device */ ++ USB_DEVICE(AT29M2AF_USB_VENDOR_ID, AT29M2AF_USB_PRODUCT_ID), ++ }, + {}, + }; + MODULE_DEVICE_TABLE(usb, products); +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 1d21129f7751c..40ce18a0d0190 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -1244,6 +1244,18 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) + raw_spin_lock_init(&pc->irq_lock[i]); + } + ++ pc->pctl_desc = *pdata->pctl_desc; ++ pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); ++ if (IS_ERR(pc->pctl_dev)) { ++ gpiochip_remove(&pc->gpio_chip); ++ return PTR_ERR(pc->pctl_dev); ++ } ++ ++ pc->gpio_range = *pdata->gpio_range; ++ pc->gpio_range.base = pc->gpio_chip.base; ++ pc->gpio_range.gc = &pc->gpio_chip; ++ pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); ++ + girq = &pc->gpio_chip.irq; + girq->chip = &bcm2835_gpio_irq_chip; + girq->parent_handler = bcm2835_gpio_irq_handler; +@@ -1251,8 +1263,10 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) + girq->parents = devm_kcalloc(dev, BCM2835_NUM_IRQS, + sizeof(*girq->parents), + GFP_KERNEL); +- if (!girq->parents) ++ if (!girq->parents) { ++ pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range); + return -ENOMEM; ++ } + + if (is_7211) { + pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS, +@@ -1303,21 +1317,10 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) + err = gpiochip_add_data(&pc->gpio_chip, pc); + if (err) { + dev_err(dev, "could not add GPIO chip\n"); ++ pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range); + return err; + } + +- pc->pctl_desc = *pdata->pctl_desc; +- pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); +- if (IS_ERR(pc->pctl_dev)) { +- gpiochip_remove(&pc->gpio_chip); +- return PTR_ERR(pc->pctl_dev); +- } +- +- pc->gpio_range = *pdata->gpio_range; +- pc->gpio_range.base = pc->gpio_chip.base; +- pc->gpio_range.gc = &pc->gpio_chip; +- pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); +- + return 0; + } + +diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +index 10002b8497fea..fbb7807e0da29 100644 +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +@@ -280,8 +280,12 @@ static int mtk_xt_get_gpio_n(void *data, unsigned long eint_n, + desc = (const struct mtk_pin_desc *)hw->soc->pins; + *gpio_chip = &hw->chip; + +- /* Be greedy to guess first gpio_n is equal to eint_n */ +- if (desc[eint_n].eint.eint_n == eint_n) ++ /* ++ * Be greedy to guess first gpio_n is equal to eint_n. ++ * Only eint virtual eint number is greater than gpio number. ++ */ ++ if (hw->soc->npins > eint_n && ++ desc[eint_n].eint.eint_n == eint_n) + *gpio_n = eint_n; + else + *gpio_n = mtk_xt_find_eint_num(hw, eint_n); +diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c +index a5f1f6ba74392..e13723bb2be41 100644 +--- a/drivers/pinctrl/stm32/pinctrl-stm32.c ++++ b/drivers/pinctrl/stm32/pinctrl-stm32.c +@@ -1255,10 +1255,10 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, + bank_nr = args.args[1] / STM32_GPIO_PINS_PER_BANK; + bank->gpio_chip.base = args.args[1]; + +- npins = args.args[2]; +- while (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, +- ++i, &args)) +- npins += args.args[2]; ++ /* get the last defined gpio line (offset + nb of pins) */ ++ npins = args.args[0] + args.args[2]; ++ while (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, ++i, &args)) ++ npins = max(npins, (int)(args.args[0] + args.args[2])); + } else { + bank_nr = pctl->nbanks; + bank->gpio_chip.base = bank_nr * STM32_GPIO_PINS_PER_BANK; +diff --git a/drivers/platform/x86/intel_pmc_core_pltdrv.c b/drivers/platform/x86/intel_pmc_core_pltdrv.c +index 73797680b895c..15ca8afdd973d 100644 +--- a/drivers/platform/x86/intel_pmc_core_pltdrv.c ++++ b/drivers/platform/x86/intel_pmc_core_pltdrv.c +@@ -65,7 +65,7 @@ static int __init pmc_core_platform_init(void) + + retval = platform_device_register(pmc_core_device); + if (retval) +- kfree(pmc_core_device); ++ platform_device_put(pmc_core_device); + + return retval; + } +diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c +index 46feafe4e201c..d8cc4b270644a 100644 +--- a/drivers/spi/spi-armada-3700.c ++++ b/drivers/spi/spi-armada-3700.c +@@ -901,7 +901,7 @@ static int a3700_spi_probe(struct platform_device *pdev) + return 0; + + error_clk: +- clk_disable_unprepare(spi->clk); ++ clk_unprepare(spi->clk); + error: + spi_master_put(master); + out: +diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c +index c41a9a501a6e9..fa75024f16f7f 100644 +--- a/drivers/tee/optee/shm_pool.c ++++ b/drivers/tee/optee/shm_pool.c +@@ -41,10 +41,8 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, + goto err; + } + +- for (i = 0; i < nr_pages; i++) { +- pages[i] = page; +- page++; +- } ++ for (i = 0; i < nr_pages; i++) ++ pages[i] = page + i; + + shm->flags |= TEE_SHM_REGISTER; + rc = optee_shm_register(shm->ctx, shm, pages, nr_pages, +diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c +index 8a9384a64f3e2..499fccba3d74b 100644 +--- a/drivers/tee/tee_shm.c ++++ b/drivers/tee/tee_shm.c +@@ -1,11 +1,11 @@ + // SPDX-License-Identifier: GPL-2.0-only + /* +- * Copyright (c) 2015-2016, Linaro Limited ++ * Copyright (c) 2015-2017, 2019-2021 Linaro Limited + */ ++#include <linux/anon_inodes.h> + #include <linux/device.h> +-#include <linux/dma-buf.h> +-#include <linux/fdtable.h> + #include <linux/idr.h> ++#include <linux/mm.h> + #include <linux/sched.h> + #include <linux/slab.h> + #include <linux/tee_drv.h> +@@ -28,16 +28,8 @@ static void release_registered_pages(struct tee_shm *shm) + } + } + +-static void tee_shm_release(struct tee_shm *shm) ++static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm) + { +- struct tee_device *teedev = shm->ctx->teedev; +- +- if (shm->flags & TEE_SHM_DMA_BUF) { +- mutex_lock(&teedev->mutex); +- idr_remove(&teedev->idr, shm->id); +- mutex_unlock(&teedev->mutex); +- } +- + if (shm->flags & TEE_SHM_POOL) { + struct tee_shm_pool_mgr *poolm; + +@@ -64,45 +56,6 @@ static void tee_shm_release(struct tee_shm *shm) + tee_device_put(teedev); + } + +-static struct sg_table *tee_shm_op_map_dma_buf(struct dma_buf_attachment +- *attach, enum dma_data_direction dir) +-{ +- return NULL; +-} +- +-static void tee_shm_op_unmap_dma_buf(struct dma_buf_attachment *attach, +- struct sg_table *table, +- enum dma_data_direction dir) +-{ +-} +- +-static void tee_shm_op_release(struct dma_buf *dmabuf) +-{ +- struct tee_shm *shm = dmabuf->priv; +- +- tee_shm_release(shm); +-} +- +-static int tee_shm_op_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) +-{ +- struct tee_shm *shm = dmabuf->priv; +- size_t size = vma->vm_end - vma->vm_start; +- +- /* Refuse sharing shared memory provided by application */ +- if (shm->flags & TEE_SHM_USER_MAPPED) +- return -EINVAL; +- +- return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT, +- size, vma->vm_page_prot); +-} +- +-static const struct dma_buf_ops tee_shm_dma_buf_ops = { +- .map_dma_buf = tee_shm_op_map_dma_buf, +- .unmap_dma_buf = tee_shm_op_unmap_dma_buf, +- .release = tee_shm_op_release, +- .mmap = tee_shm_op_mmap, +-}; +- + struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags) + { + struct tee_device *teedev = ctx->teedev; +@@ -137,6 +90,7 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags) + goto err_dev_put; + } + ++ refcount_set(&shm->refcount, 1); + shm->flags = flags | TEE_SHM_POOL; + shm->ctx = ctx; + if (flags & TEE_SHM_DMA_BUF) +@@ -150,10 +104,7 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags) + goto err_kfree; + } + +- + if (flags & TEE_SHM_DMA_BUF) { +- DEFINE_DMA_BUF_EXPORT_INFO(exp_info); +- + mutex_lock(&teedev->mutex); + shm->id = idr_alloc(&teedev->idr, shm, 1, 0, GFP_KERNEL); + mutex_unlock(&teedev->mutex); +@@ -161,28 +112,11 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags) + ret = ERR_PTR(shm->id); + goto err_pool_free; + } +- +- exp_info.ops = &tee_shm_dma_buf_ops; +- exp_info.size = shm->size; +- exp_info.flags = O_RDWR; +- exp_info.priv = shm; +- +- shm->dmabuf = dma_buf_export(&exp_info); +- if (IS_ERR(shm->dmabuf)) { +- ret = ERR_CAST(shm->dmabuf); +- goto err_rem; +- } + } + + teedev_ctx_get(ctx); + + return shm; +-err_rem: +- if (flags & TEE_SHM_DMA_BUF) { +- mutex_lock(&teedev->mutex); +- idr_remove(&teedev->idr, shm->id); +- mutex_unlock(&teedev->mutex); +- } + err_pool_free: + poolm->ops->free(poolm, shm); + err_kfree: +@@ -243,6 +177,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr, + goto err; + } + ++ refcount_set(&shm->refcount, 1); + shm->flags = flags | TEE_SHM_REGISTER; + shm->ctx = ctx; + shm->id = -1; +@@ -303,22 +238,6 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr, + goto err; + } + +- if (flags & TEE_SHM_DMA_BUF) { +- DEFINE_DMA_BUF_EXPORT_INFO(exp_info); +- +- exp_info.ops = &tee_shm_dma_buf_ops; +- exp_info.size = shm->size; +- exp_info.flags = O_RDWR; +- exp_info.priv = shm; +- +- shm->dmabuf = dma_buf_export(&exp_info); +- if (IS_ERR(shm->dmabuf)) { +- ret = ERR_CAST(shm->dmabuf); +- teedev->desc->ops->shm_unregister(ctx, shm); +- goto err; +- } +- } +- + return shm; + err: + if (shm) { +@@ -336,6 +255,35 @@ err: + } + EXPORT_SYMBOL_GPL(tee_shm_register); + ++static int tee_shm_fop_release(struct inode *inode, struct file *filp) ++{ ++ tee_shm_put(filp->private_data); ++ return 0; ++} ++ ++static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma) ++{ ++ struct tee_shm *shm = filp->private_data; ++ size_t size = vma->vm_end - vma->vm_start; ++ ++ /* Refuse sharing shared memory provided by application */ ++ if (shm->flags & TEE_SHM_USER_MAPPED) ++ return -EINVAL; ++ ++ /* check for overflowing the buffer's size */ ++ if (vma->vm_pgoff + vma_pages(vma) > shm->size >> PAGE_SHIFT) ++ return -EINVAL; ++ ++ return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT, ++ size, vma->vm_page_prot); ++} ++ ++static const struct file_operations tee_shm_fops = { ++ .owner = THIS_MODULE, ++ .release = tee_shm_fop_release, ++ .mmap = tee_shm_fop_mmap, ++}; ++ + /** + * tee_shm_get_fd() - Increase reference count and return file descriptor + * @shm: Shared memory handle +@@ -348,10 +296,11 @@ int tee_shm_get_fd(struct tee_shm *shm) + if (!(shm->flags & TEE_SHM_DMA_BUF)) + return -EINVAL; + +- get_dma_buf(shm->dmabuf); +- fd = dma_buf_fd(shm->dmabuf, O_CLOEXEC); ++ /* matched by tee_shm_put() in tee_shm_op_release() */ ++ refcount_inc(&shm->refcount); ++ fd = anon_inode_getfd("tee_shm", &tee_shm_fops, shm, O_RDWR); + if (fd < 0) +- dma_buf_put(shm->dmabuf); ++ tee_shm_put(shm); + return fd; + } + +@@ -361,17 +310,7 @@ int tee_shm_get_fd(struct tee_shm *shm) + */ + void tee_shm_free(struct tee_shm *shm) + { +- /* +- * dma_buf_put() decreases the dmabuf reference counter and will +- * call tee_shm_release() when the last reference is gone. +- * +- * In the case of driver private memory we call tee_shm_release +- * directly instead as it doesn't have a reference counter. +- */ +- if (shm->flags & TEE_SHM_DMA_BUF) +- dma_buf_put(shm->dmabuf); +- else +- tee_shm_release(shm); ++ tee_shm_put(shm); + } + EXPORT_SYMBOL_GPL(tee_shm_free); + +@@ -478,10 +417,15 @@ struct tee_shm *tee_shm_get_from_id(struct tee_context *ctx, int id) + teedev = ctx->teedev; + mutex_lock(&teedev->mutex); + shm = idr_find(&teedev->idr, id); ++ /* ++ * If the tee_shm was found in the IDR it must have a refcount ++ * larger than 0 due to the guarantee in tee_shm_put() below. So ++ * it's safe to use refcount_inc(). ++ */ + if (!shm || shm->ctx != ctx) + shm = ERR_PTR(-EINVAL); +- else if (shm->flags & TEE_SHM_DMA_BUF) +- get_dma_buf(shm->dmabuf); ++ else ++ refcount_inc(&shm->refcount); + mutex_unlock(&teedev->mutex); + return shm; + } +@@ -493,7 +437,24 @@ EXPORT_SYMBOL_GPL(tee_shm_get_from_id); + */ + void tee_shm_put(struct tee_shm *shm) + { +- if (shm->flags & TEE_SHM_DMA_BUF) +- dma_buf_put(shm->dmabuf); ++ struct tee_device *teedev = shm->ctx->teedev; ++ bool do_release = false; ++ ++ mutex_lock(&teedev->mutex); ++ if (refcount_dec_and_test(&shm->refcount)) { ++ /* ++ * refcount has reached 0, we must now remove it from the ++ * IDR before releasing the mutex. This will guarantee that ++ * the refcount_inc() in tee_shm_get_from_id() never starts ++ * from 0. ++ */ ++ if (shm->flags & TEE_SHM_DMA_BUF) ++ idr_remove(&teedev->idr, shm->id); ++ do_release = true; ++ } ++ mutex_unlock(&teedev->mutex); ++ ++ if (do_release) ++ tee_shm_release(teedev, shm); + } + EXPORT_SYMBOL_GPL(tee_shm_put); +diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c +index a9cb647bac6fb..a40be8b448c24 100644 +--- a/drivers/usb/gadget/function/u_ether.c ++++ b/drivers/usb/gadget/function/u_ether.c +@@ -860,19 +860,23 @@ int gether_register_netdev(struct net_device *net) + { + struct eth_dev *dev; + struct usb_gadget *g; +- struct sockaddr sa; + int status; + + if (!net->dev.parent) + return -EINVAL; + dev = netdev_priv(net); + g = dev->gadget; ++ ++ memcpy(net->dev_addr, dev->dev_mac, ETH_ALEN); ++ net->addr_assign_type = NET_ADDR_RANDOM; ++ + status = register_netdev(net); + if (status < 0) { + dev_dbg(&g->dev, "register_netdev failed, %d\n", status); + return status; + } else { + INFO(dev, "HOST MAC %pM\n", dev->host_mac); ++ INFO(dev, "MAC %pM\n", dev->dev_mac); + + /* two kinds of host-initiated state changes: + * - iff DATA transfer is active, carrier is "on" +@@ -880,15 +884,6 @@ int gether_register_netdev(struct net_device *net) + */ + netif_carrier_off(net); + } +- sa.sa_family = net->type; +- memcpy(sa.sa_data, dev->dev_mac, ETH_ALEN); +- rtnl_lock(); +- status = dev_set_mac_address(net, &sa, NULL); +- rtnl_unlock(); +- if (status) +- pr_warn("cannot set self ethernet address: %d\n", status); +- else +- INFO(dev, "MAC %pM\n", dev->dev_mac); + + return status; + } +diff --git a/fs/ceph/file.c b/fs/ceph/file.c +index 8e6855e7ed836..8ed881fd7440d 100644 +--- a/fs/ceph/file.c ++++ b/fs/ceph/file.c +@@ -603,13 +603,25 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, + in.cap.realm = cpu_to_le64(ci->i_snap_realm->ino); + in.cap.flags = CEPH_CAP_FLAG_AUTH; + in.ctime = in.mtime = in.atime = iinfo.btime; +- in.mode = cpu_to_le32((u32)mode); + in.truncate_seq = cpu_to_le32(1); + in.truncate_size = cpu_to_le64(-1ULL); + in.xattr_version = cpu_to_le64(1); + in.uid = cpu_to_le32(from_kuid(&init_user_ns, current_fsuid())); +- in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_mode & S_ISGID ? +- dir->i_gid : current_fsgid())); ++ if (dir->i_mode & S_ISGID) { ++ in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_gid)); ++ ++ /* Directories always inherit the setgid bit. */ ++ if (S_ISDIR(mode)) ++ mode |= S_ISGID; ++ else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) && ++ !in_group_p(dir->i_gid) && ++ !capable_wrt_inode_uidgid(dir, CAP_FSETID)) ++ mode &= ~S_ISGID; ++ } else { ++ in.gid = cpu_to_le32(from_kgid(&init_user_ns, current_fsgid())); ++ } ++ in.mode = cpu_to_le32((u32)mode); ++ + in.nlink = cpu_to_le32(1); + in.max_size = cpu_to_le64(lo->stripe_unit); + +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c +index c2f237653f68e..b8c9df6ab67f5 100644 +--- a/fs/ext4/extents.c ++++ b/fs/ext4/extents.c +@@ -136,14 +136,24 @@ int ext4_datasem_ensure_credits(handle_t *handle, struct inode *inode, + static int ext4_ext_get_access(handle_t *handle, struct inode *inode, + struct ext4_ext_path *path) + { ++ int err = 0; ++ + if (path->p_bh) { + /* path points to block */ + BUFFER_TRACE(path->p_bh, "get_write_access"); +- return ext4_journal_get_write_access(handle, path->p_bh); ++ err = ext4_journal_get_write_access(handle, path->p_bh); ++ /* ++ * The extent buffer's verified bit will be set again in ++ * __ext4_ext_dirty(). We could leave an inconsistent ++ * buffer if the extents updating procudure break off du ++ * to some error happens, force to check it again. ++ */ ++ if (!err) ++ clear_buffer_verified(path->p_bh); + } + /* path points to leaf/index in inode body */ + /* we use in-core data, no need to protect them */ +- return 0; ++ return err; + } + + /* +@@ -164,6 +174,9 @@ static int __ext4_ext_dirty(const char *where, unsigned int line, + /* path points to block */ + err = __ext4_handle_dirty_metadata(where, line, handle, + inode, path->p_bh); ++ /* Extents updating done, re-set verified flag */ ++ if (!err) ++ set_buffer_verified(path->p_bh); + } else { + /* path points to leaf/index in inode body */ + err = ext4_mark_inode_dirty(handle, inode); +@@ -353,9 +366,13 @@ static int ext4_valid_extent_idx(struct inode *inode, + + static int ext4_valid_extent_entries(struct inode *inode, + struct ext4_extent_header *eh, +- ext4_fsblk_t *pblk, int depth) ++ ext4_lblk_t lblk, ext4_fsblk_t *pblk, ++ int depth) + { + unsigned short entries; ++ ext4_lblk_t lblock = 0; ++ ext4_lblk_t prev = 0; ++ + if (eh->eh_entries == 0) + return 1; + +@@ -364,31 +381,51 @@ static int ext4_valid_extent_entries(struct inode *inode, + if (depth == 0) { + /* leaf entries */ + struct ext4_extent *ext = EXT_FIRST_EXTENT(eh); +- ext4_lblk_t lblock = 0; +- ext4_lblk_t prev = 0; +- int len = 0; ++ ++ /* ++ * The logical block in the first entry should equal to ++ * the number in the index block. ++ */ ++ if (depth != ext_depth(inode) && ++ lblk != le32_to_cpu(ext->ee_block)) ++ return 0; + while (entries) { + if (!ext4_valid_extent(inode, ext)) + return 0; + + /* Check for overlapping extents */ + lblock = le32_to_cpu(ext->ee_block); +- len = ext4_ext_get_actual_len(ext); + if ((lblock <= prev) && prev) { + *pblk = ext4_ext_pblock(ext); + return 0; + } ++ prev = lblock + ext4_ext_get_actual_len(ext) - 1; + ext++; + entries--; +- prev = lblock + len - 1; + } + } else { + struct ext4_extent_idx *ext_idx = EXT_FIRST_INDEX(eh); ++ ++ /* ++ * The logical block in the first entry should equal to ++ * the number in the parent index block. ++ */ ++ if (depth != ext_depth(inode) && ++ lblk != le32_to_cpu(ext_idx->ei_block)) ++ return 0; + while (entries) { + if (!ext4_valid_extent_idx(inode, ext_idx)) + return 0; ++ ++ /* Check for overlapping index extents */ ++ lblock = le32_to_cpu(ext_idx->ei_block); ++ if ((lblock <= prev) && prev) { ++ *pblk = ext4_idx_pblock(ext_idx); ++ return 0; ++ } + ext_idx++; + entries--; ++ prev = lblock; + } + } + return 1; +@@ -396,7 +433,7 @@ static int ext4_valid_extent_entries(struct inode *inode, + + static int __ext4_ext_check(const char *function, unsigned int line, + struct inode *inode, struct ext4_extent_header *eh, +- int depth, ext4_fsblk_t pblk) ++ int depth, ext4_fsblk_t pblk, ext4_lblk_t lblk) + { + const char *error_msg; + int max = 0, err = -EFSCORRUPTED; +@@ -422,7 +459,7 @@ static int __ext4_ext_check(const char *function, unsigned int line, + error_msg = "invalid eh_entries"; + goto corrupted; + } +- if (!ext4_valid_extent_entries(inode, eh, &pblk, depth)) { ++ if (!ext4_valid_extent_entries(inode, eh, lblk, &pblk, depth)) { + error_msg = "invalid extent entries"; + goto corrupted; + } +@@ -452,7 +489,7 @@ corrupted: + } + + #define ext4_ext_check(inode, eh, depth, pblk) \ +- __ext4_ext_check(__func__, __LINE__, (inode), (eh), (depth), (pblk)) ++ __ext4_ext_check(__func__, __LINE__, (inode), (eh), (depth), (pblk), 0) + + int ext4_ext_check_inode(struct inode *inode) + { +@@ -485,16 +522,18 @@ static void ext4_cache_extents(struct inode *inode, + + static struct buffer_head * + __read_extent_tree_block(const char *function, unsigned int line, +- struct inode *inode, ext4_fsblk_t pblk, int depth, +- int flags) ++ struct inode *inode, struct ext4_extent_idx *idx, ++ int depth, int flags) + { + struct buffer_head *bh; + int err; + gfp_t gfp_flags = __GFP_MOVABLE | GFP_NOFS; ++ ext4_fsblk_t pblk; + + if (flags & EXT4_EX_NOFAIL) + gfp_flags |= __GFP_NOFAIL; + ++ pblk = ext4_idx_pblock(idx); + bh = sb_getblk_gfp(inode->i_sb, pblk, gfp_flags); + if (unlikely(!bh)) + return ERR_PTR(-ENOMEM); +@@ -507,8 +546,8 @@ __read_extent_tree_block(const char *function, unsigned int line, + } + if (buffer_verified(bh) && !(flags & EXT4_EX_FORCE_CACHE)) + return bh; +- err = __ext4_ext_check(function, line, inode, +- ext_block_hdr(bh), depth, pblk); ++ err = __ext4_ext_check(function, line, inode, ext_block_hdr(bh), ++ depth, pblk, le32_to_cpu(idx->ei_block)); + if (err) + goto errout; + set_buffer_verified(bh); +@@ -526,8 +565,8 @@ errout: + + } + +-#define read_extent_tree_block(inode, pblk, depth, flags) \ +- __read_extent_tree_block(__func__, __LINE__, (inode), (pblk), \ ++#define read_extent_tree_block(inode, idx, depth, flags) \ ++ __read_extent_tree_block(__func__, __LINE__, (inode), (idx), \ + (depth), (flags)) + + /* +@@ -577,8 +616,7 @@ int ext4_ext_precache(struct inode *inode) + i--; + continue; + } +- bh = read_extent_tree_block(inode, +- ext4_idx_pblock(path[i].p_idx++), ++ bh = read_extent_tree_block(inode, path[i].p_idx++, + depth - i - 1, + EXT4_EX_FORCE_CACHE); + if (IS_ERR(bh)) { +@@ -883,8 +921,7 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block, + path[ppos].p_depth = i; + path[ppos].p_ext = NULL; + +- bh = read_extent_tree_block(inode, path[ppos].p_block, --i, +- flags); ++ bh = read_extent_tree_block(inode, path[ppos].p_idx, --i, flags); + if (IS_ERR(bh)) { + ret = PTR_ERR(bh); + goto err; +@@ -1489,7 +1526,6 @@ static int ext4_ext_search_right(struct inode *inode, + struct ext4_extent_header *eh; + struct ext4_extent_idx *ix; + struct ext4_extent *ex; +- ext4_fsblk_t block; + int depth; /* Note, NOT eh_depth; depth from top of tree */ + int ee_len; + +@@ -1556,20 +1592,17 @@ got_index: + * follow it and find the closest allocated + * block to the right */ + ix++; +- block = ext4_idx_pblock(ix); + while (++depth < path->p_depth) { + /* subtract from p_depth to get proper eh_depth */ +- bh = read_extent_tree_block(inode, block, +- path->p_depth - depth, 0); ++ bh = read_extent_tree_block(inode, ix, path->p_depth - depth, 0); + if (IS_ERR(bh)) + return PTR_ERR(bh); + eh = ext_block_hdr(bh); + ix = EXT_FIRST_INDEX(eh); +- block = ext4_idx_pblock(ix); + put_bh(bh); + } + +- bh = read_extent_tree_block(inode, block, path->p_depth - depth, 0); ++ bh = read_extent_tree_block(inode, ix, path->p_depth - depth, 0); + if (IS_ERR(bh)) + return PTR_ERR(bh); + eh = ext_block_hdr(bh); +@@ -2948,9 +2981,9 @@ again: + ext_debug(inode, "move to level %d (block %llu)\n", + i + 1, ext4_idx_pblock(path[i].p_idx)); + memset(path + i + 1, 0, sizeof(*path)); +- bh = read_extent_tree_block(inode, +- ext4_idx_pblock(path[i].p_idx), depth - i - 1, +- EXT4_EX_NOCACHE); ++ bh = read_extent_tree_block(inode, path[i].p_idx, ++ depth - i - 1, ++ EXT4_EX_NOCACHE); + if (IS_ERR(bh)) { + /* should we reset i_size? */ + err = PTR_ERR(bh); +diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c +index 65afcc3cc68a0..f44c60114379e 100644 +--- a/fs/f2fs/xattr.c ++++ b/fs/f2fs/xattr.c +@@ -680,8 +680,17 @@ static int __f2fs_setxattr(struct inode *inode, int index, + } + + last = here; +- while (!IS_XATTR_LAST_ENTRY(last)) ++ while (!IS_XATTR_LAST_ENTRY(last)) { ++ if ((void *)(last) + sizeof(__u32) > last_base_addr || ++ (void *)XATTR_NEXT_ENTRY(last) > last_base_addr) { ++ f2fs_err(F2FS_I_SB(inode), "inode (%lu) has invalid last xattr entry, entry_size: %zu", ++ inode->i_ino, ENTRY_SIZE(last)); ++ set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK); ++ error = -EFSCORRUPTED; ++ goto exit; ++ } + last = XATTR_NEXT_ENTRY(last); ++ } + + newsize = XATTR_ALIGN(sizeof(struct f2fs_xattr_entry) + len + size); + +diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h +index 459e9a76d7e6f..0c6c1de6f3b77 100644 +--- a/include/linux/tee_drv.h ++++ b/include/linux/tee_drv.h +@@ -195,7 +195,7 @@ int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method, + * @offset: offset of buffer in user space + * @pages: locked pages from userspace + * @num_pages: number of locked pages +- * @dmabuf: dmabuf used to for exporting to user space ++ * @refcount: reference counter + * @flags: defined by TEE_SHM_* in tee_drv.h + * @id: unique id of a shared memory object on this device + * +@@ -210,7 +210,7 @@ struct tee_shm { + unsigned int offset; + struct page **pages; + size_t num_pages; +- struct dma_buf *dmabuf; ++ refcount_t refcount; + u32 flags; + int id; + }; +diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h +index 04e87f4b9417c..a960de68ac69e 100644 +--- a/include/linux/virtio_net.h ++++ b/include/linux/virtio_net.h +@@ -7,9 +7,27 @@ + #include <uapi/linux/udp.h> + #include <uapi/linux/virtio_net.h> + ++static inline bool virtio_net_hdr_match_proto(__be16 protocol, __u8 gso_type) ++{ ++ switch (gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { ++ case VIRTIO_NET_HDR_GSO_TCPV4: ++ return protocol == cpu_to_be16(ETH_P_IP); ++ case VIRTIO_NET_HDR_GSO_TCPV6: ++ return protocol == cpu_to_be16(ETH_P_IPV6); ++ case VIRTIO_NET_HDR_GSO_UDP: ++ return protocol == cpu_to_be16(ETH_P_IP) || ++ protocol == cpu_to_be16(ETH_P_IPV6); ++ default: ++ return false; ++ } ++} ++ + static inline int virtio_net_hdr_set_proto(struct sk_buff *skb, + const struct virtio_net_hdr *hdr) + { ++ if (skb->protocol) ++ return 0; ++ + switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { + case VIRTIO_NET_HDR_GSO_TCPV4: + case VIRTIO_NET_HDR_GSO_UDP: +@@ -88,9 +106,12 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, + if (!skb->protocol) { + __be16 protocol = dev_parse_header_protocol(skb); + +- virtio_net_hdr_set_proto(skb, hdr); +- if (protocol && protocol != skb->protocol) ++ if (!protocol) ++ virtio_net_hdr_set_proto(skb, hdr); ++ else if (!virtio_net_hdr_match_proto(protocol, hdr->gso_type)) + return -EINVAL; ++ else ++ skb->protocol = protocol; + } + retry: + if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys, +diff --git a/mm/memory-failure.c b/mm/memory-failure.c +index 01445ddff58d8..aef267c6a7246 100644 +--- a/mm/memory-failure.c ++++ b/mm/memory-failure.c +@@ -1938,6 +1938,7 @@ retry: + else if (ret == 0) + if (soft_offline_free_page(page) && try_again) { + try_again = false; ++ flags &= ~MF_COUNT_INCREASED; + goto retry; + } + +diff --git a/mm/mempolicy.c b/mm/mempolicy.c +index 3ca4898f3f249..c8b1592dff73d 100644 +--- a/mm/mempolicy.c ++++ b/mm/mempolicy.c +@@ -2222,8 +2222,8 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, + * memory with both reclaim and compact as well. + */ + if (!page && (gfp & __GFP_DIRECT_RECLAIM)) +- page = __alloc_pages_node(hpage_node, +- gfp, order); ++ page = __alloc_pages_nodemask(gfp, order, ++ hpage_node, nmask); + + goto out; + } +diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c +index 269ee89d2c2be..22278807b3f36 100644 +--- a/net/ax25/af_ax25.c ++++ b/net/ax25/af_ax25.c +@@ -85,8 +85,10 @@ static void ax25_kill_by_device(struct net_device *dev) + again: + ax25_for_each(s, &ax25_list) { + if (s->ax25_dev == ax25_dev) { +- s->ax25_dev = NULL; + spin_unlock_bh(&ax25_list_lock); ++ lock_sock(s->sk); ++ s->ax25_dev = NULL; ++ release_sock(s->sk); + ax25_disconnect(s, ENETUNREACH); + spin_lock_bh(&ax25_list_lock); + +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c +index e429dbb10df71..d46ed4cbe7717 100644 +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1217,7 +1217,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, + return 0; + + error: ++ mutex_lock(&local->mtx); + ieee80211_vif_release_channel(sdata); ++ mutex_unlock(&local->mtx); ++ + return err; + } + +diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c +index b35e8d9a5b37e..33c13edbca4bb 100644 +--- a/net/netfilter/nfnetlink_log.c ++++ b/net/netfilter/nfnetlink_log.c +@@ -557,7 +557,8 @@ __build_packet_message(struct nfnl_log_net *log, + goto nla_put_failure; + + if (indev && skb->dev && +- skb->mac_header != skb->network_header) { ++ skb_mac_header_was_set(skb) && ++ skb_mac_header_len(skb) != 0) { + struct nfulnl_msg_packet_hw phw; + int len; + +diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c +index 98994fe677fe9..b0358f30947ea 100644 +--- a/net/netfilter/nfnetlink_queue.c ++++ b/net/netfilter/nfnetlink_queue.c +@@ -562,7 +562,8 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, + goto nla_put_failure; + + if (indev && entskb->dev && +- skb_mac_header_was_set(entskb)) { ++ skb_mac_header_was_set(entskb) && ++ skb_mac_header_len(entskb) != 0) { + struct nfqnl_msg_packet_hw phw; + int len; + +diff --git a/net/phonet/pep.c b/net/phonet/pep.c +index a1525916885ae..72018e5e4d8ef 100644 +--- a/net/phonet/pep.c ++++ b/net/phonet/pep.c +@@ -946,6 +946,8 @@ static int pep_ioctl(struct sock *sk, int cmd, unsigned long arg) + ret = -EBUSY; + else if (sk->sk_state == TCP_ESTABLISHED) + ret = -EISCONN; ++ else if (!pn->pn_sk.sobject) ++ ret = -EADDRNOTAVAIL; + else + ret = pep_sock_enable(sk, NULL, 0); + release_sock(sk); +diff --git a/sound/core/jack.c b/sound/core/jack.c +index 503c8af79d550..d6502dff247a8 100644 +--- a/sound/core/jack.c ++++ b/sound/core/jack.c +@@ -220,6 +220,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, + return -ENOMEM; + + jack->id = kstrdup(id, GFP_KERNEL); ++ if (jack->id == NULL) { ++ kfree(jack); ++ return -ENOMEM; ++ } + + /* don't creat input device for phantom jack */ + if (!phantom_jack) { +diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c +index eb23c55323ae1..a2583a30c45ad 100644 +--- a/sound/drivers/opl3/opl3_midi.c ++++ b/sound/drivers/opl3/opl3_midi.c +@@ -398,7 +398,7 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan) + } + if (instr_4op) { + vp2 = &opl3->voices[voice + 3]; +- if (vp->state > 0) { ++ if (vp2->state > 0) { + opl3_reg = reg_side | (OPL3_REG_KEYON_BLOCK + + voice_offset + 3); + reg_val = vp->keyon_reg & ~OPL3_KEYON_BIT; +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index bed2a93001635..14ce48f1a8e47 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6492,6 +6492,23 @@ static void alc233_fixup_no_audio_jack(struct hda_codec *codec, + alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs); + } + ++static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, ++ const struct hda_fixup *fix, ++ int action) ++{ ++ /* ++ * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec, ++ * but uses the 0x8686 subproduct id in both cases. The ALC256 codec ++ * needs an additional quirk for sound working after suspend and resume. ++ */ ++ if (codec->core.vendor_id == 0x10ec0256) { ++ alc_update_coef_idx(codec, 0x10, 1<<9, 0); ++ snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120); ++ } else { ++ snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c); ++ } ++} ++ + enum { + ALC269_FIXUP_GPIO2, + ALC269_FIXUP_SONY_VAIO, +@@ -6711,6 +6728,7 @@ enum { + ALC256_FIXUP_SET_COEF_DEFAULTS, + ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE, + ALC233_FIXUP_NO_AUDIO_JACK, ++ ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -8429,6 +8447,12 @@ static const struct hda_fixup alc269_fixups[] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc233_fixup_no_audio_jack, + }, ++ [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc256_fixup_mic_no_presence_and_resume, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -8599,6 +8623,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN), + SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360), ++ SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT), + SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT), + SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), + SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO), +@@ -8766,7 +8791,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC), + SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), +- SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME), + SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), +@@ -9060,6 +9085,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { + {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"}, + {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"}, + {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"}, ++ {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"}, + {} + }; + #define ALC225_STANDARD_PINS \ +diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c +index 41827cdf26a39..aaef76cc151fa 100644 +--- a/sound/soc/codecs/rt5682.c ++++ b/sound/soc/codecs/rt5682.c +@@ -924,6 +924,8 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert) + unsigned int val, count; + + if (jack_insert) { ++ snd_soc_dapm_mutex_lock(dapm); ++ + snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1, + RT5682_PWR_VREF2 | RT5682_PWR_MB, + RT5682_PWR_VREF2 | RT5682_PWR_MB); +@@ -968,6 +970,8 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert) + snd_soc_component_update_bits(component, RT5682_MICBIAS_2, + RT5682_PWR_CLK25M_MASK | RT5682_PWR_CLK1M_MASK, + RT5682_PWR_CLK25M_PU | RT5682_PWR_CLK1M_PU); ++ ++ snd_soc_dapm_mutex_unlock(dapm); + } else { + rt5682_enable_push_button_irq(component, false); + snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1, +diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c +index a91a0a31e74d1..61c3238bc2656 100644 +--- a/sound/soc/codecs/tas2770.c ++++ b/sound/soc/codecs/tas2770.c +@@ -291,11 +291,11 @@ static int tas2770_set_samplerate(struct tas2770_priv *tas2770, int samplerate) + ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_44_1KHZ | + TAS2770_TDM_CFG_REG0_31_88_2_96KHZ; + break; +- case 19200: ++ case 192000: + ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_48KHZ | + TAS2770_TDM_CFG_REG0_31_176_4_192KHZ; + break; +- case 17640: ++ case 176400: + ramp_rate_val = TAS2770_TDM_CFG_REG0_SMP_44_1KHZ | + TAS2770_TDM_CFG_REG0_31_176_4_192KHZ; + break; +diff --git a/sound/soc/meson/aiu-encoder-i2s.c b/sound/soc/meson/aiu-encoder-i2s.c +index 9322245521463..67729de41a73e 100644 +--- a/sound/soc/meson/aiu-encoder-i2s.c ++++ b/sound/soc/meson/aiu-encoder-i2s.c +@@ -18,7 +18,6 @@ + #define AIU_RST_SOFT_I2S_FAST BIT(0) + + #define AIU_I2S_DAC_CFG_MSB_FIRST BIT(2) +-#define AIU_I2S_MISC_HOLD_EN BIT(2) + #define AIU_CLK_CTRL_I2S_DIV_EN BIT(0) + #define AIU_CLK_CTRL_I2S_DIV GENMASK(3, 2) + #define AIU_CLK_CTRL_AOCLK_INVERT BIT(6) +@@ -36,37 +35,6 @@ static void aiu_encoder_i2s_divider_enable(struct snd_soc_component *component, + enable ? AIU_CLK_CTRL_I2S_DIV_EN : 0); + } + +-static void aiu_encoder_i2s_hold(struct snd_soc_component *component, +- bool enable) +-{ +- snd_soc_component_update_bits(component, AIU_I2S_MISC, +- AIU_I2S_MISC_HOLD_EN, +- enable ? AIU_I2S_MISC_HOLD_EN : 0); +-} +- +-static int aiu_encoder_i2s_trigger(struct snd_pcm_substream *substream, int cmd, +- struct snd_soc_dai *dai) +-{ +- struct snd_soc_component *component = dai->component; +- +- switch (cmd) { +- case SNDRV_PCM_TRIGGER_START: +- case SNDRV_PCM_TRIGGER_RESUME: +- case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: +- aiu_encoder_i2s_hold(component, false); +- return 0; +- +- case SNDRV_PCM_TRIGGER_STOP: +- case SNDRV_PCM_TRIGGER_SUSPEND: +- case SNDRV_PCM_TRIGGER_PAUSE_PUSH: +- aiu_encoder_i2s_hold(component, true); +- return 0; +- +- default: +- return -EINVAL; +- } +-} +- + static int aiu_encoder_i2s_setup_desc(struct snd_soc_component *component, + struct snd_pcm_hw_params *params) + { +@@ -353,7 +321,6 @@ static void aiu_encoder_i2s_shutdown(struct snd_pcm_substream *substream, + } + + const struct snd_soc_dai_ops aiu_encoder_i2s_dai_ops = { +- .trigger = aiu_encoder_i2s_trigger, + .hw_params = aiu_encoder_i2s_hw_params, + .hw_free = aiu_encoder_i2s_hw_free, + .set_fmt = aiu_encoder_i2s_set_fmt, +diff --git a/sound/soc/meson/aiu-fifo-i2s.c b/sound/soc/meson/aiu-fifo-i2s.c +index d91b0d874342f..2cbd127101d35 100644 +--- a/sound/soc/meson/aiu-fifo-i2s.c ++++ b/sound/soc/meson/aiu-fifo-i2s.c +@@ -20,6 +20,8 @@ + #define AIU_MEM_I2S_CONTROL_MODE_16BIT BIT(6) + #define AIU_MEM_I2S_BUF_CNTL_INIT BIT(0) + #define AIU_RST_SOFT_I2S_FAST BIT(0) ++#define AIU_I2S_MISC_HOLD_EN BIT(2) ++#define AIU_I2S_MISC_FORCE_LEFT_RIGHT BIT(4) + + #define AIU_FIFO_I2S_BLOCK 256 + +@@ -90,6 +92,10 @@ static int aiu_fifo_i2s_hw_params(struct snd_pcm_substream *substream, + unsigned int val; + int ret; + ++ snd_soc_component_update_bits(component, AIU_I2S_MISC, ++ AIU_I2S_MISC_HOLD_EN, ++ AIU_I2S_MISC_HOLD_EN); ++ + ret = aiu_fifo_hw_params(substream, params, dai); + if (ret) + return ret; +@@ -117,6 +123,19 @@ static int aiu_fifo_i2s_hw_params(struct snd_pcm_substream *substream, + snd_soc_component_update_bits(component, AIU_MEM_I2S_MASKS, + AIU_MEM_I2S_MASKS_IRQ_BLOCK, val); + ++ /* ++ * Most (all?) supported SoCs have this bit set by default. The vendor ++ * driver however sets it manually (depending on the version either ++ * while un-setting AIU_I2S_MISC_HOLD_EN or right before that). Follow ++ * the same approach for consistency with the vendor driver. ++ */ ++ snd_soc_component_update_bits(component, AIU_I2S_MISC, ++ AIU_I2S_MISC_FORCE_LEFT_RIGHT, ++ AIU_I2S_MISC_FORCE_LEFT_RIGHT); ++ ++ snd_soc_component_update_bits(component, AIU_I2S_MISC, ++ AIU_I2S_MISC_HOLD_EN, 0); ++ + return 0; + } + +diff --git a/sound/soc/meson/aiu-fifo.c b/sound/soc/meson/aiu-fifo.c +index aa88aae8e517d..3efc3cad0b4ec 100644 +--- a/sound/soc/meson/aiu-fifo.c ++++ b/sound/soc/meson/aiu-fifo.c +@@ -5,6 +5,7 @@ + + #include <linux/bitfield.h> + #include <linux/clk.h> ++#include <linux/dma-mapping.h> + #include <sound/pcm_params.h> + #include <sound/soc.h> + #include <sound/soc-dai.h> +@@ -192,6 +193,11 @@ int aiu_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, + struct snd_card *card = rtd->card->snd_card; + struct aiu_fifo *fifo = dai->playback_dma_data; + size_t size = fifo->pcm->buffer_bytes_max; ++ int ret; ++ ++ ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); ++ if (ret) ++ return ret; + + snd_pcm_lib_preallocate_pages(substream, + SNDRV_DMA_TYPE_DEV, |