commit:     0f8e141c362918ddc0725d192fdb37178c036238
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 11:30:44 2022 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Thu May 12 11:30:44 2022 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0f8e141c

Linux patch 4.19.242

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 0000_README               |    4 +
 1241_linux-4.19.242.patch | 2699 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 2703 insertions(+)

diff --git a/0000_README b/0000_README
index 467db0c8..2564c5de 100644
--- a/0000_README
+++ b/0000_README
@@ -1003,6 +1003,10 @@ Patch:  1240_linux-4.19.241.patch
 From:   https://www.kernel.org
 Desc:   Linux 4.19.241
 
+Patch:  1241_linux-4.19.242.patch
+From:   https://www.kernel.org
+Desc:   Linux 4.19.242
+
 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/1241_linux-4.19.242.patch b/1241_linux-4.19.242.patch
new file mode 100644
index 00000000..4a82ff92
--- /dev/null
+++ b/1241_linux-4.19.242.patch
@@ -0,0 +1,2699 @@
+diff --git a/Makefile b/Makefile
+index 58fb76d1d7d38..c61c1a508ec70 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0
+ VERSION = 4
+ PATCHLEVEL = 19
+-SUBLEVEL = 241
++SUBLEVEL = 242
+ EXTRAVERSION =
+ NAME = "People's Front"
+ 
+diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi 
b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+index 05f07ea3e8c80..ed783c91b002a 100644
+--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
++++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+@@ -313,6 +313,8 @@
+       codec: sgtl5000@a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
++              pinctrl-names = "default";
++              pinctrl-0 = <&pinctrl_sgtl5000>;
+               clocks = <&clks IMX6QDL_CLK_CKO>;
+               VDDA-supply = <&reg_module_3v3_audio>;
+               VDDIO-supply = <&reg_module_3v3>;
+@@ -540,8 +542,6 @@
+                       MX6QDL_PAD_DISP0_DAT21__AUD4_TXD        0x130b0
+                       MX6QDL_PAD_DISP0_DAT22__AUD4_TXFS       0x130b0
+                       MX6QDL_PAD_DISP0_DAT23__AUD4_RXD        0x130b0
+-                      /* SGTL5000 sys_mclk */
+-                      MX6QDL_PAD_GPIO_5__CCM_CLKO1            0x130b0
+               >;
+       };
+ 
+@@ -807,6 +807,12 @@
+               >;
+       };
+ 
++      pinctrl_sgtl5000: sgtl5000grp {
++              fsl,pins = <
++                      MX6QDL_PAD_GPIO_5__CCM_CLKO1    0x130b0
++              >;
++      };
++
+       pinctrl_spdif: spdifgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_16__SPDIF_IN  0x1b0b0
+diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi 
b/arch/arm/boot/dts/imx6ull-colibri.dtsi
+index 6c63a73846114..4219239f0b584 100644
+--- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
++++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
+@@ -37,7 +37,7 @@
+ 
+       reg_sd1_vmmc: regulator-sd1-vmmc {
+               compatible = "regulator-gpio";
+-              gpio = <&gpio5 9 GPIO_ACTIVE_HIGH>;
++              gpios = <&gpio5 9 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_snvs_reg_sd>;
+               regulator-always-on;
+diff --git a/arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts 
b/arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts
+index 32d0dc371fc34..4cd72b5e612b9 100644
+--- a/arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts
++++ b/arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts
+@@ -15,3 +15,18 @@
+       model = "LogicPD Zoom OMAP35xx SOM-LV Development Kit";
+       compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3";
+ };
++
++&omap3_pmx_core2 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&hsusb2_2_pins>;
++      hsusb2_2_pins: pinmux_hsusb2_2_pins {
++              pinctrl-single,pins = <
++                      OMAP3430_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3)    
        /* etk_d10.hsusb2_clk */
++                      OMAP3430_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3)    
        /* etk_d11.hsusb2_stp */
++                      OMAP3430_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d12.hsusb2_dir */
++                      OMAP3430_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d13.hsusb2_nxt */
++                      OMAP3430_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d14.hsusb2_data0 */
++                      OMAP3430_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d15.hsusb2_data1 */
++              >;
++      };
++};
+diff --git a/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts 
b/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
+index 24283739526c4..2aca9111c6999 100644
+--- a/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
++++ b/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
+@@ -15,3 +15,18 @@
+       model = "LogicPD Zoom DM3730 SOM-LV Development Kit";
+       compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3630", "ti,omap3";
+ };
++
++&omap3_pmx_core2 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&hsusb2_2_pins>;
++      hsusb2_2_pins: pinmux_hsusb2_2_pins {
++              pinctrl-single,pins = <
++                      OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3)    
        /* etk_d10.hsusb2_clk */
++                      OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3)    
        /* etk_d11.hsusb2_stp */
++                      OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d12.hsusb2_dir */
++                      OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d13.hsusb2_nxt */
++                      OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d14.hsusb2_data0 */
++                      OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d15.hsusb2_data1 */
++              >;
++      };
++};
+diff --git a/arch/arm/boot/dts/logicpd-som-lv.dtsi 
b/arch/arm/boot/dts/logicpd-som-lv.dtsi
+index c5d54c4d37476..499eea86e1022 100644
+--- a/arch/arm/boot/dts/logicpd-som-lv.dtsi
++++ b/arch/arm/boot/dts/logicpd-som-lv.dtsi
+@@ -269,21 +269,6 @@
+       };
+ };
+ 
+-&omap3_pmx_core2 {
+-      pinctrl-names = "default";
+-      pinctrl-0 = <&hsusb2_2_pins>;
+-      hsusb2_2_pins: pinmux_hsusb2_2_pins {
+-              pinctrl-single,pins = <
+-                      OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3)    
        /* etk_d10.hsusb2_clk */
+-                      OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3)    
        /* etk_d11.hsusb2_stp */
+-                      OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d12.hsusb2_dir */
+-                      OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d13.hsusb2_nxt */
+-                      OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d14.hsusb2_data0 */
+-                      OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | 
MUX_MODE3)    /* etk_d15.hsusb2_data1 */
+-              >;
+-      };
+-};
+-
+ &uart2 {
+       interrupts-extended = <&intc 73 &omap3_pmx_core OMAP3_UART2_RX>;
+       pinctrl-names = "default";
+diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
b/arch/arm/boot/dts/omap3-gta04.dtsi
+index a5aed92ab54b1..820bdd5326aba 100644
+--- a/arch/arm/boot/dts/omap3-gta04.dtsi
++++ b/arch/arm/boot/dts/omap3-gta04.dtsi
+@@ -29,6 +29,8 @@
+       aliases {
+               display0 = &lcd;
+               display1 = &tv0;
++              /delete-property/ mmc2;
++              /delete-property/ mmc3;
+       };
+ 
+       /* fixed 26MHz oscillator */
+diff --git a/arch/arm/mach-omap2/omap4-common.c 
b/arch/arm/mach-omap2/omap4-common.c
+index 7074cfd1ff413..79a1e4c51e3d0 100644
+--- a/arch/arm/mach-omap2/omap4-common.c
++++ b/arch/arm/mach-omap2/omap4-common.c
+@@ -318,10 +318,12 @@ void __init omap_gic_of_init(void)
+ 
+       np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-gic");
+       gic_dist_base_addr = of_iomap(np, 0);
++      of_node_put(np);
+       WARN_ON(!gic_dist_base_addr);
+ 
+       np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-twd-timer");
+       twd_base = of_iomap(np, 0);
++      of_node_put(np);
+       WARN_ON(!twd_base);
+ 
+ skip_errata_init:
+diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h
+index b05bb70a2e46f..8026baf46e729 100644
+--- a/arch/mips/include/asm/timex.h
++++ b/arch/mips/include/asm/timex.h
+@@ -40,9 +40,9 @@
+ typedef unsigned int cycles_t;
+ 
+ /*
+- * On R4000/R4400 before version 5.0 an erratum exists such that if the
+- * cycle counter is read in the exact moment that it is matching the
+- * compare register, no interrupt will be generated.
++ * On R4000/R4400 an erratum exists such that if the cycle counter is
++ * read in the exact moment that it is matching the compare register,
++ * no interrupt will be generated.
+  *
+  * There is a suggested workaround and also the erratum can't strike if
+  * the compare interrupt isn't being used as the clock source device.
+@@ -63,7 +63,7 @@ static inline int can_use_mips_counter(unsigned int prid)
+       if (!__builtin_constant_p(cpu_has_counter))
+               asm volatile("" : "=m" (cpu_data[0].options));
+       if (likely(cpu_has_counter &&
+-                 prid >= (PRID_IMP_R4000 | PRID_REV_ENCODE_44(5, 0))))
++                 prid > (PRID_IMP_R4000 | PRID_REV_ENCODE_44(15, 15))))
+               return 1;
+       else
+               return 0;
+diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
+index a0d994a4aaa95..ef79b3fc7588d 100644
+--- a/arch/mips/kernel/time.c
++++ b/arch/mips/kernel/time.c
+@@ -140,15 +140,10 @@ static __init int cpu_has_mfc0_count_bug(void)
+       case CPU_R4400MC:
+               /*
+                * The published errata for the R4400 up to 3.0 say the CPU
+-               * has the mfc0 from count bug.
++               * has the mfc0 from count bug.  This seems the last version
++               * produced.
+                */
+-              if ((current_cpu_data.processor_id & 0xff) <= 0x30)
+-                      return 1;
+-
+-              /*
+-               * we assume newer revisions are ok
+-               */
+-              return 0;
++              return 1;
+       }
+ 
+       return 0;
+diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
+index 82bd0d0927ce3..0b0194150b682 100644
+--- a/arch/parisc/kernel/processor.c
++++ b/arch/parisc/kernel/processor.c
+@@ -423,8 +423,7 @@ show_cpuinfo (struct seq_file *m, void *v)
+               }
+               seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities);
+ 
+-              seq_printf(m, "model\t\t: %s\n"
+-                              "model name\t: %s\n",
++              seq_printf(m, "model\t\t: %s - %s\n",
+                                boot_cpu_data.pdc.sys_model_name,
+                                cpuinfo->dev ?
+                                cpuinfo->dev->name : "Unknown");
+diff --git a/arch/x86/include/asm/microcode.h 
b/arch/x86/include/asm/microcode.h
+index 2b7cc5397f80d..91a06cef50c1b 100644
+--- a/arch/x86/include/asm/microcode.h
++++ b/arch/x86/include/asm/microcode.h
+@@ -133,11 +133,13 @@ extern void load_ucode_ap(void);
+ void reload_early_microcode(void);
+ extern bool get_builtin_firmware(struct cpio_data *cd, const char *name);
+ extern bool initrd_gone;
++void microcode_bsp_resume(void);
+ #else
+ static inline int __init microcode_init(void)                 { return 0; };
+ static inline void __init load_ucode_bsp(void)                        { }
+ static inline void load_ucode_ap(void)                                { }
+ static inline void reload_early_microcode(void)                       { }
++static inline void microcode_bsp_resume(void)                 { }
+ static inline bool
+ get_builtin_firmware(struct cpio_data *cd, const char *name)  { return false; 
}
+ #endif
+diff --git a/arch/x86/kernel/cpu/microcode/core.c 
b/arch/x86/kernel/cpu/microcode/core.c
+index eab4de387ce64..985ef98c8ba23 100644
+--- a/arch/x86/kernel/cpu/microcode/core.c
++++ b/arch/x86/kernel/cpu/microcode/core.c
+@@ -773,9 +773,9 @@ static struct subsys_interface mc_cpu_interface = {
+ };
+ 
+ /**
+- * mc_bp_resume - Update boot CPU microcode during resume.
++ * microcode_bsp_resume - Update boot CPU microcode during resume.
+  */
+-static void mc_bp_resume(void)
++void microcode_bsp_resume(void)
+ {
+       int cpu = smp_processor_id();
+       struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+@@ -787,7 +787,7 @@ static void mc_bp_resume(void)
+ }
+ 
+ static struct syscore_ops mc_syscore_ops = {
+-      .resume                 = mc_bp_resume,
++      .resume                 = microcode_bsp_resume,
+ };
+ 
+ static int mc_cpu_starting(unsigned int cpu)
+diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
+index 097eef712cdc0..0489ffc3dfe5f 100644
+--- a/arch/x86/kvm/cpuid.c
++++ b/arch/x86/kvm/cpuid.c
+@@ -532,6 +532,11 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 
*entry, u32 function,
+               union cpuid10_eax eax;
+               union cpuid10_edx edx;
+ 
++              if (!static_cpu_has(X86_FEATURE_ARCH_PERFMON)) {
++                      entry->eax = entry->ebx = entry->ecx = entry->edx = 0;
++                      break;
++              }
++
+               perf_get_x86_pmu_capability(&cap);
+ 
+               /*
+diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
+index 40dbbd8f1fe41..8c6d0fb72b3a1 100644
+--- a/arch/x86/lib/usercopy_64.c
++++ b/arch/x86/lib/usercopy_64.c
+@@ -161,7 +161,7 @@ void memcpy_flushcache(void *_dst, const void *_src, 
size_t size)
+ 
+       /* cache copy and flush to align dest */
+       if (!IS_ALIGNED(dest, 8)) {
+-              unsigned len = min_t(unsigned, size, ALIGN(dest, 8) - dest);
++              size_t len = min_t(size_t, size, ALIGN(dest, 8) - dest);
+ 
+               memcpy((void *) dest, (void *) source, len);
+               clean_cache_range((void *) dest, len);
+diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
+index e00b8c36ab721..7948249482637 100644
+--- a/arch/x86/power/cpu.c
++++ b/arch/x86/power/cpu.c
+@@ -26,6 +26,7 @@
+ #include <asm/cpu.h>
+ #include <asm/mmu_context.h>
+ #include <asm/cpu_device_id.h>
++#include <asm/microcode.h>
+ 
+ #ifdef CONFIG_X86_32
+ __visible unsigned long saved_context_ebx;
+@@ -268,6 +269,13 @@ static void notrace __restore_processor_state(struct 
saved_context *ctxt)
+       x86_platform.restore_sched_clock_state();
+       mtrr_bp_restore();
+       perf_restore_debug_store();
++
++      microcode_bsp_resume();
++
++      /*
++       * This needs to happen after the microcode has been updated upon resume
++       * because some of the MSRs are "emulated" in microcode.
++       */
+       msr_restore_context(ctxt);
+ }
+ 
+diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
+index 2ca2cc56bcef6..b85d013a9185f 100644
+--- a/drivers/bus/sunxi-rsb.c
++++ b/drivers/bus/sunxi-rsb.c
+@@ -224,6 +224,8 @@ static struct sunxi_rsb_device 
*sunxi_rsb_device_create(struct sunxi_rsb *rsb,
+ 
+       dev_dbg(&rdev->dev, "device %s registered\n", dev_name(&rdev->dev));
+ 
++      return rdev;
++
+ err_device_add:
+       put_device(&rdev->dev);
+ 
+diff --git a/drivers/clk/sunxi/clk-sun9i-mmc.c 
b/drivers/clk/sunxi/clk-sun9i-mmc.c
+index f00d8758ba24f..a706ae9a010a5 100644
+--- a/drivers/clk/sunxi/clk-sun9i-mmc.c
++++ b/drivers/clk/sunxi/clk-sun9i-mmc.c
+@@ -117,6 +117,8 @@ static int sun9i_a80_mmc_config_clk_probe(struct 
platform_device *pdev)
+       spin_lock_init(&data->lock);
+ 
+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++      if (!r)
++              return -EINVAL;
+       /* one clock/reset pair per word */
+       count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH);
+       data->membase = devm_ioremap_resource(&pdev->dev, r);
+diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
+index 57ea7f4641787..11c634125c7df 100644
+--- a/drivers/firewire/core-card.c
++++ b/drivers/firewire/core-card.c
+@@ -681,6 +681,7 @@ EXPORT_SYMBOL_GPL(fw_card_release);
+ void fw_core_remove_card(struct fw_card *card)
+ {
+       struct fw_card_driver dummy_driver = dummy_driver_template;
++      unsigned long flags;
+ 
+       card->driver->update_phy_reg(card, 4,
+                                    PHY_LINK_ACTIVE | PHY_CONTENDER, 0);
+@@ -695,7 +696,9 @@ void fw_core_remove_card(struct fw_card *card)
+       dummy_driver.stop_iso           = card->driver->stop_iso;
+       card->driver = &dummy_driver;
+ 
++      spin_lock_irqsave(&card->lock, flags);
+       fw_destroy_nodes(card);
++      spin_unlock_irqrestore(&card->lock, flags);
+ 
+       /* Wait for all users, especially device workqueue jobs, to finish. */
+       fw_card_put(card);
+diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
+index d8e185582642b..bf03455b6fc20 100644
+--- a/drivers/firewire/core-cdev.c
++++ b/drivers/firewire/core-cdev.c
+@@ -1495,6 +1495,7 @@ static void outbound_phy_packet_callback(struct 
fw_packet *packet,
+ {
+       struct outbound_phy_packet_event *e =
+               container_of(packet, struct outbound_phy_packet_event, p);
++      struct client *e_client;
+ 
+       switch (status) {
+       /* expected: */
+@@ -1511,9 +1512,10 @@ static void outbound_phy_packet_callback(struct 
fw_packet *packet,
+       }
+       e->phy_packet.data[0] = packet->timestamp;
+ 
++      e_client = e->client;
+       queue_event(e->client, &e->event, &e->phy_packet,
+                   sizeof(e->phy_packet) + e->phy_packet.length, NULL, 0);
+-      client_put(e->client);
++      client_put(e_client);
+ }
+ 
+ static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg)
+diff --git a/drivers/firewire/core-topology.c 
b/drivers/firewire/core-topology.c
+index 7db234d3fbdd1..b86d144f36137 100644
+--- a/drivers/firewire/core-topology.c
++++ b/drivers/firewire/core-topology.c
+@@ -386,16 +386,13 @@ static void report_found_node(struct fw_card *card,
+       card->bm_retries = 0;
+ }
+ 
++/* Must be called with card->lock held */
+ void fw_destroy_nodes(struct fw_card *card)
+ {
+-      unsigned long flags;
+-
+-      spin_lock_irqsave(&card->lock, flags);
+       card->color++;
+       if (card->local_node != NULL)
+               for_each_fw_node(card, card->local_node, report_lost_node);
+       card->local_node = NULL;
+-      spin_unlock_irqrestore(&card->lock, flags);
+ }
+ 
+ static void move_tree(struct fw_node *node0, struct fw_node *node1, int port)
+@@ -521,6 +518,8 @@ void fw_core_handle_bus_reset(struct fw_card *card, int 
node_id, int generation,
+       struct fw_node *local_node;
+       unsigned long flags;
+ 
++      spin_lock_irqsave(&card->lock, flags);
++
+       /*
+        * If the selfID buffer is not the immediate successor of the
+        * previously processed one, we cannot reliably compare the
+@@ -532,8 +531,6 @@ void fw_core_handle_bus_reset(struct fw_card *card, int 
node_id, int generation,
+               card->bm_retries = 0;
+       }
+ 
+-      spin_lock_irqsave(&card->lock, flags);
+-
+       card->broadcast_channel_allocated = 
card->broadcast_channel_auto_allocated;
+       card->node_id = node_id;
+       /*
+diff --git a/drivers/firewire/core-transaction.c 
b/drivers/firewire/core-transaction.c
+index 4372f9e4b0dae..ce764bebb88c5 100644
+--- a/drivers/firewire/core-transaction.c
++++ b/drivers/firewire/core-transaction.c
+@@ -86,24 +86,25 @@ static int try_cancel_split_timeout(struct fw_transaction 
*t)
+ static int close_transaction(struct fw_transaction *transaction,
+                            struct fw_card *card, int rcode)
+ {
+-      struct fw_transaction *t;
++      struct fw_transaction *t = NULL, *iter;
+       unsigned long flags;
+ 
+       spin_lock_irqsave(&card->lock, flags);
+-      list_for_each_entry(t, &card->transaction_list, link) {
+-              if (t == transaction) {
+-                      if (!try_cancel_split_timeout(t)) {
++      list_for_each_entry(iter, &card->transaction_list, link) {
++              if (iter == transaction) {
++                      if (!try_cancel_split_timeout(iter)) {
+                               spin_unlock_irqrestore(&card->lock, flags);
+                               goto timed_out;
+                       }
+-                      list_del_init(&t->link);
+-                      card->tlabel_mask &= ~(1ULL << t->tlabel);
++                      list_del_init(&iter->link);
++                      card->tlabel_mask &= ~(1ULL << iter->tlabel);
++                      t = iter;
+                       break;
+               }
+       }
+       spin_unlock_irqrestore(&card->lock, flags);
+ 
+-      if (&t->link != &card->transaction_list) {
++      if (t) {
+               t->callback(card, rcode, NULL, 0, t->callback_data);
+               return 0;
+       }
+@@ -938,7 +939,7 @@ EXPORT_SYMBOL(fw_core_handle_request);
+ 
+ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
+ {
+-      struct fw_transaction *t;
++      struct fw_transaction *t = NULL, *iter;
+       unsigned long flags;
+       u32 *data;
+       size_t data_length;
+@@ -950,20 +951,21 @@ void fw_core_handle_response(struct fw_card *card, 
struct fw_packet *p)
+       rcode   = HEADER_GET_RCODE(p->header[1]);
+ 
+       spin_lock_irqsave(&card->lock, flags);
+-      list_for_each_entry(t, &card->transaction_list, link) {
+-              if (t->node_id == source && t->tlabel == tlabel) {
+-                      if (!try_cancel_split_timeout(t)) {
++      list_for_each_entry(iter, &card->transaction_list, link) {
++              if (iter->node_id == source && iter->tlabel == tlabel) {
++                      if (!try_cancel_split_timeout(iter)) {
+                               spin_unlock_irqrestore(&card->lock, flags);
+                               goto timed_out;
+                       }
+-                      list_del_init(&t->link);
+-                      card->tlabel_mask &= ~(1ULL << t->tlabel);
++                      list_del_init(&iter->link);
++                      card->tlabel_mask &= ~(1ULL << iter->tlabel);
++                      t = iter;
+                       break;
+               }
+       }
+       spin_unlock_irqrestore(&card->lock, flags);
+ 
+-      if (&t->link == &card->transaction_list) {
++      if (!t) {
+  timed_out:
+               fw_notice(card, "unsolicited response (source %x, tlabel %x)\n",
+                         source, tlabel);
+diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
+index 6bac03999fd49..d418a71faf0b1 100644
+--- a/drivers/firewire/sbp2.c
++++ b/drivers/firewire/sbp2.c
+@@ -421,7 +421,7 @@ static void sbp2_status_write(struct fw_card *card, struct 
fw_request *request,
+                             void *payload, size_t length, void *callback_data)
+ {
+       struct sbp2_logical_unit *lu = callback_data;
+-      struct sbp2_orb *orb;
++      struct sbp2_orb *orb = NULL, *iter;
+       struct sbp2_status status;
+       unsigned long flags;
+ 
+@@ -446,17 +446,18 @@ static void sbp2_status_write(struct fw_card *card, 
struct fw_request *request,
+ 
+       /* Lookup the orb corresponding to this status write. */
+       spin_lock_irqsave(&lu->tgt->lock, flags);
+-      list_for_each_entry(orb, &lu->orb_list, link) {
++      list_for_each_entry(iter, &lu->orb_list, link) {
+               if (STATUS_GET_ORB_HIGH(status) == 0 &&
+-                  STATUS_GET_ORB_LOW(status) == orb->request_bus) {
+-                      orb->rcode = RCODE_COMPLETE;
+-                      list_del(&orb->link);
++                  STATUS_GET_ORB_LOW(status) == iter->request_bus) {
++                      iter->rcode = RCODE_COMPLETE;
++                      list_del(&iter->link);
++                      orb = iter;
+                       break;
+               }
+       }
+       spin_unlock_irqrestore(&lu->tgt->lock, flags);
+ 
+-      if (&orb->link != &lu->orb_list) {
++      if (orb) {
+               orb->callback(orb, &status);
+               kref_put(&orb->kref, free_orb); /* orb callback reference */
+       } else {
+diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
+index e0f149bdf98ff..09999e3e3109e 100644
+--- a/drivers/gpio/gpiolib-of.c
++++ b/drivers/gpio/gpiolib-of.c
+@@ -525,7 +525,7 @@ static void of_gpiochip_init_valid_mask(struct gpio_chip 
*chip)
+                                          i, &start);
+               of_property_read_u32_index(np, "gpio-reserved-ranges",
+                                          i + 1, &count);
+-              if (start >= chip->ngpio || start + count >= chip->ngpio)
++              if (start >= chip->ngpio || start + count > chip->ngpio)
+                       continue;
+ 
+               bitmap_clear(chip->valid_mask, start, count);
+diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
+index 1c1a435d354bc..56ed771032c2f 100644
+--- a/drivers/gpu/drm/vgem/vgem_drv.c
++++ b/drivers/gpu/drm/vgem/vgem_drv.c
+@@ -189,9 +189,10 @@ static struct drm_gem_object *vgem_gem_create(struct 
drm_device *dev,
+               return ERR_CAST(obj);
+ 
+       ret = drm_gem_handle_create(file, &obj->base, handle);
+-      drm_gem_object_put_unlocked(&obj->base);
+-      if (ret)
++      if (ret) {
++              drm_gem_object_put_unlocked(&obj->base);
+               return ERR_PTR(ret);
++      }
+ 
+       return &obj->base;
+ }
+@@ -214,7 +215,9 @@ static int vgem_gem_dumb_create(struct drm_file *file, 
struct drm_device *dev,
+       args->size = gem_object->size;
+       args->pitch = pitch;
+ 
+-      DRM_DEBUG_DRIVER("Created object of size %lld\n", size);
++      drm_gem_object_put_unlocked(gem_object);
++
++      DRM_DEBUG_DRIVER("Created object of size %llu\n", args->size);
+ 
+       return 0;
+ }
+diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
+index 2cd920751441d..6876e3817850d 100644
+--- a/drivers/hwmon/adt7470.c
++++ b/drivers/hwmon/adt7470.c
+@@ -33,6 +33,7 @@
+ #include <linux/kthread.h>
+ #include <linux/slab.h>
+ #include <linux/util_macros.h>
++#include <linux/sched.h>
+ 
+ /* Addresses to scan */
+ static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END 
};
+@@ -273,11 +274,10 @@ static int adt7470_update_thread(void *p)
+               adt7470_read_temperatures(client, data);
+               mutex_unlock(&data->lock);
+ 
+-              set_current_state(TASK_INTERRUPTIBLE);
+               if (kthread_should_stop())
+                       break;
+ 
+-              schedule_timeout(msecs_to_jiffies(data->auto_update_interval));
++              
schedule_timeout_interruptible(msecs_to_jiffies(data->auto_update_interval));
+       }
+ 
+       return 0;
+diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c
+index f540c0f11c132..1ebeca7e95751 100644
+--- a/drivers/iio/dac/ad5446.c
++++ b/drivers/iio/dac/ad5446.c
+@@ -171,7 +171,7 @@ static int ad5446_read_raw(struct iio_dev *indio_dev,
+ 
+       switch (m) {
+       case IIO_CHAN_INFO_RAW:
+-              *val = st->cached_val;
++              *val = st->cached_val >> chan->scan_type.shift;
+               return IIO_VAL_INT;
+       case IIO_CHAN_INFO_SCALE:
+               *val = st->vref_mv;
+diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c
+index 7549abd544c0f..8011245a01d77 100644
+--- a/drivers/iio/dac/ad5592r-base.c
++++ b/drivers/iio/dac/ad5592r-base.c
+@@ -531,7 +531,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st)
+               if (!ret)
+                       st->channel_modes[reg] = tmp;
+ 
+-              fwnode_property_read_u32(child, "adi,off-state", &tmp);
++              ret = fwnode_property_read_u32(child, "adi,off-state", &tmp);
+               if (!ret)
+                       st->channel_offstate[reg] = tmp;
+       }
+diff --git a/drivers/iio/magnetometer/ak8975.c 
b/drivers/iio/magnetometer/ak8975.c
+index 379aa7f4a8041..3303feb54984a 100644
+--- a/drivers/iio/magnetometer/ak8975.c
++++ b/drivers/iio/magnetometer/ak8975.c
+@@ -404,6 +404,7 @@ static int ak8975_power_on(const struct ak8975_data *data)
+       if (ret) {
+               dev_warn(&data->client->dev,
+                        "Failed to enable specified Vid supply\n");
++              regulator_disable(data->vdd);
+               return ret;
+       }
+       /*
+diff --git a/drivers/md/dm.c b/drivers/md/dm.c
+index 01bf5bc925d0b..d2ee97cd7d14e 100644
+--- a/drivers/md/dm.c
++++ b/drivers/md/dm.c
+@@ -631,21 +631,20 @@ static void start_io_acct(struct dm_io *io)
+                                   false, 0, &io->stats_aux);
+ }
+ 
+-static void end_io_acct(struct dm_io *io)
++static void end_io_acct(struct mapped_device *md, struct bio *bio,
++                      unsigned long start_time, struct dm_stats_aux 
*stats_aux)
+ {
+-      struct mapped_device *md = io->md;
+-      struct bio *bio = io->orig_bio;
+-      unsigned long duration = jiffies - io->start_time;
++      unsigned long duration = jiffies - start_time;
+       int pending;
+       int rw = bio_data_dir(bio);
+ 
+       generic_end_io_acct(md->queue, bio_op(bio), &dm_disk(md)->part0,
+-                          io->start_time);
++                          start_time);
+ 
+       if (unlikely(dm_stats_used(&md->stats)))
+               dm_stats_account_io(&md->stats, bio_data_dir(bio),
+                                   bio->bi_iter.bi_sector, bio_sectors(bio),
+-                                  true, duration, &io->stats_aux);
++                                  true, duration, stats_aux);
+ 
+       /*
+        * After this is decremented the bio must not be touched if it is
+@@ -872,6 +871,8 @@ static void dec_pending(struct dm_io *io, blk_status_t 
error)
+       blk_status_t io_error;
+       struct bio *bio;
+       struct mapped_device *md = io->md;
++      unsigned long start_time = 0;
++      struct dm_stats_aux stats_aux;
+ 
+       /* Push-back supersedes any I/O errors */
+       if (unlikely(error)) {
+@@ -898,8 +899,10 @@ static void dec_pending(struct dm_io *io, blk_status_t 
error)
+ 
+               io_error = io->status;
+               bio = io->orig_bio;
+-              end_io_acct(io);
++              start_time = io->start_time;
++              stats_aux = io->stats_aux;
+               free_io(md, io);
++              end_io_acct(md, bio, start_time, &stats_aux);
+ 
+               if (io_error == BLK_STS_DM_REQUEUE)
+                       return;
+@@ -2472,6 +2475,8 @@ static int dm_wait_for_completion(struct mapped_device 
*md, long task_state)
+       }
+       finish_wait(&md->wait, &wait);
+ 
++      smp_rmb(); /* paired with atomic_dec_return in end_io_acct */
++
+       return r;
+ }
+ 
+diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c 
b/drivers/mmc/host/rtsx_pci_sdmmc.c
+index c1de8fa50fe8f..98b150c60b428 100644
+--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
++++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
+@@ -49,10 +49,7 @@ struct realtek_pci_sdmmc {
+       bool                    double_clk;
+       bool                    eject;
+       bool                    initial_mode;
+-      int                     power_state;
+-#define SDMMC_POWER_ON                1
+-#define SDMMC_POWER_OFF               0
+-
++      int                     prev_power_state;
+       int                     sg_count;
+       s32                     cookie;
+       int                     cookie_sg_count;
+@@ -914,14 +911,21 @@ static int sd_set_bus_width(struct realtek_pci_sdmmc 
*host,
+       return err;
+ }
+ 
+-static int sd_power_on(struct realtek_pci_sdmmc *host)
++static int sd_power_on(struct realtek_pci_sdmmc *host, unsigned char 
power_mode)
+ {
+       struct rtsx_pcr *pcr = host->pcr;
+       int err;
+ 
+-      if (host->power_state == SDMMC_POWER_ON)
++      if (host->prev_power_state == MMC_POWER_ON)
+               return 0;
+ 
++      if (host->prev_power_state == MMC_POWER_UP) {
++              rtsx_pci_write_register(pcr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, 0);
++              goto finish;
++      }
++
++      msleep(100);
++
+       rtsx_pci_init_cmd(pcr);
+       rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SELECT, 0x07, SD_MOD_SEL);
+       rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SHARE_MODE,
+@@ -940,11 +944,17 @@ static int sd_power_on(struct realtek_pci_sdmmc *host)
+       if (err < 0)
+               return err;
+ 
++      mdelay(1);
++
+       err = rtsx_pci_write_register(pcr, CARD_OE, SD_OUTPUT_EN, SD_OUTPUT_EN);
+       if (err < 0)
+               return err;
+ 
+-      host->power_state = SDMMC_POWER_ON;
++      /* send at least 74 clocks */
++      rtsx_pci_write_register(pcr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, 
SD_CLK_TOGGLE_EN);
++
++finish:
++      host->prev_power_state = power_mode;
+       return 0;
+ }
+ 
+@@ -953,7 +963,7 @@ static int sd_power_off(struct realtek_pci_sdmmc *host)
+       struct rtsx_pcr *pcr = host->pcr;
+       int err;
+ 
+-      host->power_state = SDMMC_POWER_OFF;
++      host->prev_power_state = MMC_POWER_OFF;
+ 
+       rtsx_pci_init_cmd(pcr);
+ 
+@@ -979,7 +989,7 @@ static int sd_set_power_mode(struct realtek_pci_sdmmc 
*host,
+       if (power_mode == MMC_POWER_OFF)
+               err = sd_power_off(host);
+       else
+-              err = sd_power_on(host);
++              err = sd_power_on(host, power_mode);
+ 
+       return err;
+ }
+@@ -1414,10 +1424,11 @@ static int rtsx_pci_sdmmc_drv_probe(struct 
platform_device *pdev)
+ 
+       host = mmc_priv(mmc);
+       host->pcr = pcr;
++      mmc->ios.power_delay_ms = 5;
+       host->mmc = mmc;
+       host->pdev = pdev;
+       host->cookie = -1;
+-      host->power_state = SDMMC_POWER_OFF;
++      host->prev_power_state = MMC_POWER_OFF;
+       INIT_WORK(&host->work, sd_request);
+       platform_set_drvdata(pdev, host);
+       pcr->slots[RTSX_SD_CARD].p_dev = pdev;
+diff --git a/drivers/mtd/nand/raw/mtk_ecc.c b/drivers/mtd/nand/raw/mtk_ecc.c
+index 6432bd70c3b39..9e4a78a808028 100644
+--- a/drivers/mtd/nand/raw/mtk_ecc.c
++++ b/drivers/mtd/nand/raw/mtk_ecc.c
+@@ -51,6 +51,7 @@
+ 
+ struct mtk_ecc_caps {
+       u32 err_mask;
++      u32 err_shift;
+       const u8 *ecc_strength;
+       const u32 *ecc_regs;
+       u8 num_ecc_strength;
+@@ -84,7 +85,7 @@ static const u8 ecc_strength_mt2712[] = {
+ };
+ 
+ static const u8 ecc_strength_mt7622[] = {
+-      4, 6, 8, 10, 12, 14, 16
++      4, 6, 8, 10, 12
+ };
+ 
+ enum mtk_ecc_regs {
+@@ -229,7 +230,7 @@ void mtk_ecc_get_stats(struct mtk_ecc *ecc, struct 
mtk_ecc_stats *stats,
+       for (i = 0; i < sectors; i++) {
+               offset = (i >> 2) << 2;
+               err = readl(ecc->regs + ECC_DECENUM0 + offset);
+-              err = err >> ((i % 4) * 8);
++              err = err >> ((i % 4) * ecc->caps->err_shift);
+               err &= ecc->caps->err_mask;
+               if (err == ecc->caps->err_mask) {
+                       /* uncorrectable errors */
+@@ -453,6 +454,7 @@ EXPORT_SYMBOL(mtk_ecc_get_parity_bits);
+ 
+ static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = {
+       .err_mask = 0x3f,
++      .err_shift = 8,
+       .ecc_strength = ecc_strength_mt2701,
+       .ecc_regs = mt2701_ecc_regs,
+       .num_ecc_strength = 20,
+@@ -463,6 +465,7 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = {
+ 
+ static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = {
+       .err_mask = 0x7f,
++      .err_shift = 8,
+       .ecc_strength = ecc_strength_mt2712,
+       .ecc_regs = mt2712_ecc_regs,
+       .num_ecc_strength = 23,
+@@ -472,10 +475,11 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = {
+ };
+ 
+ static const struct mtk_ecc_caps mtk_ecc_caps_mt7622 = {
+-      .err_mask = 0x3f,
++      .err_mask = 0x1f,
++      .err_shift = 5,
+       .ecc_strength = ecc_strength_mt7622,
+       .ecc_regs = mt7622_ecc_regs,
+-      .num_ecc_strength = 7,
++      .num_ecc_strength = 5,
+       .ecc_mode_shift = 4,
+       .parity_bits = 13,
+       .pg_irq_sel = 0,
+diff --git a/drivers/mtd/nand/raw/sh_flctl.c b/drivers/mtd/nand/raw/sh_flctl.c
+index 683df1a12989c..07ba149fa9715 100644
+--- a/drivers/mtd/nand/raw/sh_flctl.c
++++ b/drivers/mtd/nand/raw/sh_flctl.c
+@@ -399,7 +399,8 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl 
*flctl, unsigned long *buf,
+       dma_addr_t dma_addr;
+       dma_cookie_t cookie;
+       uint32_t reg;
+-      int ret;
++      int ret = 0;
++      unsigned long time_left;
+ 
+       if (dir == DMA_FROM_DEVICE) {
+               chan = flctl->chan_fifo0_rx;
+@@ -440,13 +441,14 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl 
*flctl, unsigned long *buf,
+               goto out;
+       }
+ 
+-      ret =
++      time_left =
+       wait_for_completion_timeout(&flctl->dma_complete,
+                               msecs_to_jiffies(3000));
+ 
+-      if (ret <= 0) {
++      if (time_left == 0) {
+               dmaengine_terminate_all(chan);
+               dev_err(&flctl->pdev->dev, "wait_for_completion_timeout\n");
++              ret = -ETIMEDOUT;
+       }
+ 
+ out:
+@@ -456,7 +458,7 @@ out:
+ 
+       dma_unmap_single(chan->device->dev, dma_addr, len, dir);
+ 
+-      /* ret > 0 is success */
++      /* ret == 0 is success */
+       return ret;
+ }
+ 
+@@ -480,7 +482,7 @@ static void read_fiforeg(struct sh_flctl *flctl, int rlen, 
int offset)
+ 
+       /* initiate DMA transfer */
+       if (flctl->chan_fifo0_rx && rlen >= 32 &&
+-              flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE) > 0)
++              !flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE))
+                       goto convert;   /* DMA success */
+ 
+       /* do polling transfer */
+@@ -539,7 +541,7 @@ static void write_ec_fiforeg(struct sh_flctl *flctl, int 
rlen,
+ 
+       /* initiate DMA transfer */
+       if (flctl->chan_fifo0_tx && rlen >= 32 &&
+-              flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE) > 0)
++              !flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE))
+                       return; /* DMA success */
+ 
+       /* do polling transfer */
+diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
+index 7eec1d9f86a05..5784c34ba46e8 100644
+--- a/drivers/net/can/grcan.c
++++ b/drivers/net/can/grcan.c
+@@ -252,6 +252,7 @@ struct grcan_device_config {
+ struct grcan_priv {
+       struct can_priv can;    /* must be the first member */
+       struct net_device *dev;
++      struct device *ofdev_dev;
+       struct napi_struct napi;
+ 
+       struct grcan_registers __iomem *regs;   /* ioremap'ed registers */
+@@ -928,7 +929,7 @@ static void grcan_free_dma_buffers(struct net_device *dev)
+       struct grcan_priv *priv = netdev_priv(dev);
+       struct grcan_dma *dma = &priv->dma;
+ 
+-      dma_free_coherent(&dev->dev, dma->base_size, dma->base_buf,
++      dma_free_coherent(priv->ofdev_dev, dma->base_size, dma->base_buf,
+                         dma->base_handle);
+       memset(dma, 0, sizeof(*dma));
+ }
+@@ -953,7 +954,7 @@ static int grcan_allocate_dma_buffers(struct net_device 
*dev,
+ 
+       /* Extra GRCAN_BUFFER_ALIGNMENT to allow for alignment */
+       dma->base_size = lsize + ssize + GRCAN_BUFFER_ALIGNMENT;
+-      dma->base_buf = dma_alloc_coherent(&dev->dev,
++      dma->base_buf = dma_alloc_coherent(priv->ofdev_dev,
+                                          dma->base_size,
+                                          &dma->base_handle,
+                                          GFP_KERNEL);
+@@ -1117,8 +1118,10 @@ static int grcan_close(struct net_device *dev)
+ 
+       priv->closing = true;
+       if (priv->need_txbug_workaround) {
++              spin_unlock_irqrestore(&priv->lock, flags);
+               del_timer_sync(&priv->hang_timer);
+               del_timer_sync(&priv->rr_timer);
++              spin_lock_irqsave(&priv->lock, flags);
+       }
+       netif_stop_queue(dev);
+       grcan_stop_hardware(dev);
+@@ -1604,6 +1607,7 @@ static int grcan_setup_netdev(struct platform_device 
*ofdev,
+       memcpy(&priv->config, &grcan_module_config,
+              sizeof(struct grcan_device_config));
+       priv->dev = dev;
++      priv->ofdev_dev = &ofdev->dev;
+       priv->regs = base;
+       priv->can.bittiming_const = &grcan_bittiming_const;
+       priv->can.do_set_bittiming = grcan_set_bittiming;
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+index df4f77ad95c4a..91ddde4d647c6 100644
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+@@ -14297,10 +14297,6 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
+ 
+       /* Stop Tx */
+       bnx2x_tx_disable(bp);
+-      /* Delete all NAPI objects */
+-      bnx2x_del_all_napi(bp);
+-      if (CNIC_LOADED(bp))
+-              bnx2x_del_all_napi_cnic(bp);
+       netdev_reset_tc(bp->dev);
+ 
+       del_timer_sync(&bp->timer);
+@@ -14405,6 +14401,11 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct 
pci_dev *pdev)
+               bnx2x_drain_tx_queues(bp);
+               bnx2x_send_unload_req(bp, UNLOAD_RECOVERY);
+               bnx2x_netif_stop(bp, 1);
++              bnx2x_del_all_napi(bp);
++
++              if (CNIC_LOADED(bp))
++                      bnx2x_del_all_napi_cnic(bp);
++
+               bnx2x_free_irq(bp);
+ 
+               /* Report UNLOAD_DONE to MCP */
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c 
b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+index d4be107ea4cdf..96ef2dd46c78c 100644
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+@@ -1549,6 +1549,11 @@ static struct sk_buff *bcmgenet_put_tx_csum(struct 
net_device *dev,
+       return skb;
+ }
+ 
++static void bcmgenet_hide_tsb(struct sk_buff *skb)
++{
++      __skb_pull(skb, sizeof(struct status_64));
++}
++
+ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
+ {
+       struct bcmgenet_priv *priv = netdev_priv(dev);
+@@ -1657,6 +1662,8 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, 
struct net_device *dev)
+       }
+ 
+       GENET_CB(skb)->last_cb = tx_cb_ptr;
++
++      bcmgenet_hide_tsb(skb);
+       skb_tx_timestamp(skb);
+ 
+       /* Decrement total BD count and advance our write pointer */
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c 
b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+index 997ca79ed892b..7e49188c3009d 100644
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+@@ -60,6 +60,13 @@ static int hclge_send_mbx_msg(struct hclge_vport *vport, u8 
*msg, u16 msg_len,
+       enum hclge_cmd_status status;
+       struct hclge_desc desc;
+ 
++      if (msg_len > HCLGE_MBX_MAX_MSG_SIZE) {
++              dev_err(&hdev->pdev->dev,
++                      "msg data length(=%u) exceeds maximum(=%u)\n",
++                      msg_len, HCLGE_MBX_MAX_MSG_SIZE);
++              return -EMSGSIZE;
++      }
++
+       resp_pf_to_vf = (struct hclge_mbx_pf_to_vf_cmd *)desc.data;
+ 
+       hclge_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_PF_TO_VF, false);
+diff --git a/drivers/net/ethernet/smsc/smsc911x.c 
b/drivers/net/ethernet/smsc/smsc911x.c
+index ae80a223975db..f977fc59dc5ca 100644
+--- a/drivers/net/ethernet/smsc/smsc911x.c
++++ b/drivers/net/ethernet/smsc/smsc911x.c
+@@ -2446,7 +2446,7 @@ static int smsc911x_drv_probe(struct platform_device 
*pdev)
+       if (irq == -EPROBE_DEFER) {
+               retval = -EPROBE_DEFER;
+               goto out_0;
+-      } else if (irq <= 0) {
++      } else if (irq < 0) {
+               pr_warn("Could not allocate irq resource\n");
+               retval = -ENODEV;
+               goto out_0;
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c 
b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+index 0137cba2cb54b..5e66e73998274 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+@@ -873,6 +873,7 @@ static int sun8i_dwmac_register_mdio_mux(struct 
stmmac_priv *priv)
+ 
+       ret = mdio_mux_init(priv->device, mdio_mux, mdio_mux_syscon_switch_fn,
+                           &gmac->mux_handle, priv, priv->mii);
++      of_node_put(mdio_mux);
+       return ret;
+ }
+ 
+diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c 
b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+index 23a4f9061072b..4e1504587895a 100644
+--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
++++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+@@ -827,10 +827,10 @@ static int xemaclite_mdio_write(struct mii_bus *bus, int 
phy_id, int reg,
+ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
+ {
+       struct mii_bus *bus;
+-      int rc;
+       struct resource res;
+       struct device_node *np = of_get_parent(lp->phy_node);
+       struct device_node *npp;
++      int rc, ret;
+ 
+       /* Don't register the MDIO bus if the phy_node or its parent node
+        * can't be found.
+@@ -840,8 +840,14 @@ static int xemaclite_mdio_setup(struct net_local *lp, 
struct device *dev)
+               return -ENODEV;
+       }
+       npp = of_get_parent(np);
+-
+-      of_address_to_resource(npp, 0, &res);
++      ret = of_address_to_resource(npp, 0, &res);
++      of_node_put(npp);
++      if (ret) {
++              dev_err(dev, "%s resource error!\n",
++                      dev->of_node->full_name);
++              of_node_put(np);
++              return ret;
++      }
+       if (lp->ndev->mem_start != res.start) {
+               struct phy_device *phydev;
+               phydev = of_phy_find_device(lp->phy_node);
+@@ -850,6 +856,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, 
struct device *dev)
+                                "MDIO of the phy is not registered yet\n");
+               else
+                       put_device(&phydev->mdio.dev);
++              of_node_put(np);
+               return 0;
+       }
+ 
+@@ -862,6 +869,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, 
struct device *dev)
+       bus = mdiobus_alloc();
+       if (!bus) {
+               dev_err(dev, "Failed to allocate mdiobus\n");
++              of_node_put(np);
+               return -ENOMEM;
+       }
+ 
+@@ -874,6 +882,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, 
struct device *dev)
+       bus->parent = dev;
+ 
+       rc = of_mdiobus_register(bus, np);
++      of_node_put(np);
+       if (rc) {
+               dev_err(dev, "Failed to register mdio bus.\n");
+               goto err_register;
+diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
+index 2a8c33abb363a..a24c55a6c79a1 100644
+--- a/drivers/net/hippi/rrunner.c
++++ b/drivers/net/hippi/rrunner.c
+@@ -1352,7 +1352,9 @@ static int rr_close(struct net_device *dev)
+ 
+       rrpriv->fw_running = 0;
+ 
++      spin_unlock_irqrestore(&rrpriv->lock, flags);
+       del_timer_sync(&rrpriv->timer);
++      spin_lock_irqsave(&rrpriv->lock, flags);
+ 
+       writel(0, &regs->TxPi);
+       writel(0, &regs->IpRxPi);
+diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
+index 529be35ac1782..54d228acc0f5d 100644
+--- a/drivers/nfc/nfcmrvl/main.c
++++ b/drivers/nfc/nfcmrvl/main.c
+@@ -194,6 +194,7 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private 
*priv)
+ {
+       struct nci_dev *ndev = priv->ndev;
+ 
++      nci_unregister_device(ndev);
+       if (priv->ndev->nfc_dev->fw_download_in_progress)
+               nfcmrvl_fw_dnld_abort(priv);
+ 
+@@ -202,7 +203,6 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private 
*priv)
+       if (gpio_is_valid(priv->config.reset_n_io))
+               gpio_free(priv->config.reset_n_io);
+ 
+-      nci_unregister_device(ndev);
+       nci_free_device(ndev);
+       kfree(priv);
+ }
+diff --git a/drivers/pci/controller/pci-aardvark.c 
b/drivers/pci/controller/pci-aardvark.c
+index db778a25bae36..a5bc529e9e826 100644
+--- a/drivers/pci/controller/pci-aardvark.c
++++ b/drivers/pci/controller/pci-aardvark.c
+@@ -103,6 +103,7 @@
+ #define PCIE_MSI_ADDR_HIGH_REG                        (CONTROL_BASE_ADDR + 
0x54)
+ #define PCIE_MSI_STATUS_REG                   (CONTROL_BASE_ADDR + 0x58)
+ #define PCIE_MSI_MASK_REG                     (CONTROL_BASE_ADDR + 0x5C)
++#define     PCIE_MSI_ALL_MASK                 GENMASK(31, 0)
+ #define PCIE_MSI_PAYLOAD_REG                  (CONTROL_BASE_ADDR + 0x9C)
+ #define     PCIE_MSI_DATA_MASK                        GENMASK(15, 0)
+ 
+@@ -489,6 +490,7 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie)
+       advk_writel(pcie, reg, PCIE_CORE_CTRL2_REG);
+ 
+       /* Clear all interrupts */
++      advk_writel(pcie, PCIE_MSI_ALL_MASK, PCIE_MSI_STATUS_REG);
+       advk_writel(pcie, PCIE_ISR0_ALL_MASK, PCIE_ISR0_REG);
+       advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_REG);
+       advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_STATUS_REG);
+@@ -501,7 +503,7 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie)
+       advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_MASK_REG);
+ 
+       /* Unmask all MSI's */
+-      advk_writel(pcie, 0, PCIE_MSI_MASK_REG);
++      advk_writel(pcie, ~(u32)PCIE_MSI_ALL_MASK, PCIE_MSI_MASK_REG);
+ 
+       /* Enable summary interrupt for GIC SPI source */
+       reg = PCIE_IRQ_ALL_MASK & (~PCIE_IRQ_ENABLE_INTS_MASK);
+@@ -1033,23 +1035,19 @@ static void advk_pcie_remove_irq_domain(struct 
advk_pcie *pcie)
+ static void advk_pcie_handle_msi(struct advk_pcie *pcie)
+ {
+       u32 msi_val, msi_mask, msi_status, msi_idx;
+-      u16 msi_data;
++      int virq;
+ 
+       msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG);
+       msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG);
+-      msi_status = msi_val & ~msi_mask;
++      msi_status = msi_val & ((~msi_mask) & PCIE_MSI_ALL_MASK);
+ 
+       for (msi_idx = 0; msi_idx < MSI_IRQ_NUM; msi_idx++) {
+               if (!(BIT(msi_idx) & msi_status))
+                       continue;
+ 
+-              /*
+-               * msi_idx contains bits [4:0] of the msi_data and msi_data
+-               * contains 16bit MSI interrupt number
+-               */
+               advk_writel(pcie, BIT(msi_idx), PCIE_MSI_STATUS_REG);
+-              msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & 
PCIE_MSI_DATA_MASK;
+-              generic_handle_irq(msi_data);
++              virq = irq_find_mapping(pcie->msi_inner_domain, msi_idx);
++              generic_handle_irq(virq);
+       }
+ 
+       advk_writel(pcie, PCIE_ISR0_MSI_INT_PENDING,
+diff --git a/drivers/phy/samsung/phy-exynos5250-sata.c 
b/drivers/phy/samsung/phy-exynos5250-sata.c
+index 60e13afcd9b84..2c39d2fd3cd80 100644
+--- a/drivers/phy/samsung/phy-exynos5250-sata.c
++++ b/drivers/phy/samsung/phy-exynos5250-sata.c
+@@ -193,6 +193,7 @@ static int exynos_sata_phy_probe(struct platform_device 
*pdev)
+               return -EINVAL;
+ 
+       sata_phy->client = of_find_i2c_device_by_node(node);
++      of_node_put(node);
+       if (!sata_phy->client)
+               return -EPROBE_DEFER;
+ 
+@@ -201,20 +202,21 @@ static int exynos_sata_phy_probe(struct platform_device 
*pdev)
+       sata_phy->phyclk = devm_clk_get(dev, "sata_phyctrl");
+       if (IS_ERR(sata_phy->phyclk)) {
+               dev_err(dev, "failed to get clk for PHY\n");
+-              return PTR_ERR(sata_phy->phyclk);
++              ret = PTR_ERR(sata_phy->phyclk);
++              goto put_dev;
+       }
+ 
+       ret = clk_prepare_enable(sata_phy->phyclk);
+       if (ret < 0) {
+               dev_err(dev, "failed to enable source clk\n");
+-              return ret;
++              goto put_dev;
+       }
+ 
+       sata_phy->phy = devm_phy_create(dev, NULL, &exynos_sata_phy_ops);
+       if (IS_ERR(sata_phy->phy)) {
+-              clk_disable_unprepare(sata_phy->phyclk);
+               dev_err(dev, "failed to create PHY\n");
+-              return PTR_ERR(sata_phy->phy);
++              ret = PTR_ERR(sata_phy->phy);
++              goto clk_disable;
+       }
+ 
+       phy_set_drvdata(sata_phy->phy, sata_phy);
+@@ -222,11 +224,18 @@ static int exynos_sata_phy_probe(struct platform_device 
*pdev)
+       phy_provider = devm_of_phy_provider_register(dev,
+                                       of_phy_simple_xlate);
+       if (IS_ERR(phy_provider)) {
+-              clk_disable_unprepare(sata_phy->phyclk);
+-              return PTR_ERR(phy_provider);
++              ret = PTR_ERR(phy_provider);
++              goto clk_disable;
+       }
+ 
+       return 0;
++
++clk_disable:
++      clk_disable_unprepare(sata_phy->phyclk);
++put_dev:
++      put_device(&sata_phy->client->dev);
++
++      return ret;
+ }
+ 
+ static const struct of_device_id exynos_sata_phy_of_match[] = {
+diff --git a/drivers/pinctrl/pinctrl-pistachio.c 
b/drivers/pinctrl/pinctrl-pistachio.c
+index 0d7d379e9bb80..fb7340ad15b3b 100644
+--- a/drivers/pinctrl/pinctrl-pistachio.c
++++ b/drivers/pinctrl/pinctrl-pistachio.c
+@@ -1374,10 +1374,10 @@ static int pistachio_gpio_register(struct 
pistachio_pinctrl *pctl)
+               }
+ 
+               irq = irq_of_parse_and_map(child, 0);
+-              if (irq < 0) {
+-                      dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq);
++              if (!irq) {
++                      dev_err(pctl->dev, "No IRQ for bank %u\n", i);
+                       of_node_put(child);
+-                      ret = irq;
++                      ret = -EINVAL;
+                       goto err;
+               }
+ 
+diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
+index 4d581140b7a47..5d2bb4d95186f 100644
+--- a/drivers/tty/n_gsm.c
++++ b/drivers/tty/n_gsm.c
+@@ -72,6 +72,8 @@ module_param(debug, int, 0600);
+  */
+ #define MAX_MRU 1500
+ #define MAX_MTU 1500
++/* SOF, ADDR, CTRL, LEN1, LEN2, ..., FCS, EOF */
++#define PROT_OVERHEAD 7
+ #define       GSM_NET_TX_TIMEOUT (HZ*10)
+ 
+ /**
+@@ -823,7 +825,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, 
struct gsm_dlci *dlci)
+                       break;
+               case 2: /* Unstructed with modem bits.
+               Always one byte as we never send inline break data */
+-                      *dp++ = gsm_encode_modem(dlci);
++                      *dp++ = (gsm_encode_modem(dlci) << 1) | EA;
+                       break;
+               }
+               WARN_ON(kfifo_out_locked(dlci->fifo, dp , len, &dlci->lock) != 
len);
+@@ -1300,11 +1302,12 @@ static void gsm_control_response(struct gsm_mux *gsm, 
unsigned int command,
+ 
+ static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control 
*ctrl)
+ {
+-      struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, gsm->ftype);
++      struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 2, gsm->ftype);
+       if (msg == NULL)
+               return;
+-      msg->data[0] = (ctrl->cmd << 1) | 2 | EA;       /* command */
+-      memcpy(msg->data + 1, ctrl->data, ctrl->len);
++      msg->data[0] = (ctrl->cmd << 1) | CR | EA;      /* command */
++      msg->data[1] = (ctrl->len << 1) | EA;
++      memcpy(msg->data + 2, ctrl->data, ctrl->len);
+       gsm_data_queue(gsm->dlci[0], msg);
+ }
+ 
+@@ -1327,7 +1330,6 @@ static void gsm_control_retransmit(struct timer_list *t)
+       spin_lock_irqsave(&gsm->control_lock, flags);
+       ctrl = gsm->pending_cmd;
+       if (ctrl) {
+-              gsm->cretries--;
+               if (gsm->cretries == 0) {
+                       gsm->pending_cmd = NULL;
+                       ctrl->error = -ETIMEDOUT;
+@@ -1336,6 +1338,7 @@ static void gsm_control_retransmit(struct timer_list *t)
+                       wake_up(&gsm->event);
+                       return;
+               }
++              gsm->cretries--;
+               gsm_control_transmit(gsm, ctrl);
+               mod_timer(&gsm->t2_timer, jiffies + gsm->t2 * HZ / 100);
+       }
+@@ -1376,7 +1379,7 @@ retry:
+ 
+       /* If DLCI0 is in ADM mode skip retries, it won't respond */
+       if (gsm->dlci[0]->mode == DLCI_MODE_ADM)
+-              gsm->cretries = 1;
++              gsm->cretries = 0;
+       else
+               gsm->cretries = gsm->n2;
+ 
+@@ -1808,7 +1811,6 @@ static void gsm_queue(struct gsm_mux *gsm)
+               gsm_response(gsm, address, UA);
+               gsm_dlci_close(dlci);
+               break;
+-      case UA:
+       case UA|PF:
+               if (cr == 0 || dlci == NULL)
+                       break;
+@@ -1959,7 +1961,8 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned 
char c)
+               }
+               /* Any partial frame was a runt so go back to start */
+               if (gsm->state != GSM_START) {
+-                      gsm->malformed++;
++                      if (gsm->state != GSM_SEARCH)
++                              gsm->malformed++;
+                       gsm->state = GSM_START;
+               }
+               /* A SOF in GSM_START means we are still reading idling or
+@@ -2096,6 +2099,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm)
+                       gsm_dlci_release(gsm->dlci[i]);
+       mutex_unlock(&gsm->mutex);
+       /* Now wipe the queues */
++      tty_ldisc_flush(gsm->tty);
+       list_for_each_entry_safe(txq, ntxq, &gsm->tx_list, list)
+               kfree(txq);
+       INIT_LIST_HEAD(&gsm->tx_list);
+@@ -2196,7 +2200,7 @@ static struct gsm_mux *gsm_alloc_mux(void)
+               kfree(gsm);
+               return NULL;
+       }
+-      gsm->txframe = kmalloc(2 * MAX_MRU + 2, GFP_KERNEL);
++      gsm->txframe = kmalloc(2 * (MAX_MTU + PROT_OVERHEAD - 1), GFP_KERNEL);
+       if (gsm->txframe == NULL) {
+               kfree(gsm->buf);
+               kfree(gsm);
+@@ -2513,7 +2517,7 @@ static int gsmld_config(struct tty_struct *tty, struct 
gsm_mux *gsm,
+       /* Check the MRU/MTU range looks sane */
+       if (c->mru > MAX_MRU || c->mtu > MAX_MTU || c->mru < 8 || c->mtu < 8)
+               return -EINVAL;
+-      if (c->n2 < 3)
++      if (c->n2 > 255)
+               return -EINVAL;
+       if (c->encapsulation > 1)       /* Basic, advanced, no I */
+               return -EINVAL;
+@@ -2856,19 +2860,17 @@ static struct tty_ldisc_ops tty_ldisc_packet = {
+ 
+ static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk)
+ {
+-      u8 modembits[5];
++      u8 modembits[3];
+       struct gsm_control *ctrl;
+       int len = 2;
+ 
+-      if (brk)
++      modembits[0] = (dlci->addr << 2) | 2 | EA;  /* DLCI, Valid, EA */
++      modembits[1] = (gsm_encode_modem(dlci) << 1) | EA;
++      if (brk) {
++              modembits[2] = (brk << 4) | 2 | EA; /* Length, Break, EA */
+               len++;
+-
+-      modembits[0] = len << 1 | EA;           /* Data bytes */
+-      modembits[1] = dlci->addr << 2 | 3;     /* DLCI, EA, 1 */
+-      modembits[2] = gsm_encode_modem(dlci) << 1 | EA;
+-      if (brk)
+-              modembits[3] = brk << 4 | 2 | EA;       /* Valid, EA */
+-      ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len + 1);
++      }
++      ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len);
+       if (ctrl == NULL)
+               return -ENOMEM;
+       return gsm_control_wait(dlci->gsm, ctrl);
+diff --git a/drivers/tty/serial/8250/8250_pci.c 
b/drivers/tty/serial/8250/8250_pci.c
+index 173885837e77f..fd9dd800e1a6a 100644
+--- a/drivers/tty/serial/8250/8250_pci.c
++++ b/drivers/tty/serial/8250/8250_pci.c
+@@ -2656,7 +2656,7 @@ enum pci_board_num_t {
+       pbn_panacom2,
+       pbn_panacom4,
+       pbn_plx_romulus,
+-      pbn_endrun_2_4000000,
++      pbn_endrun_2_3906250,
+       pbn_oxsemi,
+       pbn_oxsemi_1_4000000,
+       pbn_oxsemi_2_4000000,
+@@ -3172,10 +3172,10 @@ static struct pciserial_board pci_boards[] = {
+       * signal now many ports are available
+       * 2 port 952 Uart support
+       */
+-      [pbn_endrun_2_4000000] = {
++      [pbn_endrun_2_3906250] = {
+               .flags          = FL_BASE0,
+               .num_ports      = 2,
+-              .base_baud      = 4000000,
++              .base_baud      = 3906250,
+               .uart_offset    = 0x200,
+               .first_offset   = 0x1000,
+       },
+@@ -4028,7 +4028,7 @@ static const struct pci_device_id serial_pci_tbl[] = {
+       */
+       {       PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+-              pbn_endrun_2_4000000 },
++              pbn_endrun_2_3906250 },
+       /*
+        * Quatech cards. These actually have configurable clocks but for
+        * now we just use the default.
+diff --git a/drivers/tty/serial/8250/8250_port.c 
b/drivers/tty/serial/8250/8250_port.c
+index 5ec50ccfbec95..34687c354f5e9 100644
+--- a/drivers/tty/serial/8250/8250_port.c
++++ b/drivers/tty/serial/8250/8250_port.c
+@@ -3273,7 +3273,7 @@ static void serial8250_console_restore(struct 
uart_8250_port *up)
+ 
+       serial8250_set_divisor(port, baud, quot, frac);
+       serial_port_out(port, UART_LCR, up->lcr);
+-      serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS);
++      serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS);
+ }
+ 
+ /*
+diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
+index 7a6e26b12bf64..aeda1fe71eeba 100644
+--- a/drivers/tty/serial/imx.c
++++ b/drivers/tty/serial/imx.c
+@@ -1369,7 +1369,7 @@ static int imx_uart_startup(struct uart_port *port)
+       imx_uart_writel(sport, ucr1, UCR1);
+ 
+       ucr4 = imx_uart_readl(sport, UCR4) & ~UCR4_OREN;
+-      if (!sport->dma_is_enabled)
++      if (!dma_is_inited)
+               ucr4 |= UCR4_OREN;
+       imx_uart_writel(sport, ucr4, UCR4);
+ 
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
+index a118c44c70e1e..d5f233fa6f3b4 100644
+--- a/drivers/usb/core/quirks.c
++++ b/drivers/usb/core/quirks.c
+@@ -404,6 +404,9 @@ static const struct usb_device_id usb_quirk_list[] = {
+       { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
+                       USB_QUIRK_IGNORE_REMOTE_WAKEUP },
+ 
++      /* Realtek Semiconductor Corp. Mass Storage Device (Multicard Reader)*/
++      { USB_DEVICE(0x0bda, 0x0151), .driver_info = 
USB_QUIRK_CONFIG_INTF_STRINGS },
++
+       /* Realtek hub in Dell WD19 (Type-C) */
+       { USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM },
+       { USB_DEVICE(0x0bda, 0x5487), .driver_info = USB_QUIRK_RESET_RESUME },
+@@ -508,6 +511,9 @@ static const struct usb_device_id usb_quirk_list[] = {
+       /* DJI CineSSD */
+       { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
+ 
++      /* VCOM device */
++      { USB_DEVICE(0x4296, 0x7570), .driver_info = 
USB_QUIRK_CONFIG_INTF_STRINGS },
++
+       /* INTEL VALUE SSD */
+       { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
+ 
+diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
+index 87e38a7534581..984faecdd7ecb 100644
+--- a/drivers/usb/dwc3/core.c
++++ b/drivers/usb/dwc3/core.c
+@@ -1213,10 +1213,10 @@ static void dwc3_get_properties(struct dwc3 *dwc)
+       u8                      lpm_nyet_threshold;
+       u8                      tx_de_emphasis;
+       u8                      hird_threshold;
+-      u8                      rx_thr_num_pkt_prd;
+-      u8                      rx_max_burst_prd;
+-      u8                      tx_thr_num_pkt_prd;
+-      u8                      tx_max_burst_prd;
++      u8                      rx_thr_num_pkt_prd = 0;
++      u8                      rx_max_burst_prd = 0;
++      u8                      tx_thr_num_pkt_prd = 0;
++      u8                      tx_max_burst_prd = 0;
+ 
+       /* default to highest possible threshold */
+       lpm_nyet_threshold = 0xf;
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
+index 8620ac8e33296..8be95ca95ef97 100644
+--- a/drivers/usb/dwc3/gadget.c
++++ b/drivers/usb/dwc3/gadget.c
+@@ -2415,6 +2415,7 @@ static int 
dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
+               const struct dwc3_event_depevt *event,
+               struct dwc3_request *req, int status)
+ {
++      int request_status;
+       int ret;
+ 
+       if (req->request.num_mapped_sgs)
+@@ -2444,7 +2445,35 @@ static int 
dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
+               req->needs_extra_trb = false;
+       }
+ 
+-      dwc3_gadget_giveback(dep, req, status);
++      /*
++       * The event status only reflects the status of the TRB with IOC set.
++       * For the requests that don't set interrupt on completion, the driver
++       * needs to check and return the status of the completed TRBs associated
++       * with the request. Use the status of the last TRB of the request.
++       */
++      if (req->request.no_interrupt) {
++              struct dwc3_trb *trb;
++
++              trb = dwc3_ep_prev_trb(dep, dep->trb_dequeue);
++              switch (DWC3_TRB_SIZE_TRBSTS(trb->size)) {
++              case DWC3_TRBSTS_MISSED_ISOC:
++                      /* Isoc endpoint only */
++                      request_status = -EXDEV;
++                      break;
++              case DWC3_TRB_STS_XFER_IN_PROG:
++                      /* Applicable when End Transfer with ForceRM=0 */
++              case DWC3_TRBSTS_SETUP_PENDING:
++                      /* Control endpoint only */
++              case DWC3_TRBSTS_OK:
++              default:
++                      request_status = 0;
++                      break;
++              }
++      } else {
++              request_status = status;
++      }
++
++      dwc3_gadget_giveback(dep, req, request_status);
+ 
+ out:
+       return ret;
+diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
+index 3d4710cc34bc1..2350e97a1662c 100644
+--- a/drivers/usb/gadget/configfs.c
++++ b/drivers/usb/gadget/configfs.c
+@@ -1412,6 +1412,8 @@ static void configfs_composite_unbind(struct usb_gadget 
*gadget)
+       usb_ep_autoconfig_reset(cdev->gadget);
+       spin_lock_irqsave(&gi->spinlock, flags);
+       cdev->gadget = NULL;
++      cdev->deactivations = 0;
++      gadget->deactivated = false;
+       set_gadget_data(gadget, NULL);
+       spin_unlock_irqrestore(&gi->spinlock, flags);
+ }
+diff --git a/drivers/usb/gadget/function/uvc_queue.c 
b/drivers/usb/gadget/function/uvc_queue.c
+index 9e33d5206d54a..956341528ecaa 100644
+--- a/drivers/usb/gadget/function/uvc_queue.c
++++ b/drivers/usb/gadget/function/uvc_queue.c
+@@ -242,6 +242,8 @@ void uvcg_queue_cancel(struct uvc_video_queue *queue, int 
disconnect)
+               buf->state = UVC_BUF_STATE_ERROR;
+               vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_ERROR);
+       }
++      queue->buf_used = 0;
++
+       /* This must be protected by the irqlock spinlock to avoid race
+        * conditions between uvc_queue_buffer and the disconnection event that
+        * could result in an interruptible wait in uvc_dequeue_buffer. Do not
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
+index f5bd91752f2d2..e18b675fb7afe 100644
+--- a/drivers/usb/host/xhci-ring.c
++++ b/drivers/usb/host/xhci-ring.c
+@@ -2848,6 +2848,8 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
+               if (event_loop++ < TRBS_PER_SEGMENT / 2)
+                       continue;
+               xhci_update_erst_dequeue(xhci, event_ring_deq);
++              event_ring_deq = xhci->event_ring->dequeue;
++
+               event_loop = 0;
+       }
+ 
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
+index ab255144e5a70..a9e72fee87a77 100644
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -778,6 +778,17 @@ void xhci_shutdown(struct usb_hcd *hcd)
+       if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
+               usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev));
+ 
++      /* Don't poll the roothubs after shutdown. */
++      xhci_dbg(xhci, "%s: stopping usb%d port polling.\n",
++                      __func__, hcd->self.busnum);
++      clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
++      del_timer_sync(&hcd->rh_timer);
++
++      if (xhci->shared_hcd) {
++              clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
++              del_timer_sync(&xhci->shared_hcd->rh_timer);
++      }
++
+       spin_lock_irq(&xhci->lock);
+       xhci_halt(xhci);
+       /* Workaround for spurious wakeups at shutdown with HSW */
+diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
+index 748139d262633..0be8efcda15d5 100644
+--- a/drivers/usb/misc/uss720.c
++++ b/drivers/usb/misc/uss720.c
+@@ -71,6 +71,7 @@ static void destroy_priv(struct kref *kref)
+ 
+       dev_dbg(&priv->usbdev->dev, "destroying priv datastructure\n");
+       usb_put_dev(priv->usbdev);
++      priv->usbdev = NULL;
+       kfree(priv);
+ }
+ 
+@@ -736,7 +737,6 @@ static int uss720_probe(struct usb_interface *intf,
+       parport_announce_port(pp);
+ 
+       usb_set_intfdata(intf, pp);
+-      usb_put_dev(usbdev);
+       return 0;
+ 
+ probe_abort:
+@@ -754,7 +754,6 @@ static void uss720_disconnect(struct usb_interface *intf)
+       usb_set_intfdata(intf, NULL);
+       if (pp) {
+               priv = pp->private_data;
+-              priv->usbdev = NULL;
+               priv->pp = NULL;
+               dev_dbg(&intf->dev, "parport_remove_port\n");
+               parport_remove_port(pp);
+diff --git a/drivers/usb/mtu3/mtu3_dr.c b/drivers/usb/mtu3/mtu3_dr.c
+index ac60e9c8564e2..edca5d748f41a 100644
+--- a/drivers/usb/mtu3/mtu3_dr.c
++++ b/drivers/usb/mtu3/mtu3_dr.c
+@@ -30,10 +30,8 @@ enum mtu3_vbus_id_state {
+ 
+ static void toggle_opstate(struct ssusb_mtk *ssusb)
+ {
+-      if (!ssusb->otg_switch.is_u3_drd) {
+-              mtu3_setbits(ssusb->mac_base, U3D_DEVICE_CONTROL, DC_SESSION);
+-              mtu3_setbits(ssusb->mac_base, U3D_POWER_MANAGEMENT, SOFT_CONN);
+-      }
++      mtu3_setbits(ssusb->mac_base, U3D_DEVICE_CONTROL, DC_SESSION);
++      mtu3_setbits(ssusb->mac_base, U3D_POWER_MANAGEMENT, SOFT_CONN);
+ }
+ 
+ /* only port0 supports dual-role mode */
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
+index 452c508397b7b..95a5c73f3f787 100644
+--- a/drivers/usb/serial/cp210x.c
++++ b/drivers/usb/serial/cp210x.c
+@@ -195,6 +195,8 @@ static const struct usb_device_id id_table[] = {
+       { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML 
Control, Monitoring and Data Logger */
+       { USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */
+       { USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D 
*/
++      { USB_DEVICE(0x17A8, 0x0101) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter 
Reader (Int Ant) */
++      { USB_DEVICE(0x17A8, 0x0102) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter 
Reader (Ext Ant) */
+       { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
+       { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
+       { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
+index 37d3bc24c5cff..cf77ec17ef3f4 100644
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -432,6 +432,8 @@ static void option_instat_callback(struct urb *urb);
+ #define CINTERION_PRODUCT_CLS8                        0x00b0
+ #define CINTERION_PRODUCT_MV31_MBIM           0x00b3
+ #define CINTERION_PRODUCT_MV31_RMNET          0x00b7
++#define CINTERION_PRODUCT_MV32_WA             0x00f1
++#define CINTERION_PRODUCT_MV32_WB             0x00f2
+ 
+ /* Olivetti products */
+ #define OLIVETTI_VENDOR_ID                    0x0b3c
+@@ -1217,6 +1219,10 @@ static const struct usb_device_id option_ids[] = {
+         .driver_info = NCTRL(0) | RSVD(1) },
+       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff),    /* 
Telit FD980 */
+         .driver_info = NCTRL(2) | RSVD(3) },
++      { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1057, 0xff),    /* 
Telit FN980 */
++        .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
++      { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1058, 0xff),    /* 
Telit FN980 (PCIe) */
++        .driver_info = NCTRL(0) | RSVD(1) },
+       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1060, 0xff),    /* 
Telit LN920 (rmnet) */
+         .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
+       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1061, 0xff),    /* 
Telit LN920 (MBIM) */
+@@ -1233,6 +1239,8 @@ static const struct usb_device_id option_ids[] = {
+         .driver_info = NCTRL(2) | RSVD(3) },
+       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff),    /* 
Telit FN990 (ECM) */
+         .driver_info = NCTRL(0) | RSVD(1) },
++      { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff),    /* 
Telit FN990 (PCIe) */
++        .driver_info = RSVD(0) },
+       { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
+         .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
+       { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
+@@ -1969,6 +1977,10 @@ static const struct usb_device_id option_ids[] = {
+         .driver_info = RSVD(3)},
+       { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, 
CINTERION_PRODUCT_MV31_RMNET, 0xff),
+         .driver_info = RSVD(0)},
++      { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, 
CINTERION_PRODUCT_MV32_WA, 0xff),
++        .driver_info = RSVD(3)},
++      { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, 
CINTERION_PRODUCT_MV32_WB, 0xff),
++        .driver_info = RSVD(3)},
+       { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100),
+         .driver_info = RSVD(4) },
+       { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
+diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
+index 16b275123f10e..40a15c79dd341 100644
+--- a/drivers/usb/serial/whiteheat.c
++++ b/drivers/usb/serial/whiteheat.c
+@@ -611,9 +611,8 @@ static int firm_send_command(struct usb_serial_port *port, 
__u8 command,
+               switch (command) {
+               case WHITEHEAT_GET_DTR_RTS:
+                       info = usb_get_serial_port_data(port);
+-                      memcpy(&info->mcr, command_info->result_buffer,
+-                                      sizeof(struct whiteheat_dr_info));
+-                              break;
++                      info->mcr = command_info->result_buffer[0];
++                      break;
+               }
+       }
+ exit:
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
+index dba14bd8ce799..e00c50ea2eafd 100644
+--- a/fs/btrfs/tree-log.c
++++ b/fs/btrfs/tree-log.c
+@@ -4906,6 +4906,18 @@ static int btrfs_log_inode(struct btrfs_trans_handle 
*trans,
+               mutex_lock(&inode->log_mutex);
+       }
+ 
++      /*
++       * For symlinks, we must always log their content, which is stored in an
++       * inline extent, otherwise we could end up with an empty symlink after
++       * log replay, which is invalid on linux (symlink(2) returns -ENOENT if
++       * one attempts to create an empty symlink).
++       * We don't need to worry about flushing delalloc, because when we 
create
++       * the inline extent when the symlink is created (we never have delalloc
++       * for symlinks).
++       */
++      if (S_ISLNK(inode->vfs_inode.i_mode))
++              inode_only = LOG_INODE_ALL;
++
+       /*
+        * a brute force approach to making sure we get the most uptodate
+        * copies of everything.
+@@ -5462,7 +5474,7 @@ process_leaf:
+                       }
+ 
+                       ctx->log_new_dentries = false;
+-                      if (type == BTRFS_FT_DIR || type == BTRFS_FT_SYMLINK)
++                      if (type == BTRFS_FT_DIR)
+                               log_mode = LOG_INODE_ALL;
+                       ret = btrfs_log_inode(trans, root, BTRFS_I(di_inode),
+                                             log_mode, 0, LLONG_MAX, ctx);
+diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
+index 61955a7c838b4..cc34a28aecbcd 100644
+--- a/fs/cifs/smb2ops.c
++++ b/fs/cifs/smb2ops.c
+@@ -1144,9 +1144,17 @@ smb2_copychunk_range(const unsigned int xid,
+       int chunks_copied = 0;
+       bool chunk_sizes_updated = false;
+       ssize_t bytes_written, total_bytes_written = 0;
++      struct inode *inode;
+ 
+       pcchunk = kmalloc(sizeof(struct copychunk_ioctl), GFP_KERNEL);
+ 
++      /*
++       * We need to flush all unwritten data before we can send the
++       * copychunk ioctl to the server.
++       */
++      inode = d_inode(trgtfile->dentry);
++      filemap_write_and_wait(inode->i_mapping);
++
+       if (pcchunk == NULL)
+               return -ENOMEM;
+ 
+diff --git a/include/linux/kernel.h b/include/linux/kernel.h
+index f6f94e54ab966..50733abbe548e 100644
+--- a/include/linux/kernel.h
++++ b/include/linux/kernel.h
+@@ -631,7 +631,7 @@ static inline char *hex_byte_pack_upper(char *buf, u8 byte)
+       return buf;
+ }
+ 
+-extern int hex_to_bin(char ch);
++extern int hex_to_bin(unsigned char ch);
+ extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
+ extern char *bin2hex(char *dst, const void *src, size_t count);
+ 
+diff --git a/include/net/tcp.h b/include/net/tcp.h
+index 3f0d654984cf4..5c5807ed66eef 100644
+--- a/include/net/tcp.h
++++ b/include/net/tcp.h
+@@ -594,6 +594,7 @@ void tcp_synack_rtt_meas(struct sock *sk, struct 
request_sock *req);
+ void tcp_reset(struct sock *sk);
+ void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff 
*skb);
+ void tcp_fin(struct sock *sk);
++void tcp_check_space(struct sock *sk);
+ 
+ /* tcp_timer.c */
+ void tcp_init_xmit_timers(struct sock *);
+@@ -1938,6 +1939,11 @@ struct tcp_request_sock_ops {
+                          enum tcp_synack_type synack_type);
+ };
+ 
++extern const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops;
++#if IS_ENABLED(CONFIG_IPV6)
++extern const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops;
++#endif
++
+ #ifdef CONFIG_SYN_COOKIES
+ static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops 
*ops,
+                                        const struct sock *sk, struct sk_buff 
*skb,
+diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
+index 3f4618510d051..10eccbc846861 100644
+--- a/kernel/irq/internals.h
++++ b/kernel/irq/internals.h
+@@ -29,12 +29,14 @@ extern struct irqaction chained_action;
+  * IRQTF_WARNED    - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
+  * IRQTF_AFFINITY  - irq thread is requested to adjust affinity
+  * IRQTF_FORCED_THREAD  - irq action is force threaded
++ * IRQTF_READY     - signals that irq thread is ready
+  */
+ enum {
+       IRQTF_RUNTHREAD,
+       IRQTF_WARNED,
+       IRQTF_AFFINITY,
+       IRQTF_FORCED_THREAD,
++      IRQTF_READY,
+ };
+ 
+ /*
+diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
+index 26814a14013cb..3633540b0f160 100644
+--- a/kernel/irq/irqdesc.c
++++ b/kernel/irq/irqdesc.c
+@@ -404,6 +404,7 @@ static struct irq_desc *alloc_desc(int irq, int node, 
unsigned int flags,
+       lockdep_set_class(&desc->lock, &irq_desc_lock_class);
+       mutex_init(&desc->request_mutex);
+       init_rcu_head(&desc->rcu);
++      init_waitqueue_head(&desc->wait_for_threads);
+ 
+       desc_set_defaults(irq, desc, node, affinity, owner);
+       irqd_set(&desc->irq_data, flags);
+@@ -568,6 +569,7 @@ int __init early_irq_init(void)
+               raw_spin_lock_init(&desc[i].lock);
+               lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);
+               mutex_init(&desc[i].request_mutex);
++              init_waitqueue_head(&desc[i].wait_for_threads);
+               desc_set_defaults(i, &desc[i], node, NULL, NULL);
+       }
+       return arch_early_irq_init();
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
+index c377dbb869f80..18f3cdbf41fd5 100644
+--- a/kernel/irq/manage.c
++++ b/kernel/irq/manage.c
+@@ -1063,6 +1063,31 @@ static void irq_wake_secondary(struct irq_desc *desc, 
struct irqaction *action)
+       raw_spin_unlock_irq(&desc->lock);
+ }
+ 
++/*
++ * Internal function to notify that a interrupt thread is ready.
++ */
++static void irq_thread_set_ready(struct irq_desc *desc,
++                               struct irqaction *action)
++{
++      set_bit(IRQTF_READY, &action->thread_flags);
++      wake_up(&desc->wait_for_threads);
++}
++
++/*
++ * Internal function to wake up a interrupt thread and wait until it is
++ * ready.
++ */
++static void wake_up_and_wait_for_irq_thread_ready(struct irq_desc *desc,
++                                                struct irqaction *action)
++{
++      if (!action || !action->thread)
++              return;
++
++      wake_up_process(action->thread);
++      wait_event(desc->wait_for_threads,
++                 test_bit(IRQTF_READY, &action->thread_flags));
++}
++
+ /*
+  * Interrupt handler thread
+  */
+@@ -1074,6 +1099,8 @@ static int irq_thread(void *data)
+       irqreturn_t (*handler_fn)(struct irq_desc *desc,
+                       struct irqaction *action);
+ 
++      irq_thread_set_ready(desc, action);
++
+       if (force_irqthreads && test_bit(IRQTF_FORCED_THREAD,
+                                       &action->thread_flags))
+               handler_fn = irq_forced_thread_fn;
+@@ -1462,8 +1489,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, 
struct irqaction *new)
+       }
+ 
+       if (!shared) {
+-              init_waitqueue_head(&desc->wait_for_threads);
+-
+               /* Setup the type (level, edge polarity) if configured: */
+               if (new->flags & IRQF_TRIGGER_MASK) {
+                       ret = __irq_set_trigger(desc,
+@@ -1553,14 +1578,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, 
struct irqaction *new)
+ 
+       irq_setup_timings(desc, new);
+ 
+-      /*
+-       * Strictly no need to wake it up, but hung_task complains
+-       * when no hard interrupt wakes the thread up.
+-       */
+-      if (new->thread)
+-              wake_up_process(new->thread);
+-      if (new->secondary)
+-              wake_up_process(new->secondary->thread);
++      wake_up_and_wait_for_irq_thread_ready(desc, new);
++      wake_up_and_wait_for_irq_thread_ready(desc, new->secondary);
+ 
+       register_irq_proc(irq, desc);
+       new->dir = NULL;
+diff --git a/lib/hexdump.c b/lib/hexdump.c
+index 81b70ed372096..fa2fab854f74d 100644
+--- a/lib/hexdump.c
++++ b/lib/hexdump.c
+@@ -25,15 +25,33 @@ EXPORT_SYMBOL(hex_asc_upper);
+  *
+  * hex_to_bin() converts one hex digit to its actual value or -1 in case of 
bad
+  * input.
++ *
++ * This function is used to load cryptographic keys, so it is coded in such a
++ * way that there are no conditions or memory accesses that depend on data.
++ *
++ * Explanation of the logic:
++ * (ch - '9' - 1) is negative if ch <= '9'
++ * ('0' - 1 - ch) is negative if ch >= '0'
++ * we "and" these two values, so the result is negative if ch is in the range
++ *    '0' ... '9'
++ * we are only interested in the sign, so we do a shift ">> 8"; note that 
right
++ *    shift of a negative value is implementation-defined, so we cast the
++ *    value to (unsigned) before the shift --- we have 0xffffff if ch is in
++ *    the range '0' ... '9', 0 otherwise
++ * we "and" this value with (ch - '0' + 1) --- we have a value 1 ... 10 if ch 
is
++ *    in the range '0' ... '9', 0 otherwise
++ * we add this value to -1 --- we have a value 0 ... 9 if ch is in the range 
'0'
++ *    ... '9', -1 otherwise
++ * the next line is similar to the previous one, but we need to decode both
++ *    uppercase and lowercase letters, so we use (ch & 0xdf), which converts
++ *    lowercase to uppercase
+  */
+-int hex_to_bin(char ch)
++int hex_to_bin(unsigned char ch)
+ {
+-      if ((ch >= '0') && (ch <= '9'))
+-              return ch - '0';
+-      ch = tolower(ch);
+-      if ((ch >= 'a') && (ch <= 'f'))
+-              return ch - 'a' + 10;
+-      return -1;
++      unsigned char cu = ch & 0xdf;
++      return -1 +
++              ((ch - '0' +  1) & (unsigned)((ch - '9' - 1) & ('0' - 1 - ch)) 
>> 8) +
++              ((cu - 'A' + 11) & (unsigned)((cu - 'F' - 1) & ('A' - 1 - cu)) 
>> 8);
+ }
+ EXPORT_SYMBOL(hex_to_bin);
+ 
+@@ -48,10 +66,13 @@ EXPORT_SYMBOL(hex_to_bin);
+ int hex2bin(u8 *dst, const char *src, size_t count)
+ {
+       while (count--) {
+-              int hi = hex_to_bin(*src++);
+-              int lo = hex_to_bin(*src++);
++              int hi, lo;
+ 
+-              if ((hi < 0) || (lo < 0))
++              hi = hex_to_bin(*src++);
++              if (unlikely(hi < 0))
++                      return -EINVAL;
++              lo = hex_to_bin(*src++);
++              if (unlikely(lo < 0))
+                       return -EINVAL;
+ 
+               *dst++ = (hi << 4) | lo;
+diff --git a/mm/page_io.c b/mm/page_io.c
+index 9b646f07f47f1..929e7829e02d1 100644
+--- a/mm/page_io.c
++++ b/mm/page_io.c
+@@ -71,55 +71,6 @@ void end_swap_bio_write(struct bio *bio)
+       bio_put(bio);
+ }
+ 
+-static void swap_slot_free_notify(struct page *page)
+-{
+-      struct swap_info_struct *sis;
+-      struct gendisk *disk;
+-      swp_entry_t entry;
+-
+-      /*
+-       * There is no guarantee that the page is in swap cache - the software
+-       * suspend code (at least) uses end_swap_bio_read() against a non-
+-       * swapcache page.  So we must check PG_swapcache before proceeding with
+-       * this optimization.
+-       */
+-      if (unlikely(!PageSwapCache(page)))
+-              return;
+-
+-      sis = page_swap_info(page);
+-      if (!(sis->flags & SWP_BLKDEV))
+-              return;
+-
+-      /*
+-       * The swap subsystem performs lazy swap slot freeing,
+-       * expecting that the page will be swapped out again.
+-       * So we can avoid an unnecessary write if the page
+-       * isn't redirtied.
+-       * This is good for real swap storage because we can
+-       * reduce unnecessary I/O and enhance wear-leveling
+-       * if an SSD is used as the as swap device.
+-       * But if in-memory swap device (eg zram) is used,
+-       * this causes a duplicated copy between uncompressed
+-       * data in VM-owned memory and compressed data in
+-       * zram-owned memory.  So let's free zram-owned memory
+-       * and make the VM-owned decompressed page *dirty*,
+-       * so the page should be swapped out somewhere again if
+-       * we again wish to reclaim it.
+-       */
+-      disk = sis->bdev->bd_disk;
+-      entry.val = page_private(page);
+-      if (disk->fops->swap_slot_free_notify &&
+-                      __swap_count(sis, entry) == 1) {
+-              unsigned long offset;
+-
+-              offset = swp_offset(entry);
+-
+-              SetPageDirty(page);
+-              disk->fops->swap_slot_free_notify(sis->bdev,
+-                              offset);
+-      }
+-}
+-
+ static void end_swap_bio_read(struct bio *bio)
+ {
+       struct page *page = bio_first_page_all(bio);
+@@ -135,7 +86,6 @@ static void end_swap_bio_read(struct bio *bio)
+       }
+ 
+       SetPageUptodate(page);
+-      swap_slot_free_notify(page);
+ out:
+       unlock_page(page);
+       WRITE_ONCE(bio->bi_private, NULL);
+@@ -373,11 +323,6 @@ int swap_readpage(struct page *page, bool synchronous)
+ 
+       ret = bdev_read_page(sis->bdev, map_swap_page(page, &sis->bdev), page);
+       if (!ret) {
+-              if (trylock_page(page)) {
+-                      swap_slot_free_notify(page);
+-                      unlock_page(page);
+-              }
+-
+               count_vm_event(PSWPIN);
+               return 0;
+       }
+diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
+index 15804cfc19a8c..ee179e08dd20c 100644
+--- a/net/ipv4/igmp.c
++++ b/net/ipv4/igmp.c
+@@ -2416,9 +2416,10 @@ int ip_mc_source(int add, int omode, struct sock *sk, 
struct
+                               newpsl->sl_addr[i] = psl->sl_addr[i];
+                       /* decrease mem now to avoid the memleak warning */
+                       atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
+-                      kfree_rcu(psl, rcu);
+               }
+               rcu_assign_pointer(pmc->sflist, newpsl);
++              if (psl)
++                      kfree_rcu(psl, rcu);
+               psl = newpsl;
+       }
+       rv = 1; /* > 0 for insert logic below if sl_count is 0 */
+@@ -2516,11 +2517,13 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter 
*msf, int ifindex)
+                       psl->sl_count, psl->sl_addr, 0);
+               /* decrease mem now to avoid the memleak warning */
+               atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
+-              kfree_rcu(psl, rcu);
+-      } else
++      } else {
+               (void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode,
+                       0, NULL, 0);
++      }
+       rcu_assign_pointer(pmc->sflist, newpsl);
++      if (psl)
++              kfree_rcu(psl, rcu);
+       pmc->sfmode = msf->imsf_fmode;
+       err = 0;
+ done:
+diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
+index 0c431fd4b1200..41d0f9bb51914 100644
+--- a/net/ipv4/ip_gre.c
++++ b/net/ipv4/ip_gre.c
+@@ -435,14 +435,12 @@ static void __gre_xmit(struct sk_buff *skb, struct 
net_device *dev,
+                      __be16 proto)
+ {
+       struct ip_tunnel *tunnel = netdev_priv(dev);
+-
+-      if (tunnel->parms.o_flags & TUNNEL_SEQ)
+-              tunnel->o_seqno++;
++      __be16 flags = tunnel->parms.o_flags;
+ 
+       /* Push GRE header. */
+       gre_build_header(skb, tunnel->tun_hlen,
+-                       tunnel->parms.o_flags, proto, tunnel->parms.o_key,
+-                       htonl(tunnel->o_seqno));
++                       flags, proto, tunnel->parms.o_key,
++                       (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0);
+ 
+       ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol);
+ }
+diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
+index 1a06850ef3cc5..929f989de1f63 100644
+--- a/net/ipv4/syncookies.c
++++ b/net/ipv4/syncookies.c
+@@ -337,6 +337,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct 
sk_buff *skb)
+ 
+       ireq = inet_rsk(req);
+       treq = tcp_rsk(req);
++      treq->af_specific       = &tcp_request_sock_ipv4_ops;
+       treq->rcv_isn           = ntohl(th->seq) - 1;
+       treq->snt_isn           = cookie;
+       treq->ts_off            = 0;
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
+index 757e1f60e00db..d71326f3777cb 100644
+--- a/net/ipv4/tcp_input.c
++++ b/net/ipv4/tcp_input.c
+@@ -5167,7 +5167,17 @@ static void tcp_new_space(struct sock *sk)
+       sk->sk_write_space(sk);
+ }
+ 
+-static void tcp_check_space(struct sock *sk)
++/* Caller made space either from:
++ * 1) Freeing skbs in rtx queues (after tp->snd_una has advanced)
++ * 2) Sent skbs from output queue (and thus advancing tp->snd_nxt)
++ *
++ * We might be able to generate EPOLLOUT to the application if:
++ * 1) Space consumed in output/rtx queues is below sk->sk_sndbuf/2
++ * 2) notsent amount (tp->write_seq - tp->snd_nxt) became
++ *    small enough that tcp_stream_memory_free() decides it
++ *    is time to generate EPOLLOUT.
++ */
++void tcp_check_space(struct sock *sk)
+ {
+       if (sock_flag(sk, SOCK_QUEUE_SHRUNK)) {
+               sock_reset_flag(sk, SOCK_QUEUE_SHRUNK);
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
+index c9fc6e3868be3..2719c60f285b0 100644
+--- a/net/ipv4/tcp_ipv4.c
++++ b/net/ipv4/tcp_ipv4.c
+@@ -1372,7 +1372,7 @@ struct request_sock_ops tcp_request_sock_ops 
__read_mostly = {
+       .syn_ack_timeout =      tcp_syn_ack_timeout,
+ };
+ 
+-static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = {
++const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = {
+       .mss_clamp      =       TCP_MSS_DEFAULT,
+ #ifdef CONFIG_TCP_MD5SIG
+       .req_md5_lookup =       tcp_v4_md5_lookup,
+diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
+index a20b393b45016..c79cb949da66b 100644
+--- a/net/ipv4/tcp_minisocks.c
++++ b/net/ipv4/tcp_minisocks.c
+@@ -550,7 +550,7 @@ struct sock *tcp_create_openreq_child(const struct sock 
*sk,
+       newtp->tsoffset = treq->ts_off;
+ #ifdef CONFIG_TCP_MD5SIG
+       newtp->md5sig_info = NULL;      /*XXX*/
+-      if (newtp->af_specific->md5_lookup(sk, newsk))
++      if (treq->af_specific->req_md5_lookup(sk, req_to_sk(req)))
+               newtp->tcp_header_len += TCPOLEN_MD5SIG_ALIGNED;
+ #endif
+       if (skb->len >= TCP_MSS_DEFAULT + newtp->tcp_header_len)
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
+index 97c3b616d594b..8543cd724d543 100644
+--- a/net/ipv4/tcp_output.c
++++ b/net/ipv4/tcp_output.c
+@@ -69,6 +69,7 @@ static void tcp_event_new_data_sent(struct sock *sk, struct 
sk_buff *skb)
+ 
+       NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPORIGDATASENT,
+                     tcp_skb_pcount(skb));
++      tcp_check_space(sk);
+ }
+ 
+ /* SND.NXT, if window was not shrunk or the amount of shrunk was less than one
+diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
+index 043e57d08a3e9..4fd6c0929b144 100644
+--- a/net/ipv6/ip6_gre.c
++++ b/net/ipv6/ip6_gre.c
+@@ -750,6 +750,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
+               struct ip_tunnel_info *tun_info;
+               const struct ip_tunnel_key *key;
+               __be16 flags;
++              int tun_hlen;
+ 
+               tun_info = skb_tunnel_info(skb);
+               if (unlikely(!tun_info ||
+@@ -767,9 +768,9 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
+               dsfield = key->tos;
+               flags = key->tun_flags &
+                       (TUNNEL_CSUM | TUNNEL_KEY | TUNNEL_SEQ);
+-              tunnel->tun_hlen = gre_calc_hlen(flags);
++              tun_hlen = gre_calc_hlen(flags);
+ 
+-              gre_build_header(skb, tunnel->tun_hlen,
++              gre_build_header(skb, tun_hlen,
+                                flags, protocol,
+                                tunnel_id_to_key32(tun_info->key.tun_id),
+                                (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++)
+diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
+index ec61b67a92be0..ca291e342900c 100644
+--- a/net/ipv6/syncookies.c
++++ b/net/ipv6/syncookies.c
+@@ -181,6 +181,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct 
sk_buff *skb)
+ 
+       ireq = inet_rsk(req);
+       treq = tcp_rsk(req);
++      treq->af_specific = &tcp_request_sock_ipv6_ops;
+       treq->tfo_listener = false;
+ 
+       if (security_inet_conn_request(sk, skb, req))
+diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
+index c332f75f4e9aa..c9ba827aded26 100644
+--- a/net/ipv6/tcp_ipv6.c
++++ b/net/ipv6/tcp_ipv6.c
+@@ -789,7 +789,7 @@ struct request_sock_ops tcp6_request_sock_ops 
__read_mostly = {
+       .syn_ack_timeout =      tcp_syn_ack_timeout,
+ };
+ 
+-static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
++const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
+       .mss_clamp      =       IPV6_MIN_MTU - sizeof(struct tcphdr) -
+                               sizeof(struct ipv6hdr),
+ #ifdef CONFIG_TCP_MD5SIG
+diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
+index 2780a847701e6..95c35aa639ecf 100644
+--- a/net/netfilter/ipvs/ip_vs_conn.c
++++ b/net/netfilter/ipvs/ip_vs_conn.c
+@@ -1426,7 +1426,7 @@ int __init ip_vs_conn_init(void)
+       pr_info("Connection hash table configured "
+               "(size=%d, memory=%ldKbytes)\n",
+               ip_vs_conn_tab_size,
+-              (long)(ip_vs_conn_tab_size*sizeof(struct list_head))/1024);
++              (long)(ip_vs_conn_tab_size*sizeof(*ip_vs_conn_tab))/1024);
+       IP_VS_DBG(0, "Each connection entry needs %zd bytes at least\n",
+                 sizeof(struct ip_vs_conn));
+ 
+diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c
+index 637ce3e8c575c..4026ec38526f6 100644
+--- a/net/netfilter/nft_socket.c
++++ b/net/netfilter/nft_socket.c
+@@ -14,6 +14,32 @@ struct nft_socket {
+       };
+ };
+ 
++static struct sock *nft_socket_do_lookup(const struct nft_pktinfo *pkt)
++{
++      const struct net_device *indev = nft_in(pkt);
++      const struct sk_buff *skb = pkt->skb;
++      struct sock *sk = NULL;
++
++      if (!indev)
++              return NULL;
++
++      switch (nft_pf(pkt)) {
++      case NFPROTO_IPV4:
++              sk = nf_sk_lookup_slow_v4(nft_net(pkt), skb, indev);
++              break;
++#if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
++      case NFPROTO_IPV6:
++              sk = nf_sk_lookup_slow_v6(nft_net(pkt), skb, indev);
++              break;
++#endif
++      default:
++              WARN_ON_ONCE(1);
++              break;
++      }
++
++      return sk;
++}
++
+ static void nft_socket_eval(const struct nft_expr *expr,
+                           struct nft_regs *regs,
+                           const struct nft_pktinfo *pkt)
+@@ -27,20 +53,7 @@ static void nft_socket_eval(const struct nft_expr *expr,
+               sk = NULL;
+ 
+       if (!sk)
+-              switch(nft_pf(pkt)) {
+-              case NFPROTO_IPV4:
+-                      sk = nf_sk_lookup_slow_v4(nft_net(pkt), skb, 
nft_in(pkt));
+-                      break;
+-#if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
+-              case NFPROTO_IPV6:
+-                      sk = nf_sk_lookup_slow_v6(nft_net(pkt), skb, 
nft_in(pkt));
+-                      break;
+-#endif
+-              default:
+-                      WARN_ON_ONCE(1);
+-                      regs->verdict.code = NFT_BREAK;
+-                      return;
+-              }
++              sk = nft_socket_do_lookup(pkt);
+ 
+       if (!sk) {
+               regs->verdict.code = NFT_BREAK;
+@@ -123,6 +136,16 @@ static int nft_socket_dump(struct sk_buff *skb,
+       return 0;
+ }
+ 
++static int nft_socket_validate(const struct nft_ctx *ctx,
++                             const struct nft_expr *expr,
++                             const struct nft_data **data)
++{
++      return nft_chain_validate_hooks(ctx->chain,
++                                      (1 << NF_INET_PRE_ROUTING) |
++                                      (1 << NF_INET_LOCAL_IN) |
++                                      (1 << NF_INET_LOCAL_OUT));
++}
++
+ static struct nft_expr_type nft_socket_type;
+ static const struct nft_expr_ops nft_socket_ops = {
+       .type           = &nft_socket_type,
+@@ -130,6 +153,7 @@ static const struct nft_expr_ops nft_socket_ops = {
+       .eval           = nft_socket_eval,
+       .init           = nft_socket_init,
+       .dump           = nft_socket_dump,
++      .validate       = nft_socket_validate,
+ };
+ 
+ static struct nft_expr_type nft_socket_type __read_mostly = {
+diff --git a/net/nfc/core.c b/net/nfc/core.c
+index ff646d1758d16..54168bbc07cbf 100644
+--- a/net/nfc/core.c
++++ b/net/nfc/core.c
+@@ -50,7 +50,7 @@ int nfc_fw_download(struct nfc_dev *dev, const char 
*firmware_name)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -106,7 +106,7 @@ int nfc_dev_up(struct nfc_dev *dev)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -154,7 +154,7 @@ int nfc_dev_down(struct nfc_dev *dev)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -218,7 +218,7 @@ int nfc_start_poll(struct nfc_dev *dev, u32 im_protocols, 
u32 tm_protocols)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -257,7 +257,7 @@ int nfc_stop_poll(struct nfc_dev *dev)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -302,7 +302,7 @@ int nfc_dep_link_up(struct nfc_dev *dev, int target_index, 
u8 comm_mode)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -346,7 +346,7 @@ int nfc_dep_link_down(struct nfc_dev *dev)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -412,7 +412,7 @@ int nfc_activate_target(struct nfc_dev *dev, u32 
target_idx, u32 protocol)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -458,7 +458,7 @@ int nfc_deactivate_target(struct nfc_dev *dev, u32 
target_idx, u8 mode)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -505,7 +505,7 @@ int nfc_data_exchange(struct nfc_dev *dev, u32 target_idx, 
struct sk_buff *skb,
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               kfree_skb(skb);
+               goto error;
+@@ -562,7 +562,7 @@ int nfc_enable_se(struct nfc_dev *dev, u32 se_idx)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -611,7 +611,7 @@ int nfc_disable_se(struct nfc_dev *dev, u32 se_idx)
+ 
+       device_lock(&dev->dev);
+ 
+-      if (!device_is_registered(&dev->dev)) {
++      if (dev->shutting_down) {
+               rc = -ENODEV;
+               goto error;
+       }
+@@ -1139,6 +1139,7 @@ int nfc_register_device(struct nfc_dev *dev)
+                       dev->rfkill = NULL;
+               }
+       }
++      dev->shutting_down = false;
+       device_unlock(&dev->dev);
+ 
+       rc = nfc_genl_device_added(dev);
+@@ -1171,12 +1172,10 @@ void nfc_unregister_device(struct nfc_dev *dev)
+               rfkill_unregister(dev->rfkill);
+               rfkill_destroy(dev->rfkill);
+       }
++      dev->shutting_down = true;
+       device_unlock(&dev->dev);
+ 
+       if (dev->ops->check_presence) {
+-              device_lock(&dev->dev);
+-              dev->shutting_down = true;
+-              device_unlock(&dev->dev);
+               del_timer_sync(&dev->check_pres_timer);
+               cancel_work_sync(&dev->check_pres_work);
+       }
+diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
+index 0a3120117c13d..39fb01ee92220 100644
+--- a/net/nfc/netlink.c
++++ b/net/nfc/netlink.c
+@@ -1262,7 +1262,7 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const 
char *firmware_name,
+       struct sk_buff *msg;
+       void *hdr;
+ 
+-      msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
++      msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
+       if (!msg)
+               return -ENOMEM;
+ 
+@@ -1278,7 +1278,7 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const 
char *firmware_name,
+ 
+       genlmsg_end(msg, hdr);
+ 
+-      genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL);
++      genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC);
+ 
+       return 0;
+ 
+diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
+index 2a94240eac360..82d96441e64d6 100644
+--- a/net/sctp/sm_sideeffect.c
++++ b/net/sctp/sm_sideeffect.c
+@@ -473,6 +473,10 @@ void sctp_generate_reconf_event(struct timer_list *t)
+               goto out_unlock;
+       }
+ 
++      /* This happens when the response arrives after the timer is triggered. 
*/
++      if (!asoc->strreset_chunk)
++              goto out_unlock;
++
+       error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT,
+                          SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_RECONF),
+                          asoc->state, asoc->ep, asoc,
+diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
+index 798fbd89ed42f..a0a82d9a59008 100644
+--- a/net/sunrpc/xprtsock.c
++++ b/net/sunrpc/xprtsock.c
+@@ -2974,9 +2974,6 @@ static struct rpc_xprt *xs_setup_local(struct 
xprt_create *args)
+               }
+               xprt_set_bound(xprt);
+               xs_format_peer_addresses(xprt, "local", RPCBIND_NETID_LOCAL);
+-              ret = ERR_PTR(xs_local_setup_socket(transport));
+-              if (ret)
+-                      goto out_err;
+               break;
+       default:
+               ret = ERR_PTR(-EAFNOSUPPORT);
+diff --git a/sound/firewire/fireworks/fireworks_hwdep.c 
b/sound/firewire/fireworks/fireworks_hwdep.c
+index 5cac26ab20b71..e9209f44cb500 100644
+--- a/sound/firewire/fireworks/fireworks_hwdep.c
++++ b/sound/firewire/fireworks/fireworks_hwdep.c
+@@ -35,6 +35,7 @@ hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, 
long remained,
+       type = SNDRV_FIREWIRE_EVENT_EFW_RESPONSE;
+       if (copy_to_user(buf, &type, sizeof(type)))
+               return -EFAULT;
++      count += sizeof(type);
+       remained -= sizeof(type);
+       buf += sizeof(type);
+ 
+diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
+index 7c8fad865d6b0..3c5c02b034a99 100644
+--- a/sound/soc/codecs/wm8731.c
++++ b/sound/soc/codecs/wm8731.c
+@@ -604,7 +604,7 @@ static int wm8731_hw_init(struct device *dev, struct 
wm8731_priv *wm8731)
+       ret = wm8731_reset(wm8731->regmap);
+       if (ret < 0) {
+               dev_err(dev, "Failed to issue reset: %d\n", ret);
+-              goto err_regulator_enable;
++              goto err;
+       }
+ 
+       /* Clear POWEROFF, keep everything else disabled */
+@@ -621,10 +621,7 @@ static int wm8731_hw_init(struct device *dev, struct 
wm8731_priv *wm8731)
+ 
+       regcache_mark_dirty(wm8731->regmap);
+ 
+-err_regulator_enable:
+-      /* Regulators will be enabled by bias management */
+-      regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
+-
++err:
+       return ret;
+ }
+ 
+@@ -768,21 +765,27 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
+               ret = PTR_ERR(wm8731->regmap);
+               dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
+                       ret);
+-              return ret;
++              goto err_regulator_enable;
+       }
+ 
+       ret = wm8731_hw_init(&i2c->dev, wm8731);
+       if (ret != 0)
+-              return ret;
++              goto err_regulator_enable;
+ 
+       ret = devm_snd_soc_register_component(&i2c->dev,
+                       &soc_component_dev_wm8731, &wm8731_dai, 1);
+       if (ret != 0) {
+               dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
+-              return ret;
++              goto err_regulator_enable;
+       }
+ 
+       return 0;
++
++err_regulator_enable:
++      /* Regulators will be enabled by bias management */
++      regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
++
++      return ret;
+ }
+ 
+ static int wm8731_i2c_remove(struct i2c_client *client)
+diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c
+index f0a409504a13b..91de7ff3a5a8f 100644
+--- a/sound/soc/codecs/wm8958-dsp2.c
++++ b/sound/soc/codecs/wm8958-dsp2.c
+@@ -537,7 +537,7 @@ static int wm8958_mbc_put(struct snd_kcontrol *kcontrol,
+ 
+       wm8958_dsp_apply(component, mbc, wm8994->mbc_ena[mbc]);
+ 
+-      return 0;
++      return 1;
+ }
+ 
+ #define WM8958_MBC_SWITCH(xname, xval) {\
+@@ -663,7 +663,7 @@ static int wm8958_vss_put(struct snd_kcontrol *kcontrol,
+ 
+       wm8958_dsp_apply(component, vss, wm8994->vss_ena[vss]);
+ 
+-      return 0;
++      return 1;
+ }
+ 
+ 
+@@ -737,7 +737,7 @@ static int wm8958_hpf_put(struct snd_kcontrol *kcontrol,
+ 
+       wm8958_dsp_apply(component, hpf % 3, ucontrol->value.integer.value[0]);
+ 
+-      return 0;
++      return 1;
+ }
+ 
+ #define WM8958_HPF_SWITCH(xname, xval) {\
+@@ -831,7 +831,7 @@ static int wm8958_enh_eq_put(struct snd_kcontrol *kcontrol,
+ 
+       wm8958_dsp_apply(component, eq, ucontrol->value.integer.value[0]);
+ 
+-      return 0;
++      return 1;
+ }
+ 
+ #define WM8958_ENH_EQ_SWITCH(xname, xval) {\
+diff --git a/sound/soc/soc-generic-dmaengine-pcm.c 
b/sound/soc/soc-generic-dmaengine-pcm.c
+index 45cce7376191c..232df04ca5866 100644
+--- a/sound/soc/soc-generic-dmaengine-pcm.c
++++ b/sound/soc/soc-generic-dmaengine-pcm.c
+@@ -91,10 +91,10 @@ static int dmaengine_pcm_hw_params(struct 
snd_pcm_substream *substream,
+ 
+       memset(&slave_config, 0, sizeof(slave_config));
+ 
+-      if (pcm->config && pcm->config->prepare_slave_config)
+-              prepare_slave_config = pcm->config->prepare_slave_config;
+-      else
++      if (!pcm->config)
+               prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
++      else
++              prepare_slave_config = pcm->config->prepare_slave_config;
+ 
+       if (prepare_slave_config) {
+               ret = prepare_slave_config(substream, params, &slave_config);
+diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh 
b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh
+index a3402cd8d5b68..9ff22f28032dd 100755
+--- a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh
++++ b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh
+@@ -61,9 +61,12 @@ setup_prepare()
+ 
+       vrf_prepare
+       mirror_gre_topo_create
++      # Avoid changing br1's PVID while it is operational as a L3 interface.
++      ip link set dev br1 down
+ 
+       ip link set dev $swp3 master br1
+       bridge vlan add dev br1 vid 555 pvid untagged self
++      ip link set dev br1 up
+       ip address add dev br1 192.0.2.129/28
+       ip address add dev br1 2001:db8:2::1/64
+ 

Reply via email to