Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.19 commit in: /
Date: Wed, 31 Jul 2019 10:22:07
Message-Id: 1564567974.bba20b5be2b932524ed1365df0c4f25c29ac4a74.mpagano@gentoo
1 commit: bba20b5be2b932524ed1365df0c4f25c29ac4a74
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 31 10:12:54 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 31 10:12:54 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=bba20b5b
7
8 Linux patch 4.19.63
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 8 +-
13 1062_linux-4.19.63.patch | 3299 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 3305 insertions(+), 2 deletions(-)
15
16 diff --git a/0000_README b/0000_README
17 index 6ff7ffd..2e505ed 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -283,14 +283,18 @@ Patch: 1059_linux-4.19.60.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.19.60
23
24 -Patch: 1060-4.19.61.patch
25 +Patch: 1060_linux-4.19.61.patch
26 From: https://www.kernel.org
27 Desc: Linux 4.19.61
28
29 -Patch: 1061-4.19.62.patch
30 +Patch: 1061_linux-4.19.62.patch
31 From: https://www.kernel.org
32 Desc: Linux 4.19.62
33
34 +Patch: 1062_linux-4.19.63.patch
35 +From: https://www.kernel.org
36 +Desc: Linux 4.19.63
37 +
38 Patch: 1500_XATTR_USER_PREFIX.patch
39 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
40 Desc: Support for namespace user.pax.* on tmpfs.
41
42 diff --git a/1062_linux-4.19.63.patch b/1062_linux-4.19.63.patch
43 new file mode 100644
44 index 0000000..b523869
45 --- /dev/null
46 +++ b/1062_linux-4.19.63.patch
47 @@ -0,0 +1,3299 @@
48 +diff --git a/Makefile b/Makefile
49 +index a4463d880ae2..8ad77a93de30 100644
50 +--- a/Makefile
51 ++++ b/Makefile
52 +@@ -1,7 +1,7 @@
53 + # SPDX-License-Identifier: GPL-2.0
54 + VERSION = 4
55 + PATCHLEVEL = 19
56 +-SUBLEVEL = 62
57 ++SUBLEVEL = 63
58 + EXTRAVERSION =
59 + NAME = "People's Front"
60 +
61 +@@ -491,6 +491,7 @@ ifneq ($(GCC_TOOLCHAIN),)
62 + CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
63 + endif
64 + CLANG_FLAGS += -no-integrated-as
65 ++CLANG_FLAGS += -Werror=unknown-warning-option
66 + KBUILD_CFLAGS += $(CLANG_FLAGS)
67 + KBUILD_AFLAGS += $(CLANG_FLAGS)
68 + export CLANG_FLAGS
69 +diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
70 +index f90f5d83b228..5a97ac853168 100644
71 +--- a/arch/arm64/include/asm/assembler.h
72 ++++ b/arch/arm64/include/asm/assembler.h
73 +@@ -112,7 +112,11 @@
74 + * RAS Error Synchronization barrier
75 + */
76 + .macro esb
77 ++#ifdef CONFIG_ARM64_RAS_EXTN
78 + hint #16
79 ++#else
80 ++ nop
81 ++#endif
82 + .endm
83 +
84 + /*
85 +diff --git a/arch/powerpc/boot/xz_config.h b/arch/powerpc/boot/xz_config.h
86 +index e22e5b3770dd..ebfadd39e192 100644
87 +--- a/arch/powerpc/boot/xz_config.h
88 ++++ b/arch/powerpc/boot/xz_config.h
89 +@@ -20,10 +20,30 @@ static inline uint32_t swab32p(void *p)
90 +
91 + #ifdef __LITTLE_ENDIAN__
92 + #define get_le32(p) (*((uint32_t *) (p)))
93 ++#define cpu_to_be32(x) swab32(x)
94 ++static inline u32 be32_to_cpup(const u32 *p)
95 ++{
96 ++ return swab32p((u32 *)p);
97 ++}
98 + #else
99 + #define get_le32(p) swab32p(p)
100 ++#define cpu_to_be32(x) (x)
101 ++static inline u32 be32_to_cpup(const u32 *p)
102 ++{
103 ++ return *p;
104 ++}
105 + #endif
106 +
107 ++static inline uint32_t get_unaligned_be32(const void *p)
108 ++{
109 ++ return be32_to_cpup(p);
110 ++}
111 ++
112 ++static inline void put_unaligned_be32(u32 val, void *p)
113 ++{
114 ++ *((u32 *)p) = cpu_to_be32(val);
115 ++}
116 ++
117 + #define memeq(a, b, size) (memcmp(a, b, size) == 0)
118 + #define memzero(buf, size) memset(buf, 0, size)
119 +
120 +diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
121 +index d5a8d7bf0759..b189f7aee222 100644
122 +--- a/arch/powerpc/include/asm/cacheflush.h
123 ++++ b/arch/powerpc/include/asm/cacheflush.h
124 +@@ -32,9 +32,12 @@
125 + * not expect this type of fault. flush_cache_vmap is not exactly the right
126 + * place to put this, but it seems to work well enough.
127 + */
128 +-#define flush_cache_vmap(start, end) do { asm volatile("ptesync" ::: "memory"); } while (0)
129 ++static inline void flush_cache_vmap(unsigned long start, unsigned long end)
130 ++{
131 ++ asm volatile("ptesync" ::: "memory");
132 ++}
133 + #else
134 +-#define flush_cache_vmap(start, end) do { } while (0)
135 ++static inline void flush_cache_vmap(unsigned long start, unsigned long end) { }
136 + #endif
137 +
138 + #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
139 +diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
140 +index c72767a5327a..fe3c6f3bd3b6 100644
141 +--- a/arch/powerpc/kernel/eeh.c
142 ++++ b/arch/powerpc/kernel/eeh.c
143 +@@ -360,10 +360,19 @@ static inline unsigned long eeh_token_to_phys(unsigned long token)
144 + ptep = find_init_mm_pte(token, &hugepage_shift);
145 + if (!ptep)
146 + return token;
147 +- WARN_ON(hugepage_shift);
148 +- pa = pte_pfn(*ptep) << PAGE_SHIFT;
149 +
150 +- return pa | (token & (PAGE_SIZE-1));
151 ++ pa = pte_pfn(*ptep);
152 ++
153 ++ /* On radix we can do hugepage mappings for io, so handle that */
154 ++ if (hugepage_shift) {
155 ++ pa <<= hugepage_shift;
156 ++ pa |= token & ((1ul << hugepage_shift) - 1);
157 ++ } else {
158 ++ pa <<= PAGE_SHIFT;
159 ++ pa |= token & (PAGE_SIZE - 1);
160 ++ }
161 ++
162 ++ return pa;
163 + }
164 +
165 + /*
166 +diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
167 +index 98f04725def7..c101b321dece 100644
168 +--- a/arch/powerpc/kernel/pci_of_scan.c
169 ++++ b/arch/powerpc/kernel/pci_of_scan.c
170 +@@ -45,6 +45,8 @@ unsigned int pci_parse_of_flags(u32 addr0, int bridge)
171 + if (addr0 & 0x02000000) {
172 + flags = IORESOURCE_MEM | PCI_BASE_ADDRESS_SPACE_MEMORY;
173 + flags |= (addr0 >> 22) & PCI_BASE_ADDRESS_MEM_TYPE_64;
174 ++ if (flags & PCI_BASE_ADDRESS_MEM_TYPE_64)
175 ++ flags |= IORESOURCE_MEM_64;
176 + flags |= (addr0 >> 28) & PCI_BASE_ADDRESS_MEM_TYPE_1M;
177 + if (addr0 & 0x40000000)
178 + flags |= IORESOURCE_PREFETCH
179 +diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
180 +index fd59fef9931b..906b05c2adae 100644
181 +--- a/arch/powerpc/kernel/signal_32.c
182 ++++ b/arch/powerpc/kernel/signal_32.c
183 +@@ -1202,6 +1202,9 @@ SYSCALL_DEFINE0(rt_sigreturn)
184 + goto bad;
185 +
186 + if (MSR_TM_ACTIVE(msr_hi<<32)) {
187 ++ /* Trying to start TM on non TM system */
188 ++ if (!cpu_has_feature(CPU_FTR_TM))
189 ++ goto bad;
190 + /* We only recheckpoint on return if we're
191 + * transaction.
192 + */
193 +diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
194 +index 14b0f5b6a373..b5933d7219db 100644
195 +--- a/arch/powerpc/kernel/signal_64.c
196 ++++ b/arch/powerpc/kernel/signal_64.c
197 +@@ -750,6 +750,11 @@ SYSCALL_DEFINE0(rt_sigreturn)
198 + if (MSR_TM_ACTIVE(msr)) {
199 + /* We recheckpoint on return. */
200 + struct ucontext __user *uc_transact;
201 ++
202 ++ /* Trying to start TM on non TM system */
203 ++ if (!cpu_has_feature(CPU_FTR_TM))
204 ++ goto badframe;
205 ++
206 + if (__get_user(uc_transact, &uc->uc_link))
207 + goto badframe;
208 + if (restore_tm_sigcontexts(current, &uc->uc_mcontext,
209 +diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
210 +index 7296a42eb62e..cef0b7ee1024 100644
211 +--- a/arch/powerpc/mm/hugetlbpage.c
212 ++++ b/arch/powerpc/mm/hugetlbpage.c
213 +@@ -150,6 +150,8 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
214 + } else {
215 + pdshift = PUD_SHIFT;
216 + pu = pud_alloc(mm, pg, addr);
217 ++ if (!pu)
218 ++ return NULL;
219 + if (pshift == PUD_SHIFT)
220 + return (pte_t *)pu;
221 + else if (pshift > PMD_SHIFT) {
222 +@@ -158,6 +160,8 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
223 + } else {
224 + pdshift = PMD_SHIFT;
225 + pm = pmd_alloc(mm, pu, addr);
226 ++ if (!pm)
227 ++ return NULL;
228 + if (pshift == PMD_SHIFT)
229 + /* 16MB hugepage */
230 + return (pte_t *)pm;
231 +@@ -174,12 +178,16 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
232 + } else {
233 + pdshift = PUD_SHIFT;
234 + pu = pud_alloc(mm, pg, addr);
235 ++ if (!pu)
236 ++ return NULL;
237 + if (pshift >= PUD_SHIFT) {
238 + ptl = pud_lockptr(mm, pu);
239 + hpdp = (hugepd_t *)pu;
240 + } else {
241 + pdshift = PMD_SHIFT;
242 + pm = pmd_alloc(mm, pu, addr);
243 ++ if (!pm)
244 ++ return NULL;
245 + ptl = pmd_lockptr(mm, pm);
246 + hpdp = (hugepd_t *)pm;
247 + }
248 +diff --git a/arch/powerpc/platforms/4xx/uic.c b/arch/powerpc/platforms/4xx/uic.c
249 +index 8b4dd0da0839..9e27cfe27026 100644
250 +--- a/arch/powerpc/platforms/4xx/uic.c
251 ++++ b/arch/powerpc/platforms/4xx/uic.c
252 +@@ -158,6 +158,7 @@ static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type)
253 +
254 + mtdcr(uic->dcrbase + UIC_PR, pr);
255 + mtdcr(uic->dcrbase + UIC_TR, tr);
256 ++ mtdcr(uic->dcrbase + UIC_SR, ~mask);
257 +
258 + raw_spin_unlock_irqrestore(&uic->lock, flags);
259 +
260 +diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
261 +index f0e30dc94988..7b60fcf04dc4 100644
262 +--- a/arch/powerpc/platforms/pseries/mobility.c
263 ++++ b/arch/powerpc/platforms/pseries/mobility.c
264 +@@ -9,6 +9,7 @@
265 + * 2 as published by the Free Software Foundation.
266 + */
267 +
268 ++#include <linux/cpu.h>
269 + #include <linux/kernel.h>
270 + #include <linux/kobject.h>
271 + #include <linux/smp.h>
272 +@@ -344,11 +345,19 @@ void post_mobility_fixup(void)
273 + if (rc)
274 + printk(KERN_ERR "Post-mobility activate-fw failed: %d\n", rc);
275 +
276 ++ /*
277 ++ * We don't want CPUs to go online/offline while the device
278 ++ * tree is being updated.
279 ++ */
280 ++ cpus_read_lock();
281 ++
282 + rc = pseries_devicetree_update(MIGRATION_SCOPE);
283 + if (rc)
284 + printk(KERN_ERR "Post-mobility device tree update "
285 + "failed: %d\n", rc);
286 +
287 ++ cpus_read_unlock();
288 ++
289 + /* Possibly switch to a new RFI flush type */
290 + pseries_setup_rfi_flush();
291 +
292 +diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
293 +index 959a2a62f233..0b24b1031221 100644
294 +--- a/arch/powerpc/sysdev/xive/common.c
295 ++++ b/arch/powerpc/sysdev/xive/common.c
296 +@@ -483,7 +483,7 @@ static int xive_find_target_in_mask(const struct cpumask *mask,
297 + * Now go through the entire mask until we find a valid
298 + * target.
299 + */
300 +- for (;;) {
301 ++ do {
302 + /*
303 + * We re-check online as the fallback case passes us
304 + * an untested affinity mask
305 +@@ -491,12 +491,11 @@ static int xive_find_target_in_mask(const struct cpumask *mask,
306 + if (cpu_online(cpu) && xive_try_pick_target(cpu))
307 + return cpu;
308 + cpu = cpumask_next(cpu, mask);
309 +- if (cpu == first)
310 +- break;
311 + /* Wrap around */
312 + if (cpu >= nr_cpu_ids)
313 + cpu = cpumask_first(mask);
314 +- }
315 ++ } while (cpu != first);
316 ++
317 + return -1;
318 + }
319 +
320 +diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
321 +index dd6badc31f45..74cfc1be04d6 100644
322 +--- a/arch/powerpc/xmon/xmon.c
323 ++++ b/arch/powerpc/xmon/xmon.c
324 +@@ -466,8 +466,10 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
325 + local_irq_save(flags);
326 + hard_irq_disable();
327 +
328 +- tracing_enabled = tracing_is_on();
329 +- tracing_off();
330 ++ if (!fromipi) {
331 ++ tracing_enabled = tracing_is_on();
332 ++ tracing_off();
333 ++ }
334 +
335 + bp = in_breakpoint_table(regs->nip, &offset);
336 + if (bp != NULL) {
337 +diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
338 +index 98cb8c802b1a..0ae60d680000 100644
339 +--- a/arch/sh/include/asm/io.h
340 ++++ b/arch/sh/include/asm/io.h
341 +@@ -371,7 +371,11 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
342 +
343 + #define ioremap_nocache ioremap
344 + #define ioremap_uc ioremap
345 +-#define iounmap __iounmap
346 ++
347 ++static inline void iounmap(void __iomem *addr)
348 ++{
349 ++ __iounmap(addr);
350 ++}
351 +
352 + /*
353 + * Convert a physical pointer to a virtual kernel pointer for /dev/mem
354 +diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h
355 +index fca34b2177e2..129fb1d1f1c5 100644
356 +--- a/arch/um/include/asm/mmu_context.h
357 ++++ b/arch/um/include/asm/mmu_context.h
358 +@@ -53,7 +53,7 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
359 + * when the new ->mm is used for the first time.
360 + */
361 + __switch_mm(&new->context.id);
362 +- down_write(&new->mmap_sem);
363 ++ down_write_nested(&new->mmap_sem, 1);
364 + uml_setup_stubs(new);
365 + up_write(&new->mmap_sem);
366 + }
367 +diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
368 +index a5cde748cf76..c5690440fbd4 100644
369 +--- a/arch/x86/kernel/cpu/bugs.c
370 ++++ b/arch/x86/kernel/cpu/bugs.c
371 +@@ -1196,7 +1196,7 @@ static ssize_t l1tf_show_state(char *buf)
372 +
373 + static ssize_t mds_show_state(char *buf)
374 + {
375 +- if (!hypervisor_is_type(X86_HYPER_NATIVE)) {
376 ++ if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
377 + return sprintf(buf, "%s; SMT Host state unknown\n",
378 + mds_strings[mds_mitigation]);
379 + }
380 +diff --git a/arch/x86/kernel/sysfb_efi.c b/arch/x86/kernel/sysfb_efi.c
381 +index 623965e86b65..897da526e40e 100644
382 +--- a/arch/x86/kernel/sysfb_efi.c
383 ++++ b/arch/x86/kernel/sysfb_efi.c
384 +@@ -231,9 +231,55 @@ static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
385 + {},
386 + };
387 +
388 ++/*
389 ++ * Some devices have a portrait LCD but advertise a landscape resolution (and
390 ++ * pitch). We simply swap width and height for these devices so that we can
391 ++ * correctly deal with some of them coming with multiple resolutions.
392 ++ */
393 ++static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
394 ++ {
395 ++ /*
396 ++ * Lenovo MIIX310-10ICR, only some batches have the troublesome
397 ++ * 800x1280 portrait screen. Luckily the portrait version has
398 ++ * its own BIOS version, so we match on that.
399 ++ */
400 ++ .matches = {
401 ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
402 ++ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "MIIX 310-10ICR"),
403 ++ DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1HCN44WW"),
404 ++ },
405 ++ },
406 ++ {
407 ++ /* Lenovo MIIX 320-10ICR with 800x1280 portrait screen */
408 ++ .matches = {
409 ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
410 ++ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
411 ++ "Lenovo MIIX 320-10ICR"),
412 ++ },
413 ++ },
414 ++ {
415 ++ /* Lenovo D330 with 800x1280 or 1200x1920 portrait screen */
416 ++ .matches = {
417 ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
418 ++ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
419 ++ "Lenovo ideapad D330-10IGM"),
420 ++ },
421 ++ },
422 ++ {},
423 ++};
424 ++
425 + __init void sysfb_apply_efi_quirks(void)
426 + {
427 + if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI ||
428 + !(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS))
429 + dmi_check_system(efifb_dmi_system_table);
430 ++
431 ++ if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI &&
432 ++ dmi_check_system(efifb_dmi_swap_width_height)) {
433 ++ u16 temp = screen_info.lfb_width;
434 ++
435 ++ screen_info.lfb_width = screen_info.lfb_height;
436 ++ screen_info.lfb_height = temp;
437 ++ screen_info.lfb_linelength = 4 * screen_info.lfb_width;
438 ++ }
439 + }
440 +diff --git a/block/bio-integrity.c b/block/bio-integrity.c
441 +index 67b5fb861a51..5bd90cd4b51e 100644
442 +--- a/block/bio-integrity.c
443 ++++ b/block/bio-integrity.c
444 +@@ -291,8 +291,12 @@ bool bio_integrity_prep(struct bio *bio)
445 + ret = bio_integrity_add_page(bio, virt_to_page(buf),
446 + bytes, offset);
447 +
448 +- if (ret == 0)
449 +- return false;
450 ++ if (ret == 0) {
451 ++ printk(KERN_ERR "could not attach integrity payload\n");
452 ++ kfree(buf);
453 ++ status = BLK_STS_RESOURCE;
454 ++ goto err_end_io;
455 ++ }
456 +
457 + if (ret < bytes)
458 + break;
459 +diff --git a/block/blk-core.c b/block/blk-core.c
460 +index 682bc561b77b..9ca703bcfe3b 100644
461 +--- a/block/blk-core.c
462 ++++ b/block/blk-core.c
463 +@@ -198,6 +198,7 @@ void blk_rq_init(struct request_queue *q, struct request *rq)
464 + rq->internal_tag = -1;
465 + rq->start_time_ns = ktime_get_ns();
466 + rq->part = NULL;
467 ++ refcount_set(&rq->ref, 1);
468 + }
469 + EXPORT_SYMBOL(blk_rq_init);
470 +
471 +diff --git a/drivers/android/binder.c b/drivers/android/binder.c
472 +index 5d67f5fec6c1..1e0e438f079f 100644
473 +--- a/drivers/android/binder.c
474 ++++ b/drivers/android/binder.c
475 +@@ -2838,7 +2838,7 @@ static void binder_transaction(struct binder_proc *proc,
476 + else
477 + return_error = BR_DEAD_REPLY;
478 + mutex_unlock(&context->context_mgr_node_lock);
479 +- if (target_node && target_proc == proc) {
480 ++ if (target_node && target_proc->pid == proc->pid) {
481 + binder_user_error("%d:%d got transaction to context manager from process owning it\n",
482 + proc->pid, thread->pid);
483 + return_error = BR_FAILED_REPLY;
484 +diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
485 +index 9bffcd37cc7b..c0732f032248 100644
486 +--- a/drivers/char/hpet.c
487 ++++ b/drivers/char/hpet.c
488 +@@ -570,8 +570,7 @@ static inline unsigned long hpet_time_div(struct hpets *hpets,
489 + unsigned long long m;
490 +
491 + m = hpets->hp_tick_freq + (dis >> 1);
492 +- do_div(m, dis);
493 +- return (unsigned long)m;
494 ++ return div64_ul(m, dis);
495 + }
496 +
497 + static int
498 +diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
499 +index 1ebcef4bab5b..87337fcfbc0d 100644
500 +--- a/drivers/fpga/Kconfig
501 ++++ b/drivers/fpga/Kconfig
502 +@@ -39,6 +39,7 @@ config ALTERA_PR_IP_CORE_PLAT
503 + config FPGA_MGR_ALTERA_PS_SPI
504 + tristate "Altera FPGA Passive Serial over SPI"
505 + depends on SPI
506 ++ select BITREVERSE
507 + help
508 + FPGA manager driver support for Altera Arria/Cyclone/Stratix
509 + using the passive serial interface over SPI.
510 +diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
511 +index 72f8018fa2a8..ede27dab675f 100644
512 +--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
513 ++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
514 +@@ -1037,6 +1037,9 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev)
515 + tmp = RREG32_SOC15(HDP, 0, mmHDP_HOST_PATH_CNTL);
516 + WREG32_SOC15(HDP, 0, mmHDP_HOST_PATH_CNTL, tmp);
517 +
518 ++ WREG32_SOC15(HDP, 0, mmHDP_NONSURFACE_BASE, (adev->gmc.vram_start >> 8));
519 ++ WREG32_SOC15(HDP, 0, mmHDP_NONSURFACE_BASE_HI, (adev->gmc.vram_start >> 40));
520 ++
521 + /* After HDP is initialized, flush HDP.*/
522 + adev->nbio_funcs->hdp_flush(adev, NULL);
523 +
524 +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
525 +index 4f22e745df51..189212cb3547 100644
526 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
527 ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
528 +@@ -1268,12 +1268,17 @@ int amdkfd_fence_wait_timeout(unsigned int *fence_addr,
529 + return 0;
530 + }
531 +
532 +-static int unmap_sdma_queues(struct device_queue_manager *dqm,
533 +- unsigned int sdma_engine)
534 ++static int unmap_sdma_queues(struct device_queue_manager *dqm)
535 + {
536 +- return pm_send_unmap_queue(&dqm->packets, KFD_QUEUE_TYPE_SDMA,
537 +- KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0, false,
538 +- sdma_engine);
539 ++ int i, retval = 0;
540 ++
541 ++ for (i = 0; i < dqm->dev->device_info->num_sdma_engines; i++) {
542 ++ retval = pm_send_unmap_queue(&dqm->packets, KFD_QUEUE_TYPE_SDMA,
543 ++ KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0, false, i);
544 ++ if (retval)
545 ++ return retval;
546 ++ }
547 ++ return retval;
548 + }
549 +
550 + /* dqm->lock mutex has to be locked before calling this function */
551 +@@ -1312,10 +1317,8 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm,
552 + pr_debug("Before destroying queues, sdma queue count is : %u\n",
553 + dqm->sdma_queue_count);
554 +
555 +- if (dqm->sdma_queue_count > 0) {
556 +- unmap_sdma_queues(dqm, 0);
557 +- unmap_sdma_queues(dqm, 1);
558 +- }
559 ++ if (dqm->sdma_queue_count > 0)
560 ++ unmap_sdma_queues(dqm);
561 +
562 + retval = pm_send_unmap_queue(&dqm->packets, KFD_QUEUE_TYPE_COMPUTE,
563 + filter, filter_param, false, 0);
564 +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
565 +index 0cedb37cf513..985bebde5a34 100644
566 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
567 ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
568 +@@ -75,6 +75,7 @@ static int init_mqd(struct mqd_manager *mm, void **mqd,
569 + struct v9_mqd *m;
570 + struct kfd_dev *kfd = mm->dev;
571 +
572 ++ *mqd_mem_obj = NULL;
573 + /* From V9, for CWSR, the control stack is located on the next page
574 + * boundary after the mqd, we will use the gtt allocation function
575 + * instead of sub-allocation function.
576 +@@ -92,8 +93,10 @@ static int init_mqd(struct mqd_manager *mm, void **mqd,
577 + } else
578 + retval = kfd_gtt_sa_allocate(mm->dev, sizeof(struct v9_mqd),
579 + mqd_mem_obj);
580 +- if (retval != 0)
581 ++ if (retval) {
582 ++ kfree(*mqd_mem_obj);
583 + return -ENOMEM;
584 ++ }
585 +
586 + m = (struct v9_mqd *) (*mqd_mem_obj)->cpu_ptr;
587 + addr = (*mqd_mem_obj)->gpu_addr;
588 +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
589 +index dac7978f5ee1..221de241535a 100644
590 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
591 ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
592 +@@ -3644,6 +3644,13 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
593 + {
594 + struct amdgpu_device *adev = dm->ddev->dev_private;
595 +
596 ++ /*
597 ++ * Some of the properties below require access to state, like bpc.
598 ++ * Allocate some default initial connector state with our reset helper.
599 ++ */
600 ++ if (aconnector->base.funcs->reset)
601 ++ aconnector->base.funcs->reset(&aconnector->base);
602 ++
603 + aconnector->connector_id = link_index;
604 + aconnector->dc_link = link;
605 + aconnector->base.interlace_allowed = false;
606 +@@ -3811,9 +3818,6 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
607 + &aconnector->base,
608 + &amdgpu_dm_connector_helper_funcs);
609 +
610 +- if (aconnector->base.funcs->reset)
611 +- aconnector->base.funcs->reset(&aconnector->base);
612 +-
613 + amdgpu_dm_connector_init_helper(
614 + dm,
615 + aconnector,
616 +diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
617 +index 29294db1a96b..070ab56a8aca 100644
618 +--- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
619 ++++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
620 +@@ -474,6 +474,8 @@ void dce_abm_destroy(struct abm **abm)
621 + {
622 + struct dce_abm *abm_dce = TO_DCE_ABM(*abm);
623 +
624 ++ abm_dce->base.funcs->set_abm_immediate_disable(*abm);
625 ++
626 + kfree(abm_dce);
627 + *abm = NULL;
628 + }
629 +diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
630 +index 53ccacf99eca..c3ad2bbec1a5 100644
631 +--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
632 ++++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
633 +@@ -242,6 +242,9 @@ static void build_prescale_params(struct ipp_prescale_params *prescale_params,
634 + prescale_params->mode = IPP_PRESCALE_MODE_FIXED_UNSIGNED;
635 +
636 + switch (plane_state->format) {
637 ++ case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
638 ++ prescale_params->scale = 0x2082;
639 ++ break;
640 + case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
641 + case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
642 + prescale_params->scale = 0x2020;
643 +diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
644 +index 7736ef123e9b..ead221ccb93e 100644
645 +--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
646 ++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
647 +@@ -23,6 +23,7 @@
648 + *
649 + */
650 +
651 ++#include <linux/delay.h>
652 + #include "dm_services.h"
653 + #include "core_types.h"
654 + #include "resource.h"
655 +diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
656 +index e59a13542333..0cc6dbbcddcf 100644
657 +--- a/drivers/gpu/drm/bridge/sii902x.c
658 ++++ b/drivers/gpu/drm/bridge/sii902x.c
659 +@@ -261,10 +261,11 @@ static void sii902x_bridge_mode_set(struct drm_bridge *bridge,
660 + struct regmap *regmap = sii902x->regmap;
661 + u8 buf[HDMI_INFOFRAME_SIZE(AVI)];
662 + struct hdmi_avi_infoframe frame;
663 ++ u16 pixel_clock_10kHz = adj->clock / 10;
664 + int ret;
665 +
666 +- buf[0] = adj->clock;
667 +- buf[1] = adj->clock >> 8;
668 ++ buf[0] = pixel_clock_10kHz & 0xff;
669 ++ buf[1] = pixel_clock_10kHz >> 8;
670 + buf[2] = adj->vrefresh;
671 + buf[3] = 0x00;
672 + buf[4] = adj->hdisplay;
673 +diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
674 +index 391547358756..aaca5248da07 100644
675 +--- a/drivers/gpu/drm/bridge/tc358767.c
676 ++++ b/drivers/gpu/drm/bridge/tc358767.c
677 +@@ -1149,6 +1149,13 @@ static int tc_connector_get_modes(struct drm_connector *connector)
678 + struct tc_data *tc = connector_to_tc(connector);
679 + struct edid *edid;
680 + unsigned int count;
681 ++ int ret;
682 ++
683 ++ ret = tc_get_display_props(tc);
684 ++ if (ret < 0) {
685 ++ dev_err(tc->dev, "failed to read display props: %d\n", ret);
686 ++ return 0;
687 ++ }
688 +
689 + if (tc->panel && tc->panel->funcs && tc->panel->funcs->get_modes) {
690 + count = tc->panel->funcs->get_modes(tc->panel);
691 +diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
692 +index 99961192bf03..c88e5ff41add 100644
693 +--- a/drivers/gpu/drm/drm_debugfs_crc.c
694 ++++ b/drivers/gpu/drm/drm_debugfs_crc.c
695 +@@ -379,12 +379,13 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
696 + struct drm_crtc_crc *crc = &crtc->crc;
697 + struct drm_crtc_crc_entry *entry;
698 + int head, tail;
699 ++ unsigned long flags;
700 +
701 +- spin_lock(&crc->lock);
702 ++ spin_lock_irqsave(&crc->lock, flags);
703 +
704 + /* Caller may not have noticed yet that userspace has stopped reading */
705 + if (!crc->entries) {
706 +- spin_unlock(&crc->lock);
707 ++ spin_unlock_irqrestore(&crc->lock, flags);
708 + return -EINVAL;
709 + }
710 +
711 +@@ -395,7 +396,7 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
712 + bool was_overflow = crc->overflow;
713 +
714 + crc->overflow = true;
715 +- spin_unlock(&crc->lock);
716 ++ spin_unlock_irqrestore(&crc->lock, flags);
717 +
718 + if (!was_overflow)
719 + DRM_ERROR("Overflow of CRC buffer, userspace reads too slow.\n");
720 +@@ -411,7 +412,7 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
721 + head = (head + 1) & (DRM_CRC_ENTRIES_NR - 1);
722 + crc->head = head;
723 +
724 +- spin_unlock(&crc->lock);
725 ++ spin_unlock_irqrestore(&crc->lock, flags);
726 +
727 + wake_up_interruptible(&crc->wq);
728 +
729 +diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c
730 +index a4915099aaa9..a0e107abc40d 100644
731 +--- a/drivers/gpu/drm/drm_edid_load.c
732 ++++ b/drivers/gpu/drm/drm_edid_load.c
733 +@@ -290,6 +290,8 @@ struct edid *drm_load_edid_firmware(struct drm_connector *connector)
734 + * the last one found one as a fallback.
735 + */
736 + fwstr = kstrdup(edid_firmware, GFP_KERNEL);
737 ++ if (!fwstr)
738 ++ return ERR_PTR(-ENOMEM);
739 + edidstr = fwstr;
740 +
741 + while ((edidname = strsep(&edidstr, ","))) {
742 +diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
743 +index c1abad8a8612..ed9a3a1e50ef 100644
744 +--- a/drivers/gpu/drm/msm/msm_drv.c
745 ++++ b/drivers/gpu/drm/msm/msm_drv.c
746 +@@ -1321,16 +1321,24 @@ static int msm_pdev_probe(struct platform_device *pdev)
747 +
748 + ret = add_gpu_components(&pdev->dev, &match);
749 + if (ret)
750 +- return ret;
751 ++ goto fail;
752 +
753 + /* on all devices that I am aware of, iommu's which can map
754 + * any address the cpu can see are used:
755 + */
756 + ret = dma_set_mask_and_coherent(&pdev->dev, ~0);
757 + if (ret)
758 +- return ret;
759 ++ goto fail;
760 ++
761 ++ ret = component_master_add_with_match(&pdev->dev, &msm_drm_ops, match);
762 ++ if (ret)
763 ++ goto fail;
764 +
765 +- return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match);
766 ++ return 0;
767 ++
768 ++fail:
769 ++ of_platform_depopulate(&pdev->dev);
770 ++ return ret;
771 + }
772 +
773 + static int msm_pdev_remove(struct platform_device *pdev)
774 +diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
775 +index 97964f7f2ace..b1d41c4921dd 100644
776 +--- a/drivers/gpu/drm/panel/panel-simple.c
777 ++++ b/drivers/gpu/drm/panel/panel-simple.c
778 +@@ -2803,7 +2803,14 @@ static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
779 + dsi->format = desc->format;
780 + dsi->lanes = desc->lanes;
781 +
782 +- return mipi_dsi_attach(dsi);
783 ++ err = mipi_dsi_attach(dsi);
784 ++ if (err) {
785 ++ struct panel_simple *panel = dev_get_drvdata(&dsi->dev);
786 ++
787 ++ drm_panel_remove(&panel->base);
788 ++ }
789 ++
790 ++ return err;
791 + }
792 +
793 + static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
794 +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
795 +index f8f9ae6622eb..873624a11ce8 100644
796 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
797 ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
798 +@@ -880,7 +880,8 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc,
799 + struct vop *vop = to_vop(crtc);
800 +
801 + adjusted_mode->clock =
802 +- clk_round_rate(vop->dclk, mode->clock * 1000) / 1000;
803 ++ DIV_ROUND_UP(clk_round_rate(vop->dclk, mode->clock * 1000),
804 ++ 1000);
805 +
806 + return true;
807 + }
808 +diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
809 +index 7bdf6f0e58a5..8d2f5ded86d6 100644
810 +--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
811 ++++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
812 +@@ -528,6 +528,9 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
813 + if (!ret)
814 + return -EBUSY;
815 +
816 ++ /* is_valid check must proceed before copy of the cache entry. */
817 ++ smp_rmb();
818 ++
819 + ptr = cache_ent->caps_cache;
820 +
821 + copy_exit:
822 +diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
823 +index 020070d483d3..c8a581b1f4c4 100644
824 +--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
825 ++++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
826 +@@ -588,6 +588,8 @@ static void virtio_gpu_cmd_capset_cb(struct virtio_gpu_device *vgdev,
827 + cache_ent->id == le32_to_cpu(cmd->capset_id)) {
828 + memcpy(cache_ent->caps_cache, resp->capset_data,
829 + cache_ent->size);
830 ++ /* Copy must occur before is_valid is signalled. */
831 ++ smp_wmb();
832 + atomic_set(&cache_ent->is_valid, 1);
833 + break;
834 + }
835 +diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
836 +index 815bdb42e3f0..0121fe7a4548 100644
837 +--- a/drivers/gpu/host1x/bus.c
838 ++++ b/drivers/gpu/host1x/bus.c
839 +@@ -423,6 +423,9 @@ static int host1x_device_add(struct host1x *host1x,
840 +
841 + of_dma_configure(&device->dev, host1x->dev->of_node, true);
842 +
843 ++ device->dev.dma_parms = &device->dma_parms;
844 ++ dma_set_max_seg_size(&device->dev, SZ_4M);
845 ++
846 + err = host1x_device_parse_dt(device, driver);
847 + if (err < 0) {
848 + kfree(device);
849 +diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
850 +index a492da9fd0d3..ac9c9486b834 100644
851 +--- a/drivers/i2c/busses/i2c-stm32f7.c
852 ++++ b/drivers/i2c/busses/i2c-stm32f7.c
853 +@@ -24,7 +24,6 @@
854 + #include <linux/module.h>
855 + #include <linux/of.h>
856 + #include <linux/of_address.h>
857 +-#include <linux/of_irq.h>
858 + #include <linux/of_platform.h>
859 + #include <linux/platform_device.h>
860 + #include <linux/reset.h>
861 +@@ -1782,15 +1781,14 @@ static struct i2c_algorithm stm32f7_i2c_algo = {
862 +
863 + static int stm32f7_i2c_probe(struct platform_device *pdev)
864 + {
865 +- struct device_node *np = pdev->dev.of_node;
866 + struct stm32f7_i2c_dev *i2c_dev;
867 + const struct stm32f7_i2c_setup *setup;
868 + struct resource *res;
869 +- u32 irq_error, irq_event, clk_rate, rise_time, fall_time;
870 ++ u32 clk_rate, rise_time, fall_time;
871 + struct i2c_adapter *adap;
872 + struct reset_control *rst;
873 + dma_addr_t phy_addr;
874 +- int ret;
875 ++ int irq_error, irq_event, ret;
876 +
877 + i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL);
878 + if (!i2c_dev)
879 +@@ -1802,16 +1800,20 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
880 + return PTR_ERR(i2c_dev->base);
881 + phy_addr = (dma_addr_t)res->start;
882 +
883 +- irq_event = irq_of_parse_and_map(np, 0);
884 +- if (!irq_event) {
885 +- dev_err(&pdev->dev, "IRQ event missing or invalid\n");
886 +- return -EINVAL;
887 ++ irq_event = platform_get_irq(pdev, 0);
888 ++ if (irq_event <= 0) {
889 ++ if (irq_event != -EPROBE_DEFER)
890 ++ dev_err(&pdev->dev, "Failed to get IRQ event: %d\n",
891 ++ irq_event);
892 ++ return irq_event ? : -ENOENT;
893 + }
894 +
895 +- irq_error = irq_of_parse_and_map(np, 1);
896 +- if (!irq_error) {
897 +- dev_err(&pdev->dev, "IRQ error missing or invalid\n");
898 +- return -EINVAL;
899 ++ irq_error = platform_get_irq(pdev, 1);
900 ++ if (irq_error <= 0) {
901 ++ if (irq_error != -EPROBE_DEFER)
902 ++ dev_err(&pdev->dev, "Failed to get IRQ error: %d\n",
903 ++ irq_error);
904 ++ return irq_error ? : -ENOENT;
905 + }
906 +
907 + i2c_dev->clk = devm_clk_get(&pdev->dev, NULL);
908 +diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
909 +index fcd4a1c00ca0..15a115210108 100644
910 +--- a/drivers/iio/adc/stm32-dfsdm-adc.c
911 ++++ b/drivers/iio/adc/stm32-dfsdm-adc.c
912 +@@ -1144,6 +1144,12 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
913 + * So IRQ associated to filter instance 0 is dedicated to the Filter 0.
914 + */
915 + irq = platform_get_irq(pdev, 0);
916 ++ if (irq < 0) {
917 ++ if (irq != -EPROBE_DEFER)
918 ++ dev_err(dev, "Failed to get IRQ: %d\n", irq);
919 ++ return irq;
920 ++ }
921 ++
922 + ret = devm_request_irq(dev, irq, stm32_dfsdm_irq,
923 + 0, pdev->name, adc);
924 + if (ret < 0) {
925 +diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c
926 +index bf089f5d6225..941630615e88 100644
927 +--- a/drivers/iio/adc/stm32-dfsdm-core.c
928 ++++ b/drivers/iio/adc/stm32-dfsdm-core.c
929 +@@ -213,6 +213,8 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev,
930 + }
931 + priv->dfsdm.phys_base = res->start;
932 + priv->dfsdm.base = devm_ioremap_resource(&pdev->dev, res);
933 ++ if (IS_ERR(priv->dfsdm.base))
934 ++ return PTR_ERR(priv->dfsdm.base);
935 +
936 + /*
937 + * "dfsdm" clock is mandatory for DFSDM peripheral clocking.
938 +@@ -222,8 +224,10 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev,
939 + */
940 + priv->clk = devm_clk_get(&pdev->dev, "dfsdm");
941 + if (IS_ERR(priv->clk)) {
942 +- dev_err(&pdev->dev, "No stm32_dfsdm_clk clock found\n");
943 +- return -EINVAL;
944 ++ ret = PTR_ERR(priv->clk);
945 ++ if (ret != -EPROBE_DEFER)
946 ++ dev_err(&pdev->dev, "Failed to get clock (%d)\n", ret);
947 ++ return ret;
948 + }
949 +
950 + priv->aclk = devm_clk_get(&pdev->dev, "audio");
951 +diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
952 +index e2e6c74a7452..a5e3349b8a7c 100644
953 +--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
954 ++++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
955 +@@ -806,6 +806,8 @@ static int i40iw_query_qp(struct ib_qp *ibqp,
956 + struct i40iw_qp *iwqp = to_iwqp(ibqp);
957 + struct i40iw_sc_qp *qp = &iwqp->sc_qp;
958 +
959 ++ attr->qp_state = iwqp->ibqp_state;
960 ++ attr->cur_qp_state = attr->qp_state;
961 + attr->qp_access_flags = 0;
962 + attr->cap.max_send_wr = qp->qp_uk.sq_size;
963 + attr->cap.max_recv_wr = qp->qp_uk.rq_size;
964 +diff --git a/drivers/infiniband/hw/mlx5/mad.c b/drivers/infiniband/hw/mlx5/mad.c
965 +index 32a9e9228b13..cdf6e26ebc87 100644
966 +--- a/drivers/infiniband/hw/mlx5/mad.c
967 ++++ b/drivers/infiniband/hw/mlx5/mad.c
968 +@@ -197,19 +197,33 @@ static void pma_cnt_assign(struct ib_pma_portcounters *pma_cnt,
969 + vl_15_dropped);
970 + }
971 +
972 +-static int process_pma_cmd(struct mlx5_core_dev *mdev, u8 port_num,
973 ++static int process_pma_cmd(struct mlx5_ib_dev *dev, u8 port_num,
974 + const struct ib_mad *in_mad, struct ib_mad *out_mad)
975 + {
976 +- int err;
977 ++ struct mlx5_core_dev *mdev;
978 ++ bool native_port = true;
979 ++ u8 mdev_port_num;
980 + void *out_cnt;
981 ++ int err;
982 +
983 ++ mdev = mlx5_ib_get_native_port_mdev(dev, port_num, &mdev_port_num);
984 ++ if (!mdev) {
985 ++ /* Fail to get the native port, likely due to 2nd port is still
986 ++ * unaffiliated. In such case default to 1st port and attached
987 ++ * PF device.
988 ++ */
989 ++ native_port = false;
990 ++ mdev = dev->mdev;
991 ++ mdev_port_num = 1;
992 ++ }
993 + /* Declaring support of extended counters */
994 + if (in_mad->mad_hdr.attr_id == IB_PMA_CLASS_PORT_INFO) {
995 + struct ib_class_port_info cpi = {};
996 +
997 + cpi.capability_mask = IB_PMA_CLASS_CAP_EXT_WIDTH;
998 + memcpy((out_mad->data + 40), &cpi, sizeof(cpi));
999 +- return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY;
1000 ++ err = IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY;
1001 ++ goto done;
1002 + }
1003 +
1004 + if (in_mad->mad_hdr.attr_id == IB_PMA_PORT_COUNTERS_EXT) {
1005 +@@ -218,11 +232,13 @@ static int process_pma_cmd(struct mlx5_core_dev *mdev, u8 port_num,
1006 + int sz = MLX5_ST_SZ_BYTES(query_vport_counter_out);
1007 +
1008 + out_cnt = kvzalloc(sz, GFP_KERNEL);
1009 +- if (!out_cnt)
1010 +- return IB_MAD_RESULT_FAILURE;
1011 ++ if (!out_cnt) {
1012 ++ err = IB_MAD_RESULT_FAILURE;
1013 ++ goto done;
1014 ++ }
1015 +
1016 + err = mlx5_core_query_vport_counter(mdev, 0, 0,
1017 +- port_num, out_cnt, sz);
1018 ++ mdev_port_num, out_cnt, sz);
1019 + if (!err)
1020 + pma_cnt_ext_assign(pma_cnt_ext, out_cnt);
1021 + } else {
1022 +@@ -231,20 +247,23 @@ static int process_pma_cmd(struct mlx5_core_dev *mdev, u8 port_num,
1023 + int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
1024 +
1025 + out_cnt = kvzalloc(sz, GFP_KERNEL);
1026 +- if (!out_cnt)
1027 +- return IB_MAD_RESULT_FAILURE;
1028 ++ if (!out_cnt) {
1029 ++ err = IB_MAD_RESULT_FAILURE;
1030 ++ goto done;
1031 ++ }
1032 +
1033 +- err = mlx5_core_query_ib_ppcnt(mdev, port_num,
1034 ++ err = mlx5_core_query_ib_ppcnt(mdev, mdev_port_num,
1035 + out_cnt, sz);
1036 + if (!err)
1037 + pma_cnt_assign(pma_cnt, out_cnt);
1038 +- }
1039 +-
1040 ++ }
1041 + kvfree(out_cnt);
1042 +- if (err)
1043 +- return IB_MAD_RESULT_FAILURE;
1044 +-
1045 +- return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY;
1046 ++ err = err ? IB_MAD_RESULT_FAILURE :
1047 ++ IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY;
1048 ++done:
1049 ++ if (native_port)
1050 ++ mlx5_ib_put_native_port_mdev(dev, port_num);
1051 ++ return err;
1052 + }
1053 +
1054 + int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
1055 +@@ -256,8 +275,6 @@ int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
1056 + struct mlx5_ib_dev *dev = to_mdev(ibdev);
1057 + const struct ib_mad *in_mad = (const struct ib_mad *)in;
1058 + struct ib_mad *out_mad = (struct ib_mad *)out;
1059 +- struct mlx5_core_dev *mdev;
1060 +- u8 mdev_port_num;
1061 + int ret;
1062 +
1063 + if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
1064 +@@ -266,19 +283,14 @@ int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
1065 +
1066 + memset(out_mad->data, 0, sizeof(out_mad->data));
1067 +
1068 +- mdev = mlx5_ib_get_native_port_mdev(dev, port_num, &mdev_port_num);
1069 +- if (!mdev)
1070 +- return IB_MAD_RESULT_FAILURE;
1071 +-
1072 +- if (MLX5_CAP_GEN(mdev, vport_counters) &&
1073 ++ if (MLX5_CAP_GEN(dev->mdev, vport_counters) &&
1074 + in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT &&
1075 + in_mad->mad_hdr.method == IB_MGMT_METHOD_GET) {
1076 +- ret = process_pma_cmd(mdev, mdev_port_num, in_mad, out_mad);
1077 ++ ret = process_pma_cmd(dev, port_num, in_mad, out_mad);
1078 + } else {
1079 + ret = process_mad(ibdev, mad_flags, port_num, in_wc, in_grh,
1080 + in_mad, out_mad);
1081 + }
1082 +- mlx5_ib_put_native_port_mdev(dev, port_num);
1083 + return ret;
1084 + }
1085 +
1086 +diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
1087 +index 4111b798fd3c..681d8e0913d0 100644
1088 +--- a/drivers/infiniband/sw/rxe/rxe_resp.c
1089 ++++ b/drivers/infiniband/sw/rxe/rxe_resp.c
1090 +@@ -435,6 +435,7 @@ static enum resp_states check_rkey(struct rxe_qp *qp,
1091 + qp->resp.va = reth_va(pkt);
1092 + qp->resp.rkey = reth_rkey(pkt);
1093 + qp->resp.resid = reth_len(pkt);
1094 ++ qp->resp.length = reth_len(pkt);
1095 + }
1096 + access = (pkt->mask & RXE_READ_MASK) ? IB_ACCESS_REMOTE_READ
1097 + : IB_ACCESS_REMOTE_WRITE;
1098 +@@ -859,7 +860,9 @@ static enum resp_states do_complete(struct rxe_qp *qp,
1099 + pkt->mask & RXE_WRITE_MASK) ?
1100 + IB_WC_RECV_RDMA_WITH_IMM : IB_WC_RECV;
1101 + wc->vendor_err = 0;
1102 +- wc->byte_len = wqe->dma.length - wqe->dma.resid;
1103 ++ wc->byte_len = (pkt->mask & RXE_IMMDT_MASK &&
1104 ++ pkt->mask & RXE_WRITE_MASK) ?
1105 ++ qp->resp.length : wqe->dma.length - wqe->dma.resid;
1106 +
1107 + /* fields after byte_len are different between kernel and user
1108 + * space
1109 +diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
1110 +index 332a16dad2a7..3b731c7682e5 100644
1111 +--- a/drivers/infiniband/sw/rxe/rxe_verbs.h
1112 ++++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
1113 +@@ -212,6 +212,7 @@ struct rxe_resp_info {
1114 + struct rxe_mem *mr;
1115 + u32 resid;
1116 + u32 rkey;
1117 ++ u32 length;
1118 + u64 atomic_orig;
1119 +
1120 + /* SRQ only */
1121 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1122 +index 009615499b37..78dd36daac00 100644
1123 +--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
1124 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1125 +@@ -1892,12 +1892,6 @@ static void ipoib_child_init(struct net_device *ndev)
1126 + struct ipoib_dev_priv *priv = ipoib_priv(ndev);
1127 + struct ipoib_dev_priv *ppriv = ipoib_priv(priv->parent);
1128 +
1129 +- dev_hold(priv->parent);
1130 +-
1131 +- down_write(&ppriv->vlan_rwsem);
1132 +- list_add_tail(&priv->list, &ppriv->child_intfs);
1133 +- up_write(&ppriv->vlan_rwsem);
1134 +-
1135 + priv->max_ib_mtu = ppriv->max_ib_mtu;
1136 + set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
1137 + memcpy(priv->dev->dev_addr, ppriv->dev->dev_addr, INFINIBAND_ALEN);
1138 +@@ -1940,6 +1934,17 @@ static int ipoib_ndo_init(struct net_device *ndev)
1139 + if (rc) {
1140 + pr_warn("%s: failed to initialize device: %s port %d (ret = %d)\n",
1141 + priv->ca->name, priv->dev->name, priv->port, rc);
1142 ++ return rc;
1143 ++ }
1144 ++
1145 ++ if (priv->parent) {
1146 ++ struct ipoib_dev_priv *ppriv = ipoib_priv(priv->parent);
1147 ++
1148 ++ dev_hold(priv->parent);
1149 ++
1150 ++ down_write(&ppriv->vlan_rwsem);
1151 ++ list_add_tail(&priv->list, &ppriv->child_intfs);
1152 ++ up_write(&ppriv->vlan_rwsem);
1153 + }
1154 +
1155 + return 0;
1156 +@@ -1957,6 +1962,14 @@ static void ipoib_ndo_uninit(struct net_device *dev)
1157 + */
1158 + WARN_ON(!list_empty(&priv->child_intfs));
1159 +
1160 ++ if (priv->parent) {
1161 ++ struct ipoib_dev_priv *ppriv = ipoib_priv(priv->parent);
1162 ++
1163 ++ down_write(&ppriv->vlan_rwsem);
1164 ++ list_del(&priv->list);
1165 ++ up_write(&ppriv->vlan_rwsem);
1166 ++ }
1167 ++
1168 + ipoib_neigh_hash_uninit(dev);
1169 +
1170 + ipoib_ib_dev_cleanup(dev);
1171 +@@ -1968,15 +1981,8 @@ static void ipoib_ndo_uninit(struct net_device *dev)
1172 + priv->wq = NULL;
1173 + }
1174 +
1175 +- if (priv->parent) {
1176 +- struct ipoib_dev_priv *ppriv = ipoib_priv(priv->parent);
1177 +-
1178 +- down_write(&ppriv->vlan_rwsem);
1179 +- list_del(&priv->list);
1180 +- up_write(&ppriv->vlan_rwsem);
1181 +-
1182 ++ if (priv->parent)
1183 + dev_put(priv->parent);
1184 +- }
1185 + }
1186 +
1187 + static int ipoib_set_vf_link_state(struct net_device *dev, int vf, int link_state)
1188 +diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
1189 +index 674b35f402f5..055c90b8253c 100644
1190 +--- a/drivers/mailbox/mailbox.c
1191 ++++ b/drivers/mailbox/mailbox.c
1192 +@@ -391,11 +391,13 @@ struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl,
1193 +
1194 + of_property_for_each_string(np, "mbox-names", prop, mbox_name) {
1195 + if (!strncmp(name, mbox_name, strlen(name)))
1196 +- break;
1197 ++ return mbox_request_channel(cl, index);
1198 + index++;
1199 + }
1200 +
1201 +- return mbox_request_channel(cl, index);
1202 ++ dev_err(cl->dev, "%s() could not locate channel named \"%s\"\n",
1203 ++ __func__, name);
1204 ++ return ERR_PTR(-EINVAL);
1205 + }
1206 + EXPORT_SYMBOL_GPL(mbox_request_channel_byname);
1207 +
1208 +diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
1209 +index 1246d69ba187..b1564cacd19e 100644
1210 +--- a/drivers/memstick/core/memstick.c
1211 ++++ b/drivers/memstick/core/memstick.c
1212 +@@ -629,13 +629,18 @@ static int __init memstick_init(void)
1213 + return -ENOMEM;
1214 +
1215 + rc = bus_register(&memstick_bus_type);
1216 +- if (!rc)
1217 +- rc = class_register(&memstick_host_class);
1218 ++ if (rc)
1219 ++ goto error_destroy_workqueue;
1220 +
1221 +- if (!rc)
1222 +- return 0;
1223 ++ rc = class_register(&memstick_host_class);
1224 ++ if (rc)
1225 ++ goto error_bus_unregister;
1226 ++
1227 ++ return 0;
1228 +
1229 ++error_bus_unregister:
1230 + bus_unregister(&memstick_bus_type);
1231 ++error_destroy_workqueue:
1232 + destroy_workqueue(workqueue);
1233 +
1234 + return rc;
1235 +diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
1236 +index 5f1e37d23943..47d6d40f41cd 100644
1237 +--- a/drivers/mfd/arizona-core.c
1238 ++++ b/drivers/mfd/arizona-core.c
1239 +@@ -996,7 +996,7 @@ int arizona_dev_init(struct arizona *arizona)
1240 + unsigned int reg, val;
1241 + int (*apply_patch)(struct arizona *) = NULL;
1242 + const struct mfd_cell *subdevs = NULL;
1243 +- int n_subdevs, ret, i;
1244 ++ int n_subdevs = 0, ret, i;
1245 +
1246 + dev_set_drvdata(arizona->dev, arizona);
1247 + mutex_init(&arizona->clk_lock);
1248 +diff --git a/drivers/mfd/hi655x-pmic.c b/drivers/mfd/hi655x-pmic.c
1249 +index 96c07fa1802a..6693f74aa6ab 100644
1250 +--- a/drivers/mfd/hi655x-pmic.c
1251 ++++ b/drivers/mfd/hi655x-pmic.c
1252 +@@ -112,6 +112,8 @@ static int hi655x_pmic_probe(struct platform_device *pdev)
1253 +
1254 + pmic->regmap = devm_regmap_init_mmio_clk(dev, NULL, base,
1255 + &hi655x_regmap_config);
1256 ++ if (IS_ERR(pmic->regmap))
1257 ++ return PTR_ERR(pmic->regmap);
1258 +
1259 + regmap_read(pmic->regmap, HI655X_BUS_ADDR(HI655X_VER_REG), &pmic->ver);
1260 + if ((pmic->ver < PMU_VER_START) || (pmic->ver > PMU_VER_END)) {
1261 +diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c
1262 +index 8cfea969b060..45c7d8b97349 100644
1263 +--- a/drivers/mfd/madera-core.c
1264 ++++ b/drivers/mfd/madera-core.c
1265 +@@ -278,6 +278,7 @@ const struct of_device_id madera_of_match[] = {
1266 + { .compatible = "cirrus,wm1840", .data = (void *)WM1840 },
1267 + {}
1268 + };
1269 ++MODULE_DEVICE_TABLE(of, madera_of_match);
1270 + EXPORT_SYMBOL_GPL(madera_of_match);
1271 +
1272 + static int madera_get_reset_gpio(struct madera *madera)
1273 +diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
1274 +index 94e3f32ce935..182973df1aed 100644
1275 +--- a/drivers/mfd/mfd-core.c
1276 ++++ b/drivers/mfd/mfd-core.c
1277 +@@ -179,6 +179,7 @@ static int mfd_add_device(struct device *parent, int id,
1278 + for_each_child_of_node(parent->of_node, np) {
1279 + if (of_device_is_compatible(np, cell->of_compatible)) {
1280 + pdev->dev.of_node = np;
1281 ++ pdev->dev.fwnode = &np->fwnode;
1282 + break;
1283 + }
1284 + }
1285 +diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
1286 +index bb1ee9834a02..225373e4a9ef 100644
1287 +--- a/drivers/misc/mei/hw-me-regs.h
1288 ++++ b/drivers/misc/mei/hw-me-regs.h
1289 +@@ -141,6 +141,9 @@
1290 +
1291 + #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */
1292 +
1293 ++#define MEI_DEV_ID_MCC 0x4B70 /* Mule Creek Canyon (EHL) */
1294 ++#define MEI_DEV_ID_MCC_4 0x4B75 /* Mule Creek Canyon 4 (EHL) */
1295 ++
1296 + /*
1297 + * MEI HW Section
1298 + */
1299 +diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
1300 +index 4299658d48d6..a66ebceea408 100644
1301 +--- a/drivers/misc/mei/pci-me.c
1302 ++++ b/drivers/misc/mei/pci-me.c
1303 +@@ -107,6 +107,9 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
1304 +
1305 + {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)},
1306 +
1307 ++ {MEI_PCI_DEVICE(MEI_DEV_ID_MCC, MEI_ME_PCH12_CFG)},
1308 ++ {MEI_PCI_DEVICE(MEI_DEV_ID_MCC_4, MEI_ME_PCH8_CFG)},
1309 ++
1310 + /* required last entry */
1311 + {0, }
1312 + };
1313 +diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
1314 +index fa8d9da2ab7f..e248d7945c06 100644
1315 +--- a/drivers/mmc/host/sdhci-pci-o2micro.c
1316 ++++ b/drivers/mmc/host/sdhci-pci-o2micro.c
1317 +@@ -290,11 +290,21 @@ int sdhci_pci_o2_probe_slot(struct sdhci_pci_slot *slot)
1318 + {
1319 + struct sdhci_pci_chip *chip;
1320 + struct sdhci_host *host;
1321 +- u32 reg;
1322 ++ u32 reg, caps;
1323 + int ret;
1324 +
1325 + chip = slot->chip;
1326 + host = slot->host;
1327 ++
1328 ++ caps = sdhci_readl(host, SDHCI_CAPABILITIES);
1329 ++
1330 ++ /*
1331 ++ * mmc_select_bus_width() will test the bus to determine the actual bus
1332 ++ * width.
1333 ++ */
1334 ++ if (caps & SDHCI_CAN_DO_8BIT)
1335 ++ host->mmc->caps |= MMC_CAP_8_BIT_DATA;
1336 ++
1337 + switch (chip->pdev->device) {
1338 + case PCI_DEVICE_ID_O2_SDS0:
1339 + case PCI_DEVICE_ID_O2_SEABIRD0:
1340 +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
1341 +index d97e0d7e541a..b766362031c3 100644
1342 +--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
1343 ++++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
1344 +@@ -1065,14 +1065,12 @@ static void cudbg_t4_fwcache(struct cudbg_init *pdbg_init,
1345 + }
1346 + }
1347 +
1348 +-static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
1349 +- struct cudbg_buffer *dbg_buff,
1350 +- struct cudbg_error *cudbg_err,
1351 +- u8 mem_type)
1352 ++static unsigned long cudbg_mem_region_size(struct cudbg_init *pdbg_init,
1353 ++ struct cudbg_error *cudbg_err,
1354 ++ u8 mem_type)
1355 + {
1356 + struct adapter *padap = pdbg_init->adap;
1357 + struct cudbg_meminfo mem_info;
1358 +- unsigned long size;
1359 + u8 mc_idx;
1360 + int rc;
1361 +
1362 +@@ -1086,7 +1084,16 @@ static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
1363 + if (rc)
1364 + return rc;
1365 +
1366 +- size = mem_info.avail[mc_idx].limit - mem_info.avail[mc_idx].base;
1367 ++ return mem_info.avail[mc_idx].limit - mem_info.avail[mc_idx].base;
1368 ++}
1369 ++
1370 ++static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
1371 ++ struct cudbg_buffer *dbg_buff,
1372 ++ struct cudbg_error *cudbg_err,
1373 ++ u8 mem_type)
1374 ++{
1375 ++ unsigned long size = cudbg_mem_region_size(pdbg_init, cudbg_err, mem_type);
1376 ++
1377 + return cudbg_read_fw_mem(pdbg_init, dbg_buff, mem_type, size,
1378 + cudbg_err);
1379 + }
1380 +diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
1381 +index a3132a9eb91c..ee39e2c1644a 100644
1382 +--- a/drivers/nvdimm/bus.c
1383 ++++ b/drivers/nvdimm/bus.c
1384 +@@ -86,7 +86,7 @@ static void nvdimm_bus_probe_end(struct nvdimm_bus *nvdimm_bus)
1385 + {
1386 + nvdimm_bus_lock(&nvdimm_bus->dev);
1387 + if (--nvdimm_bus->probe_active == 0)
1388 +- wake_up(&nvdimm_bus->probe_wait);
1389 ++ wake_up(&nvdimm_bus->wait);
1390 + nvdimm_bus_unlock(&nvdimm_bus->dev);
1391 + }
1392 +
1393 +@@ -348,7 +348,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
1394 + return NULL;
1395 + INIT_LIST_HEAD(&nvdimm_bus->list);
1396 + INIT_LIST_HEAD(&nvdimm_bus->mapping_list);
1397 +- init_waitqueue_head(&nvdimm_bus->probe_wait);
1398 ++ init_waitqueue_head(&nvdimm_bus->wait);
1399 + nvdimm_bus->id = ida_simple_get(&nd_ida, 0, 0, GFP_KERNEL);
1400 + mutex_init(&nvdimm_bus->reconfig_mutex);
1401 + badrange_init(&nvdimm_bus->badrange);
1402 +@@ -418,6 +418,9 @@ static int nd_bus_remove(struct device *dev)
1403 + list_del_init(&nvdimm_bus->list);
1404 + mutex_unlock(&nvdimm_bus_list_mutex);
1405 +
1406 ++ wait_event(nvdimm_bus->wait,
1407 ++ atomic_read(&nvdimm_bus->ioctl_active) == 0);
1408 ++
1409 + nd_synchronize();
1410 + device_for_each_child(&nvdimm_bus->dev, NULL, child_unregister);
1411 +
1412 +@@ -838,7 +841,7 @@ void wait_nvdimm_bus_probe_idle(struct device *dev)
1413 + if (nvdimm_bus->probe_active == 0)
1414 + break;
1415 + nvdimm_bus_unlock(&nvdimm_bus->dev);
1416 +- wait_event(nvdimm_bus->probe_wait,
1417 ++ wait_event(nvdimm_bus->wait,
1418 + nvdimm_bus->probe_active == 0);
1419 + nvdimm_bus_lock(&nvdimm_bus->dev);
1420 + } while (true);
1421 +@@ -1068,24 +1071,10 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
1422 + return rc;
1423 + }
1424 +
1425 +-static long nd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1426 +-{
1427 +- long id = (long) file->private_data;
1428 +- int rc = -ENXIO, ro;
1429 +- struct nvdimm_bus *nvdimm_bus;
1430 +-
1431 +- ro = ((file->f_flags & O_ACCMODE) == O_RDONLY);
1432 +- mutex_lock(&nvdimm_bus_list_mutex);
1433 +- list_for_each_entry(nvdimm_bus, &nvdimm_bus_list, list) {
1434 +- if (nvdimm_bus->id == id) {
1435 +- rc = __nd_ioctl(nvdimm_bus, NULL, ro, cmd, arg);
1436 +- break;
1437 +- }
1438 +- }
1439 +- mutex_unlock(&nvdimm_bus_list_mutex);
1440 +-
1441 +- return rc;
1442 +-}
1443 ++enum nd_ioctl_mode {
1444 ++ BUS_IOCTL,
1445 ++ DIMM_IOCTL,
1446 ++};
1447 +
1448 + static int match_dimm(struct device *dev, void *data)
1449 + {
1450 +@@ -1100,31 +1089,62 @@ static int match_dimm(struct device *dev, void *data)
1451 + return 0;
1452 + }
1453 +
1454 +-static long nvdimm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1455 ++static long nd_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
1456 ++ enum nd_ioctl_mode mode)
1457 ++
1458 + {
1459 +- int rc = -ENXIO, ro;
1460 +- struct nvdimm_bus *nvdimm_bus;
1461 ++ struct nvdimm_bus *nvdimm_bus, *found = NULL;
1462 ++ long id = (long) file->private_data;
1463 ++ struct nvdimm *nvdimm = NULL;
1464 ++ int rc, ro;
1465 +
1466 + ro = ((file->f_flags & O_ACCMODE) == O_RDONLY);
1467 + mutex_lock(&nvdimm_bus_list_mutex);
1468 + list_for_each_entry(nvdimm_bus, &nvdimm_bus_list, list) {
1469 +- struct device *dev = device_find_child(&nvdimm_bus->dev,
1470 +- file->private_data, match_dimm);
1471 +- struct nvdimm *nvdimm;
1472 +-
1473 +- if (!dev)
1474 +- continue;
1475 ++ if (mode == DIMM_IOCTL) {
1476 ++ struct device *dev;
1477 ++
1478 ++ dev = device_find_child(&nvdimm_bus->dev,
1479 ++ file->private_data, match_dimm);
1480 ++ if (!dev)
1481 ++ continue;
1482 ++ nvdimm = to_nvdimm(dev);
1483 ++ found = nvdimm_bus;
1484 ++ } else if (nvdimm_bus->id == id) {
1485 ++ found = nvdimm_bus;
1486 ++ }
1487 +
1488 +- nvdimm = to_nvdimm(dev);
1489 +- rc = __nd_ioctl(nvdimm_bus, nvdimm, ro, cmd, arg);
1490 +- put_device(dev);
1491 +- break;
1492 ++ if (found) {
1493 ++ atomic_inc(&nvdimm_bus->ioctl_active);
1494 ++ break;
1495 ++ }
1496 + }
1497 + mutex_unlock(&nvdimm_bus_list_mutex);
1498 +
1499 ++ if (!found)
1500 ++ return -ENXIO;
1501 ++
1502 ++ nvdimm_bus = found;
1503 ++ rc = __nd_ioctl(nvdimm_bus, nvdimm, ro, cmd, arg);
1504 ++
1505 ++ if (nvdimm)
1506 ++ put_device(&nvdimm->dev);
1507 ++ if (atomic_dec_and_test(&nvdimm_bus->ioctl_active))
1508 ++ wake_up(&nvdimm_bus->wait);
1509 ++
1510 + return rc;
1511 + }
1512 +
1513 ++static long bus_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1514 ++{
1515 ++ return nd_ioctl(file, cmd, arg, BUS_IOCTL);
1516 ++}
1517 ++
1518 ++static long dimm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1519 ++{
1520 ++ return nd_ioctl(file, cmd, arg, DIMM_IOCTL);
1521 ++}
1522 ++
1523 + static int nd_open(struct inode *inode, struct file *file)
1524 + {
1525 + long minor = iminor(inode);
1526 +@@ -1136,16 +1156,16 @@ static int nd_open(struct inode *inode, struct file *file)
1527 + static const struct file_operations nvdimm_bus_fops = {
1528 + .owner = THIS_MODULE,
1529 + .open = nd_open,
1530 +- .unlocked_ioctl = nd_ioctl,
1531 +- .compat_ioctl = nd_ioctl,
1532 ++ .unlocked_ioctl = bus_ioctl,
1533 ++ .compat_ioctl = bus_ioctl,
1534 + .llseek = noop_llseek,
1535 + };
1536 +
1537 + static const struct file_operations nvdimm_fops = {
1538 + .owner = THIS_MODULE,
1539 + .open = nd_open,
1540 +- .unlocked_ioctl = nvdimm_ioctl,
1541 +- .compat_ioctl = nvdimm_ioctl,
1542 ++ .unlocked_ioctl = dimm_ioctl,
1543 ++ .compat_ioctl = dimm_ioctl,
1544 + .llseek = noop_llseek,
1545 + };
1546 +
1547 +diff --git a/drivers/nvdimm/nd-core.h b/drivers/nvdimm/nd-core.h
1548 +index 5ff254dc9b14..adf62a6c0fe2 100644
1549 +--- a/drivers/nvdimm/nd-core.h
1550 ++++ b/drivers/nvdimm/nd-core.h
1551 +@@ -25,10 +25,11 @@ extern int nvdimm_major;
1552 +
1553 + struct nvdimm_bus {
1554 + struct nvdimm_bus_descriptor *nd_desc;
1555 +- wait_queue_head_t probe_wait;
1556 ++ wait_queue_head_t wait;
1557 + struct list_head list;
1558 + struct device dev;
1559 + int id, probe_active;
1560 ++ atomic_t ioctl_active;
1561 + struct list_head mapping_list;
1562 + struct mutex reconfig_mutex;
1563 + struct badrange badrange;
1564 +diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
1565 +index a32d6dde7a57..412524aa1fde 100644
1566 +--- a/drivers/pci/controller/dwc/pci-dra7xx.c
1567 ++++ b/drivers/pci/controller/dwc/pci-dra7xx.c
1568 +@@ -26,6 +26,7 @@
1569 + #include <linux/types.h>
1570 + #include <linux/mfd/syscon.h>
1571 + #include <linux/regmap.h>
1572 ++#include <linux/gpio/consumer.h>
1573 +
1574 + #include "../../pci.h"
1575 + #include "pcie-designware.h"
1576 +diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c
1577 +index a939e8d31735..a2d1e89d4867 100644
1578 +--- a/drivers/pci/controller/pcie-mobiveil.c
1579 ++++ b/drivers/pci/controller/pcie-mobiveil.c
1580 +@@ -508,6 +508,12 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie)
1581 + return err;
1582 + }
1583 +
1584 ++ /* setup bus numbers */
1585 ++ value = csr_readl(pcie, PCI_PRIMARY_BUS);
1586 ++ value &= 0xff000000;
1587 ++ value |= 0x00ff0100;
1588 ++ csr_writel(pcie, value, PCI_PRIMARY_BUS);
1589 ++
1590 + /*
1591 + * program Bus Master Enable Bit in Command Register in PAB Config
1592 + * Space
1593 +@@ -547,7 +553,7 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie)
1594 + resource_size(pcie->ob_io_res));
1595 +
1596 + /* memory inbound translation window */
1597 +- program_ib_windows(pcie, WIN_NUM_1, 0, MEM_WINDOW_TYPE, IB_WIN_SIZE);
1598 ++ program_ib_windows(pcie, WIN_NUM_0, 0, MEM_WINDOW_TYPE, IB_WIN_SIZE);
1599 +
1600 + /* Get the I/O and memory ranges from DT */
1601 + resource_list_for_each_entry_safe(win, tmp, &pcie->resources) {
1602 +@@ -559,11 +565,18 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie)
1603 + if (type) {
1604 + /* configure outbound translation window */
1605 + program_ob_windows(pcie, pcie->ob_wins_configured,
1606 +- win->res->start, 0, type,
1607 +- resource_size(win->res));
1608 ++ win->res->start,
1609 ++ win->res->start - win->offset,
1610 ++ type, resource_size(win->res));
1611 + }
1612 + }
1613 +
1614 ++ /* fixup for PCIe class register */
1615 ++ value = csr_readl(pcie, PAB_INTP_AXI_PIO_CLASS);
1616 ++ value &= 0xff;
1617 ++ value |= (PCI_CLASS_BRIDGE_PCI << 16);
1618 ++ csr_writel(pcie, value, PAB_INTP_AXI_PIO_CLASS);
1619 ++
1620 + /* setup MSI hardware registers */
1621 + mobiveil_pcie_enable_msi(pcie);
1622 +
1623 +@@ -804,9 +817,6 @@ static int mobiveil_pcie_probe(struct platform_device *pdev)
1624 + goto error;
1625 + }
1626 +
1627 +- /* fixup for PCIe class register */
1628 +- csr_writel(pcie, 0x060402ab, PAB_INTP_AXI_PIO_CLASS);
1629 +-
1630 + /* initialize the IRQ domains */
1631 + ret = mobiveil_pcie_init_irq_domain(pcie);
1632 + if (ret) {
1633 +diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c
1634 +index fb32840ce8e6..4850a1b8eec1 100644
1635 +--- a/drivers/pci/controller/pcie-xilinx-nwl.c
1636 ++++ b/drivers/pci/controller/pcie-xilinx-nwl.c
1637 +@@ -483,15 +483,13 @@ static int nwl_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
1638 + int i;
1639 +
1640 + mutex_lock(&msi->lock);
1641 +- bit = bitmap_find_next_zero_area(msi->bitmap, INT_PCI_MSI_NR, 0,
1642 +- nr_irqs, 0);
1643 +- if (bit >= INT_PCI_MSI_NR) {
1644 ++ bit = bitmap_find_free_region(msi->bitmap, INT_PCI_MSI_NR,
1645 ++ get_count_order(nr_irqs));
1646 ++ if (bit < 0) {
1647 + mutex_unlock(&msi->lock);
1648 + return -ENOSPC;
1649 + }
1650 +
1651 +- bitmap_set(msi->bitmap, bit, nr_irqs);
1652 +-
1653 + for (i = 0; i < nr_irqs; i++) {
1654 + irq_domain_set_info(domain, virq + i, bit + i, &nwl_irq_chip,
1655 + domain->host_data, handle_simple_irq,
1656 +@@ -509,7 +507,8 @@ static void nwl_irq_domain_free(struct irq_domain *domain, unsigned int virq,
1657 + struct nwl_msi *msi = &pcie->msi;
1658 +
1659 + mutex_lock(&msi->lock);
1660 +- bitmap_clear(msi->bitmap, data->hwirq, nr_irqs);
1661 ++ bitmap_release_region(msi->bitmap, data->hwirq,
1662 ++ get_count_order(nr_irqs));
1663 + mutex_unlock(&msi->lock);
1664 + }
1665 +
1666 +diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
1667 +index 33f3f475e5c6..956ee7527d2c 100644
1668 +--- a/drivers/pci/pci-driver.c
1669 ++++ b/drivers/pci/pci-driver.c
1670 +@@ -414,6 +414,9 @@ static int pci_device_probe(struct device *dev)
1671 + struct pci_dev *pci_dev = to_pci_dev(dev);
1672 + struct pci_driver *drv = to_pci_driver(dev->driver);
1673 +
1674 ++ if (!pci_device_can_probe(pci_dev))
1675 ++ return -ENODEV;
1676 ++
1677 + pci_assign_irq(pci_dev);
1678 +
1679 + error = pcibios_alloc_irq(pci_dev);
1680 +@@ -421,12 +424,10 @@ static int pci_device_probe(struct device *dev)
1681 + return error;
1682 +
1683 + pci_dev_get(pci_dev);
1684 +- if (pci_device_can_probe(pci_dev)) {
1685 +- error = __pci_device_probe(drv, pci_dev);
1686 +- if (error) {
1687 +- pcibios_free_irq(pci_dev);
1688 +- pci_dev_put(pci_dev);
1689 +- }
1690 ++ error = __pci_device_probe(drv, pci_dev);
1691 ++ if (error) {
1692 ++ pcibios_free_irq(pci_dev);
1693 ++ pci_dev_put(pci_dev);
1694 + }
1695 +
1696 + return error;
1697 +diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
1698 +index 9ecfe13157c0..1edf5a1836ea 100644
1699 +--- a/drivers/pci/pci-sysfs.c
1700 ++++ b/drivers/pci/pci-sysfs.c
1701 +@@ -478,7 +478,7 @@ static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
1702 + pci_stop_and_remove_bus_device_locked(to_pci_dev(dev));
1703 + return count;
1704 + }
1705 +-static struct device_attribute dev_remove_attr = __ATTR(remove,
1706 ++static struct device_attribute dev_remove_attr = __ATTR_IGNORE_LOCKDEP(remove,
1707 + (S_IWUSR|S_IWGRP),
1708 + NULL, remove_store);
1709 +
1710 +diff --git a/drivers/phy/renesas/phy-rcar-gen2.c b/drivers/phy/renesas/phy-rcar-gen2.c
1711 +index 97d4dd6ea924..aa02b19b7e0e 100644
1712 +--- a/drivers/phy/renesas/phy-rcar-gen2.c
1713 ++++ b/drivers/phy/renesas/phy-rcar-gen2.c
1714 +@@ -288,6 +288,7 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev)
1715 + error = of_property_read_u32(np, "reg", &channel_num);
1716 + if (error || channel_num > 2) {
1717 + dev_err(dev, "Invalid \"reg\" property\n");
1718 ++ of_node_put(np);
1719 + return error;
1720 + }
1721 + channel->select_mask = select_mask[channel_num];
1722 +@@ -303,6 +304,7 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev)
1723 + &rcar_gen2_phy_ops);
1724 + if (IS_ERR(phy->phy)) {
1725 + dev_err(dev, "Failed to create PHY\n");
1726 ++ of_node_put(np);
1727 + return PTR_ERR(phy->phy);
1728 + }
1729 + phy_set_drvdata(phy->phy, phy);
1730 +diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
1731 +index f4a61429e06e..8d83817935da 100644
1732 +--- a/drivers/pinctrl/pinctrl-rockchip.c
1733 ++++ b/drivers/pinctrl/pinctrl-rockchip.c
1734 +@@ -3172,6 +3172,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
1735 + base,
1736 + &rockchip_regmap_config);
1737 + }
1738 ++ of_node_put(node);
1739 + }
1740 +
1741 + bank->irq = irq_of_parse_and_map(bank->of_node, 0);
1742 +diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
1743 +index ccafcc2c87ac..70433f756d8e 100644
1744 +--- a/drivers/staging/vt6656/main_usb.c
1745 ++++ b/drivers/staging/vt6656/main_usb.c
1746 +@@ -402,16 +402,19 @@ static void vnt_free_int_bufs(struct vnt_private *priv)
1747 + kfree(priv->int_buf.data_buf);
1748 + }
1749 +
1750 +-static bool vnt_alloc_bufs(struct vnt_private *priv)
1751 ++static int vnt_alloc_bufs(struct vnt_private *priv)
1752 + {
1753 ++ int ret = 0;
1754 + struct vnt_usb_send_context *tx_context;
1755 + struct vnt_rcb *rcb;
1756 + int ii;
1757 +
1758 + for (ii = 0; ii < priv->num_tx_context; ii++) {
1759 + tx_context = kmalloc(sizeof(*tx_context), GFP_KERNEL);
1760 +- if (!tx_context)
1761 ++ if (!tx_context) {
1762 ++ ret = -ENOMEM;
1763 + goto free_tx;
1764 ++ }
1765 +
1766 + priv->tx_context[ii] = tx_context;
1767 + tx_context->priv = priv;
1768 +@@ -419,16 +422,20 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
1769 +
1770 + /* allocate URBs */
1771 + tx_context->urb = usb_alloc_urb(0, GFP_KERNEL);
1772 +- if (!tx_context->urb)
1773 ++ if (!tx_context->urb) {
1774 ++ ret = -ENOMEM;
1775 + goto free_tx;
1776 ++ }
1777 +
1778 + tx_context->in_use = false;
1779 + }
1780 +
1781 + for (ii = 0; ii < priv->num_rcb; ii++) {
1782 + priv->rcb[ii] = kzalloc(sizeof(*priv->rcb[ii]), GFP_KERNEL);
1783 +- if (!priv->rcb[ii])
1784 ++ if (!priv->rcb[ii]) {
1785 ++ ret = -ENOMEM;
1786 + goto free_rx_tx;
1787 ++ }
1788 +
1789 + rcb = priv->rcb[ii];
1790 +
1791 +@@ -436,39 +443,46 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
1792 +
1793 + /* allocate URBs */
1794 + rcb->urb = usb_alloc_urb(0, GFP_KERNEL);
1795 +- if (!rcb->urb)
1796 ++ if (!rcb->urb) {
1797 ++ ret = -ENOMEM;
1798 + goto free_rx_tx;
1799 ++ }
1800 +
1801 + rcb->skb = dev_alloc_skb(priv->rx_buf_sz);
1802 +- if (!rcb->skb)
1803 ++ if (!rcb->skb) {
1804 ++ ret = -ENOMEM;
1805 + goto free_rx_tx;
1806 ++ }
1807 +
1808 + rcb->in_use = false;
1809 +
1810 + /* submit rx urb */
1811 +- if (vnt_submit_rx_urb(priv, rcb))
1812 ++ ret = vnt_submit_rx_urb(priv, rcb);
1813 ++ if (ret)
1814 + goto free_rx_tx;
1815 + }
1816 +
1817 + priv->interrupt_urb = usb_alloc_urb(0, GFP_KERNEL);
1818 +- if (!priv->interrupt_urb)
1819 ++ if (!priv->interrupt_urb) {
1820 ++ ret = -ENOMEM;
1821 + goto free_rx_tx;
1822 ++ }
1823 +
1824 + priv->int_buf.data_buf = kmalloc(MAX_INTERRUPT_SIZE, GFP_KERNEL);
1825 + if (!priv->int_buf.data_buf) {
1826 +- usb_free_urb(priv->interrupt_urb);
1827 +- goto free_rx_tx;
1828 ++ ret = -ENOMEM;
1829 ++ goto free_rx_tx_urb;
1830 + }
1831 +
1832 +- return true;
1833 ++ return 0;
1834 +
1835 ++free_rx_tx_urb:
1836 ++ usb_free_urb(priv->interrupt_urb);
1837 + free_rx_tx:
1838 + vnt_free_rx_bufs(priv);
1839 +-
1840 + free_tx:
1841 + vnt_free_tx_bufs(priv);
1842 +-
1843 +- return false;
1844 ++ return ret;
1845 + }
1846 +
1847 + static void vnt_tx_80211(struct ieee80211_hw *hw,
1848 +diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
1849 +index e26d87b6ffc5..aa4de6907f77 100644
1850 +--- a/drivers/tty/serial/8250/8250_port.c
1851 ++++ b/drivers/tty/serial/8250/8250_port.c
1852 +@@ -1874,7 +1874,8 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
1853 + status = serial8250_rx_chars(up, status);
1854 + }
1855 + serial8250_modem_status(up);
1856 +- if ((!up->dma || up->dma->tx_err) && (status & UART_LSR_THRE))
1857 ++ if ((!up->dma || up->dma->tx_err) && (status & UART_LSR_THRE) &&
1858 ++ (up->ier & UART_IER_THRI))
1859 + serial8250_tx_chars(up);
1860 +
1861 + spin_unlock_irqrestore(&port->lock, flags);
1862 +diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
1863 +index e5389591bb4f..ad40c75bb58f 100644
1864 +--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
1865 ++++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
1866 +@@ -407,7 +407,16 @@ static int cpm_uart_startup(struct uart_port *port)
1867 + clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_RX);
1868 + }
1869 + cpm_uart_initbd(pinfo);
1870 +- cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
1871 ++ if (IS_SMC(pinfo)) {
1872 ++ out_be32(&pinfo->smcup->smc_rstate, 0);
1873 ++ out_be32(&pinfo->smcup->smc_tstate, 0);
1874 ++ out_be16(&pinfo->smcup->smc_rbptr,
1875 ++ in_be16(&pinfo->smcup->smc_rbase));
1876 ++ out_be16(&pinfo->smcup->smc_tbptr,
1877 ++ in_be16(&pinfo->smcup->smc_tbase));
1878 ++ } else {
1879 ++ cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
1880 ++ }
1881 + }
1882 + /* Install interrupt handler. */
1883 + retval = request_irq(port->irq, cpm_uart_int, 0, "cpm_uart", port);
1884 +@@ -861,16 +870,14 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo)
1885 + (u8 __iomem *)pinfo->tx_bd_base - DPRAM_BASE);
1886 +
1887 + /*
1888 +- * In case SMC1 is being relocated...
1889 ++ * In case SMC is being relocated...
1890 + */
1891 +-#if defined (CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
1892 + out_be16(&up->smc_rbptr, in_be16(&pinfo->smcup->smc_rbase));
1893 + out_be16(&up->smc_tbptr, in_be16(&pinfo->smcup->smc_tbase));
1894 + out_be32(&up->smc_rstate, 0);
1895 + out_be32(&up->smc_tstate, 0);
1896 + out_be16(&up->smc_brkcr, 1); /* number of break chars */
1897 + out_be16(&up->smc_brkec, 0);
1898 +-#endif
1899 +
1900 + /* Set up the uart parameters in the
1901 + * parameter ram.
1902 +@@ -884,8 +891,6 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo)
1903 + out_be16(&up->smc_brkec, 0);
1904 + out_be16(&up->smc_brkcr, 1);
1905 +
1906 +- cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
1907 +-
1908 + /* Set UART mode, 8 bit, no parity, one stop.
1909 + * Enable receive and transmit.
1910 + */
1911 +diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c
1912 +index f460cca139e2..13ac36e2da4f 100644
1913 +--- a/drivers/tty/serial/digicolor-usart.c
1914 ++++ b/drivers/tty/serial/digicolor-usart.c
1915 +@@ -541,7 +541,11 @@ static int __init digicolor_uart_init(void)
1916 + if (ret)
1917 + return ret;
1918 +
1919 +- return platform_driver_register(&digicolor_uart_platform);
1920 ++ ret = platform_driver_register(&digicolor_uart_platform);
1921 ++ if (ret)
1922 ++ uart_unregister_driver(&digicolor_uart);
1923 ++
1924 ++ return ret;
1925 + }
1926 + module_init(digicolor_uart_init);
1927 +
1928 +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
1929 +index 0f67197a3783..105de92b0b3b 100644
1930 +--- a/drivers/tty/serial/imx.c
1931 ++++ b/drivers/tty/serial/imx.c
1932 +@@ -382,6 +382,7 @@ static void imx_uart_ucrs_restore(struct imx_port *sport,
1933 + }
1934 + #endif
1935 +
1936 ++/* called with port.lock taken and irqs caller dependent */
1937 + static void imx_uart_rts_active(struct imx_port *sport, u32 *ucr2)
1938 + {
1939 + *ucr2 &= ~(UCR2_CTSC | UCR2_CTS);
1940 +@@ -390,6 +391,7 @@ static void imx_uart_rts_active(struct imx_port *sport, u32 *ucr2)
1941 + mctrl_gpio_set(sport->gpios, sport->port.mctrl);
1942 + }
1943 +
1944 ++/* called with port.lock taken and irqs caller dependent */
1945 + static void imx_uart_rts_inactive(struct imx_port *sport, u32 *ucr2)
1946 + {
1947 + *ucr2 &= ~UCR2_CTSC;
1948 +@@ -399,6 +401,7 @@ static void imx_uart_rts_inactive(struct imx_port *sport, u32 *ucr2)
1949 + mctrl_gpio_set(sport->gpios, sport->port.mctrl);
1950 + }
1951 +
1952 ++/* called with port.lock taken and irqs caller dependent */
1953 + static void imx_uart_rts_auto(struct imx_port *sport, u32 *ucr2)
1954 + {
1955 + *ucr2 |= UCR2_CTSC;
1956 +@@ -1554,6 +1557,16 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios,
1957 + old_csize = CS8;
1958 + }
1959 +
1960 ++ del_timer_sync(&sport->timer);
1961 ++
1962 ++ /*
1963 ++ * Ask the core to calculate the divisor for us.
1964 ++ */
1965 ++ baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 16);
1966 ++ quot = uart_get_divisor(port, baud);
1967 ++
1968 ++ spin_lock_irqsave(&sport->port.lock, flags);
1969 ++
1970 + if ((termios->c_cflag & CSIZE) == CS8)
1971 + ucr2 = UCR2_WS | UCR2_SRST | UCR2_IRTS;
1972 + else
1973 +@@ -1597,16 +1610,6 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios,
1974 + ucr2 |= UCR2_PROE;
1975 + }
1976 +
1977 +- del_timer_sync(&sport->timer);
1978 +-
1979 +- /*
1980 +- * Ask the core to calculate the divisor for us.
1981 +- */
1982 +- baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 16);
1983 +- quot = uart_get_divisor(port, baud);
1984 +-
1985 +- spin_lock_irqsave(&sport->port.lock, flags);
1986 +-
1987 + sport->port.read_status_mask = 0;
1988 + if (termios->c_iflag & INPCK)
1989 + sport->port.read_status_mask |= (URXD_FRMERR | URXD_PRERR);
1990 +diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
1991 +index 38c48a02b920..bd3e6cf81af5 100644
1992 +--- a/drivers/tty/serial/max310x.c
1993 ++++ b/drivers/tty/serial/max310x.c
1994 +@@ -491,37 +491,48 @@ static bool max310x_reg_precious(struct device *dev, unsigned int reg)
1995 +
1996 + static int max310x_set_baud(struct uart_port *port, int baud)
1997 + {
1998 +- unsigned int mode = 0, clk = port->uartclk, div = clk / baud;
1999 ++ unsigned int mode = 0, div = 0, frac = 0, c = 0, F = 0;
2000 +
2001 +- /* Check for minimal value for divider */
2002 +- if (div < 16)
2003 +- div = 16;
2004 +-
2005 +- if (clk % baud && (div / 16) < 0x8000) {
2006 ++ /*
2007 ++ * Calculate the integer divisor first. Select a proper mode
2008 ++ * in case if the requested baud is too high for the pre-defined
2009 ++ * clocks frequency.
2010 ++ */
2011 ++ div = port->uartclk / baud;
2012 ++ if (div < 8) {
2013 ++ /* Mode x4 */
2014 ++ c = 4;
2015 ++ mode = MAX310X_BRGCFG_4XMODE_BIT;
2016 ++ } else if (div < 16) {
2017 + /* Mode x2 */
2018 ++ c = 8;
2019 + mode = MAX310X_BRGCFG_2XMODE_BIT;
2020 +- clk = port->uartclk * 2;
2021 +- div = clk / baud;
2022 +-
2023 +- if (clk % baud && (div / 16) < 0x8000) {
2024 +- /* Mode x4 */
2025 +- mode = MAX310X_BRGCFG_4XMODE_BIT;
2026 +- clk = port->uartclk * 4;
2027 +- div = clk / baud;
2028 +- }
2029 ++ } else {
2030 ++ c = 16;
2031 + }
2032 +
2033 +- max310x_port_write(port, MAX310X_BRGDIVMSB_REG, (div / 16) >> 8);
2034 +- max310x_port_write(port, MAX310X_BRGDIVLSB_REG, div / 16);
2035 +- max310x_port_write(port, MAX310X_BRGCFG_REG, (div % 16) | mode);
2036 ++ /* Calculate the divisor in accordance with the fraction coefficient */
2037 ++ div /= c;
2038 ++ F = c*baud;
2039 ++
2040 ++ /* Calculate the baud rate fraction */
2041 ++ if (div > 0)
2042 ++ frac = (16*(port->uartclk % F)) / F;
2043 ++ else
2044 ++ div = 1;
2045 ++
2046 ++ max310x_port_write(port, MAX310X_BRGDIVMSB_REG, div >> 8);
2047 ++ max310x_port_write(port, MAX310X_BRGDIVLSB_REG, div);
2048 ++ max310x_port_write(port, MAX310X_BRGCFG_REG, frac | mode);
2049 +
2050 +- return DIV_ROUND_CLOSEST(clk, div);
2051 ++ /* Return the actual baud rate we just programmed */
2052 ++ return (16*port->uartclk) / (c*(16*div + frac));
2053 + }
2054 +
2055 + static int max310x_update_best_err(unsigned long f, long *besterr)
2056 + {
2057 + /* Use baudrate 115200 for calculate error */
2058 +- long err = f % (115200 * 16);
2059 ++ long err = f % (460800 * 16);
2060 +
2061 + if ((*besterr < 0) || (*besterr > err)) {
2062 + *besterr = err;
2063 +diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
2064 +index 0f41b936da03..310bbae515b0 100644
2065 +--- a/drivers/tty/serial/msm_serial.c
2066 ++++ b/drivers/tty/serial/msm_serial.c
2067 +@@ -383,10 +383,14 @@ no_rx:
2068 +
2069 + static inline void msm_wait_for_xmitr(struct uart_port *port)
2070 + {
2071 ++ unsigned int timeout = 500000;
2072 ++
2073 + while (!(msm_read(port, UART_SR) & UART_SR_TX_EMPTY)) {
2074 + if (msm_read(port, UART_ISR) & UART_ISR_TX_READY)
2075 + break;
2076 + udelay(1);
2077 ++ if (!timeout--)
2078 ++ break;
2079 + }
2080 + msm_write(port, UART_CR_CMD_RESET_TX_READY, UART_CR);
2081 + }
2082 +diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
2083 +index 8dbeb14a1e3a..fe9261ffe3db 100644
2084 +--- a/drivers/tty/serial/serial_core.c
2085 ++++ b/drivers/tty/serial/serial_core.c
2086 +@@ -1738,6 +1738,7 @@ static int uart_port_activate(struct tty_port *port, struct tty_struct *tty)
2087 + {
2088 + struct uart_state *state = container_of(port, struct uart_state, port);
2089 + struct uart_port *uport;
2090 ++ int ret;
2091 +
2092 + uport = uart_port_check(state);
2093 + if (!uport || uport->flags & UPF_DEAD)
2094 +@@ -1748,7 +1749,11 @@ static int uart_port_activate(struct tty_port *port, struct tty_struct *tty)
2095 + /*
2096 + * Start up the serial port.
2097 + */
2098 +- return uart_startup(tty, state, 0);
2099 ++ ret = uart_startup(tty, state, 0);
2100 ++ if (ret > 0)
2101 ++ tty_port_set_active(port, 1);
2102 ++
2103 ++ return ret;
2104 + }
2105 +
2106 + static const char *uart_type(struct uart_port *port)
2107 +diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
2108 +index 1c06325beaca..07f318603e74 100644
2109 +--- a/drivers/tty/serial/serial_mctrl_gpio.c
2110 ++++ b/drivers/tty/serial/serial_mctrl_gpio.c
2111 +@@ -12,6 +12,7 @@
2112 + #include <linux/termios.h>
2113 + #include <linux/serial_core.h>
2114 + #include <linux/module.h>
2115 ++#include <linux/property.h>
2116 +
2117 + #include "serial_mctrl_gpio.h"
2118 +
2119 +@@ -115,6 +116,19 @@ struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev, unsigned int idx)
2120 +
2121 + for (i = 0; i < UART_GPIO_MAX; i++) {
2122 + enum gpiod_flags flags;
2123 ++ char *gpio_str;
2124 ++ bool present;
2125 ++
2126 ++ /* Check if GPIO property exists and continue if not */
2127 ++ gpio_str = kasprintf(GFP_KERNEL, "%s-gpios",
2128 ++ mctrl_gpios_desc[i].name);
2129 ++ if (!gpio_str)
2130 ++ continue;
2131 ++
2132 ++ present = device_property_present(dev, gpio_str);
2133 ++ kfree(gpio_str);
2134 ++ if (!present)
2135 ++ continue;
2136 +
2137 + if (mctrl_gpios_desc[i].dir_out)
2138 + flags = GPIOD_OUT_LOW;
2139 +diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
2140 +index 040832635a64..5550289e6678 100644
2141 +--- a/drivers/tty/serial/sh-sci.c
2142 ++++ b/drivers/tty/serial/sh-sci.c
2143 +@@ -1376,6 +1376,7 @@ static void work_fn_tx(struct work_struct *work)
2144 + struct circ_buf *xmit = &port->state->xmit;
2145 + unsigned long flags;
2146 + dma_addr_t buf;
2147 ++ int head, tail;
2148 +
2149 + /*
2150 + * DMA is idle now.
2151 +@@ -1385,16 +1386,23 @@ static void work_fn_tx(struct work_struct *work)
2152 + * consistent xmit buffer state.
2153 + */
2154 + spin_lock_irq(&port->lock);
2155 +- buf = s->tx_dma_addr + (xmit->tail & (UART_XMIT_SIZE - 1));
2156 ++ head = xmit->head;
2157 ++ tail = xmit->tail;
2158 ++ buf = s->tx_dma_addr + (tail & (UART_XMIT_SIZE - 1));
2159 + s->tx_dma_len = min_t(unsigned int,
2160 +- CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE),
2161 +- CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE));
2162 +- spin_unlock_irq(&port->lock);
2163 ++ CIRC_CNT(head, tail, UART_XMIT_SIZE),
2164 ++ CIRC_CNT_TO_END(head, tail, UART_XMIT_SIZE));
2165 ++ if (!s->tx_dma_len) {
2166 ++ /* Transmit buffer has been flushed */
2167 ++ spin_unlock_irq(&port->lock);
2168 ++ return;
2169 ++ }
2170 +
2171 + desc = dmaengine_prep_slave_single(chan, buf, s->tx_dma_len,
2172 + DMA_MEM_TO_DEV,
2173 + DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
2174 + if (!desc) {
2175 ++ spin_unlock_irq(&port->lock);
2176 + dev_warn(port->dev, "Failed preparing Tx DMA descriptor\n");
2177 + goto switch_to_pio;
2178 + }
2179 +@@ -1402,18 +1410,18 @@ static void work_fn_tx(struct work_struct *work)
2180 + dma_sync_single_for_device(chan->device->dev, buf, s->tx_dma_len,
2181 + DMA_TO_DEVICE);
2182 +
2183 +- spin_lock_irq(&port->lock);
2184 + desc->callback = sci_dma_tx_complete;
2185 + desc->callback_param = s;
2186 +- spin_unlock_irq(&port->lock);
2187 + s->cookie_tx = dmaengine_submit(desc);
2188 + if (dma_submit_error(s->cookie_tx)) {
2189 ++ spin_unlock_irq(&port->lock);
2190 + dev_warn(port->dev, "Failed submitting Tx DMA descriptor\n");
2191 + goto switch_to_pio;
2192 + }
2193 +
2194 ++ spin_unlock_irq(&port->lock);
2195 + dev_dbg(port->dev, "%s: %p: %d...%d, cookie %d\n",
2196 +- __func__, xmit->buf, xmit->tail, xmit->head, s->cookie_tx);
2197 ++ __func__, xmit->buf, tail, head, s->cookie_tx);
2198 +
2199 + dma_async_issue_pending(chan);
2200 + return;
2201 +@@ -1633,11 +1641,18 @@ static void sci_free_dma(struct uart_port *port)
2202 +
2203 + static void sci_flush_buffer(struct uart_port *port)
2204 + {
2205 ++ struct sci_port *s = to_sci_port(port);
2206 ++
2207 + /*
2208 + * In uart_flush_buffer(), the xmit circular buffer has just been
2209 +- * cleared, so we have to reset tx_dma_len accordingly.
2210 ++ * cleared, so we have to reset tx_dma_len accordingly, and stop any
2211 ++ * pending transfers
2212 + */
2213 +- to_sci_port(port)->tx_dma_len = 0;
2214 ++ s->tx_dma_len = 0;
2215 ++ if (s->chan_tx) {
2216 ++ dmaengine_terminate_async(s->chan_tx);
2217 ++ s->cookie_tx = -EINVAL;
2218 ++ }
2219 + }
2220 + #else /* !CONFIG_SERIAL_SH_SCI_DMA */
2221 + static inline void sci_request_dma(struct uart_port *port)
2222 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
2223 +index f4e8e869649a..8018f813972e 100644
2224 +--- a/drivers/usb/core/hub.c
2225 ++++ b/drivers/usb/core/hub.c
2226 +@@ -3961,6 +3961,9 @@ static int usb_set_lpm_timeout(struct usb_device *udev,
2227 + * control transfers to set the hub timeout or enable device-initiated U1/U2
2228 + * will be successful.
2229 + *
2230 ++ * If the control transfer to enable device-initiated U1/U2 entry fails, then
2231 ++ * hub-initiated U1/U2 will be disabled.
2232 ++ *
2233 + * If we cannot set the parent hub U1/U2 timeout, we attempt to let the xHCI
2234 + * driver know about it. If that call fails, it should be harmless, and just
2235 + * take up more slightly more bus bandwidth for unnecessary U1/U2 exit latency.
2236 +@@ -4015,23 +4018,24 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev,
2237 + * host know that this link state won't be enabled.
2238 + */
2239 + hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state);
2240 +- } else {
2241 +- /* Only a configured device will accept the Set Feature
2242 +- * U1/U2_ENABLE
2243 +- */
2244 +- if (udev->actconfig)
2245 +- usb_set_device_initiated_lpm(udev, state, true);
2246 ++ return;
2247 ++ }
2248 +
2249 +- /* As soon as usb_set_lpm_timeout(timeout) returns 0, the
2250 +- * hub-initiated LPM is enabled. Thus, LPM is enabled no
2251 +- * matter the result of usb_set_device_initiated_lpm().
2252 +- * The only difference is whether device is able to initiate
2253 +- * LPM.
2254 +- */
2255 ++ /* Only a configured device will accept the Set Feature
2256 ++ * U1/U2_ENABLE
2257 ++ */
2258 ++ if (udev->actconfig &&
2259 ++ usb_set_device_initiated_lpm(udev, state, true) == 0) {
2260 + if (state == USB3_LPM_U1)
2261 + udev->usb3_lpm_u1_enabled = 1;
2262 + else if (state == USB3_LPM_U2)
2263 + udev->usb3_lpm_u2_enabled = 1;
2264 ++ } else {
2265 ++ /* Don't request U1/U2 entry if the device
2266 ++ * cannot transition to U1/U2.
2267 ++ */
2268 ++ usb_set_lpm_timeout(udev, state, 0);
2269 ++ hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state);
2270 + }
2271 + }
2272 +
2273 +diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
2274 +index aa15593a3ac4..2050993fb58b 100644
2275 +--- a/drivers/usb/gadget/function/f_fs.c
2276 ++++ b/drivers/usb/gadget/function/f_fs.c
2277 +@@ -1101,11 +1101,12 @@ static ssize_t ffs_epfile_write_iter(struct kiocb *kiocb, struct iov_iter *from)
2278 + ENTER();
2279 +
2280 + if (!is_sync_kiocb(kiocb)) {
2281 +- p = kmalloc(sizeof(io_data), GFP_KERNEL);
2282 ++ p = kzalloc(sizeof(io_data), GFP_KERNEL);
2283 + if (unlikely(!p))
2284 + return -ENOMEM;
2285 + p->aio = true;
2286 + } else {
2287 ++ memset(p, 0, sizeof(*p));
2288 + p->aio = false;
2289 + }
2290 +
2291 +@@ -1137,11 +1138,12 @@ static ssize_t ffs_epfile_read_iter(struct kiocb *kiocb, struct iov_iter *to)
2292 + ENTER();
2293 +
2294 + if (!is_sync_kiocb(kiocb)) {
2295 +- p = kmalloc(sizeof(io_data), GFP_KERNEL);
2296 ++ p = kzalloc(sizeof(io_data), GFP_KERNEL);
2297 + if (unlikely(!p))
2298 + return -ENOMEM;
2299 + p->aio = true;
2300 + } else {
2301 ++ memset(p, 0, sizeof(*p));
2302 + p->aio = false;
2303 + }
2304 +
2305 +diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c
2306 +index 09a8ebd95588..6968b9f2b76b 100644
2307 +--- a/drivers/usb/host/hwa-hc.c
2308 ++++ b/drivers/usb/host/hwa-hc.c
2309 +@@ -159,7 +159,7 @@ out:
2310 + return result;
2311 +
2312 + error_set_cluster_id:
2313 +- wusb_cluster_id_put(wusbhc->cluster_id);
2314 ++ wusb_cluster_id_put(addr);
2315 + error_cluster_id_get:
2316 + goto out;
2317 +
2318 +diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
2319 +index 3625a5c1a41b..070c66f86e67 100644
2320 +--- a/drivers/usb/host/pci-quirks.c
2321 ++++ b/drivers/usb/host/pci-quirks.c
2322 +@@ -205,7 +205,7 @@ int usb_amd_find_chipset_info(void)
2323 + {
2324 + unsigned long flags;
2325 + struct amd_chipset_info info;
2326 +- int ret;
2327 ++ int need_pll_quirk = 0;
2328 +
2329 + spin_lock_irqsave(&amd_lock, flags);
2330 +
2331 +@@ -219,21 +219,28 @@ int usb_amd_find_chipset_info(void)
2332 + spin_unlock_irqrestore(&amd_lock, flags);
2333 +
2334 + if (!amd_chipset_sb_type_init(&info)) {
2335 +- ret = 0;
2336 + goto commit;
2337 + }
2338 +
2339 +- /* Below chipset generations needn't enable AMD PLL quirk */
2340 +- if (info.sb_type.gen == AMD_CHIPSET_UNKNOWN ||
2341 +- info.sb_type.gen == AMD_CHIPSET_SB600 ||
2342 +- info.sb_type.gen == AMD_CHIPSET_YANGTZE ||
2343 +- (info.sb_type.gen == AMD_CHIPSET_SB700 &&
2344 +- info.sb_type.rev > 0x3b)) {
2345 ++ switch (info.sb_type.gen) {
2346 ++ case AMD_CHIPSET_SB700:
2347 ++ need_pll_quirk = info.sb_type.rev <= 0x3B;
2348 ++ break;
2349 ++ case AMD_CHIPSET_SB800:
2350 ++ case AMD_CHIPSET_HUDSON2:
2351 ++ case AMD_CHIPSET_BOLTON:
2352 ++ need_pll_quirk = 1;
2353 ++ break;
2354 ++ default:
2355 ++ need_pll_quirk = 0;
2356 ++ break;
2357 ++ }
2358 ++
2359 ++ if (!need_pll_quirk) {
2360 + if (info.smbus_dev) {
2361 + pci_dev_put(info.smbus_dev);
2362 + info.smbus_dev = NULL;
2363 + }
2364 +- ret = 0;
2365 + goto commit;
2366 + }
2367 +
2368 +@@ -252,7 +259,7 @@ int usb_amd_find_chipset_info(void)
2369 + }
2370 + }
2371 +
2372 +- ret = info.probe_result = 1;
2373 ++ need_pll_quirk = info.probe_result = 1;
2374 + printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n");
2375 +
2376 + commit:
2377 +@@ -263,7 +270,7 @@ commit:
2378 +
2379 + /* Mark that we where here */
2380 + amd_chipset.probe_count++;
2381 +- ret = amd_chipset.probe_result;
2382 ++ need_pll_quirk = amd_chipset.probe_result;
2383 +
2384 + spin_unlock_irqrestore(&amd_lock, flags);
2385 +
2386 +@@ -277,7 +284,7 @@ commit:
2387 + spin_unlock_irqrestore(&amd_lock, flags);
2388 + }
2389 +
2390 +- return ret;
2391 ++ return need_pll_quirk;
2392 + }
2393 + EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info);
2394 +
2395 +diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
2396 +index e1cbdfdb7c68..197069303510 100644
2397 +--- a/fs/9p/vfs_addr.c
2398 ++++ b/fs/9p/vfs_addr.c
2399 +@@ -50,8 +50,9 @@
2400 + * @page: structure to page
2401 + *
2402 + */
2403 +-static int v9fs_fid_readpage(struct p9_fid *fid, struct page *page)
2404 ++static int v9fs_fid_readpage(void *data, struct page *page)
2405 + {
2406 ++ struct p9_fid *fid = data;
2407 + struct inode *inode = page->mapping->host;
2408 + struct bio_vec bvec = {.bv_page = page, .bv_len = PAGE_SIZE};
2409 + struct iov_iter to;
2410 +@@ -122,7 +123,8 @@ static int v9fs_vfs_readpages(struct file *filp, struct address_space *mapping,
2411 + if (ret == 0)
2412 + return ret;
2413 +
2414 +- ret = read_cache_pages(mapping, pages, (void *)v9fs_vfs_readpage, filp);
2415 ++ ret = read_cache_pages(mapping, pages, v9fs_fid_readpage,
2416 ++ filp->private_data);
2417 + p9_debug(P9_DEBUG_VFS, " = %d\n", ret);
2418 + return ret;
2419 + }
2420 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
2421 +index c1cd3fe2b295..355ff08e9d44 100644
2422 +--- a/fs/btrfs/inode.c
2423 ++++ b/fs/btrfs/inode.c
2424 +@@ -388,10 +388,31 @@ static noinline int add_async_extent(struct async_cow *cow,
2425 + return 0;
2426 + }
2427 +
2428 ++/*
2429 ++ * Check if the inode has flags compatible with compression
2430 ++ */
2431 ++static inline bool inode_can_compress(struct inode *inode)
2432 ++{
2433 ++ if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW ||
2434 ++ BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)
2435 ++ return false;
2436 ++ return true;
2437 ++}
2438 ++
2439 ++/*
2440 ++ * Check if the inode needs to be submitted to compression, based on mount
2441 ++ * options, defragmentation, properties or heuristics.
2442 ++ */
2443 + static inline int inode_need_compress(struct inode *inode, u64 start, u64 end)
2444 + {
2445 + struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
2446 +
2447 ++ if (!inode_can_compress(inode)) {
2448 ++ WARN(IS_ENABLED(CONFIG_BTRFS_DEBUG),
2449 ++ KERN_ERR "BTRFS: unexpected compression for ino %llu\n",
2450 ++ btrfs_ino(BTRFS_I(inode)));
2451 ++ return 0;
2452 ++ }
2453 + /* force compress */
2454 + if (btrfs_test_opt(fs_info, FORCE_COMPRESS))
2455 + return 1;
2456 +@@ -1596,7 +1617,8 @@ static int run_delalloc_range(void *private_data, struct page *locked_page,
2457 + } else if (BTRFS_I(inode)->flags & BTRFS_INODE_PREALLOC && !force_cow) {
2458 + ret = run_delalloc_nocow(inode, locked_page, start, end,
2459 + page_started, 0, nr_written);
2460 +- } else if (!inode_need_compress(inode, start, end)) {
2461 ++ } else if (!inode_can_compress(inode) ||
2462 ++ !inode_need_compress(inode, start, end)) {
2463 + ret = cow_file_range(inode, locked_page, start, end, end,
2464 + page_started, nr_written, 1, NULL);
2465 + } else {
2466 +diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
2467 +index a5e4a221435c..a93ebffe84b3 100644
2468 +--- a/fs/dlm/lowcomms.c
2469 ++++ b/fs/dlm/lowcomms.c
2470 +@@ -1630,8 +1630,10 @@ static void clean_writequeues(void)
2471 +
2472 + static void work_stop(void)
2473 + {
2474 +- destroy_workqueue(recv_workqueue);
2475 +- destroy_workqueue(send_workqueue);
2476 ++ if (recv_workqueue)
2477 ++ destroy_workqueue(recv_workqueue);
2478 ++ if (send_workqueue)
2479 ++ destroy_workqueue(send_workqueue);
2480 + }
2481 +
2482 + static int work_start(void)
2483 +@@ -1691,13 +1693,17 @@ static void work_flush(void)
2484 + struct hlist_node *n;
2485 + struct connection *con;
2486 +
2487 +- flush_workqueue(recv_workqueue);
2488 +- flush_workqueue(send_workqueue);
2489 ++ if (recv_workqueue)
2490 ++ flush_workqueue(recv_workqueue);
2491 ++ if (send_workqueue)
2492 ++ flush_workqueue(send_workqueue);
2493 + do {
2494 + ok = 1;
2495 + foreach_conn(stop_conn);
2496 +- flush_workqueue(recv_workqueue);
2497 +- flush_workqueue(send_workqueue);
2498 ++ if (recv_workqueue)
2499 ++ flush_workqueue(recv_workqueue);
2500 ++ if (send_workqueue)
2501 ++ flush_workqueue(send_workqueue);
2502 + for (i = 0; i < CONN_HASH_SIZE && ok; i++) {
2503 + hlist_for_each_entry_safe(con, n,
2504 + &connection_hash[i], list) {
2505 +diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
2506 +index 8fc3edb6760c..92f72bb5aff4 100644
2507 +--- a/fs/f2fs/segment.c
2508 ++++ b/fs/f2fs/segment.c
2509 +@@ -3261,6 +3261,11 @@ static int read_compacted_summaries(struct f2fs_sb_info *sbi)
2510 + seg_i = CURSEG_I(sbi, i);
2511 + segno = le32_to_cpu(ckpt->cur_data_segno[i]);
2512 + blk_off = le16_to_cpu(ckpt->cur_data_blkoff[i]);
2513 ++ if (blk_off > ENTRIES_IN_SUM) {
2514 ++ f2fs_bug_on(sbi, 1);
2515 ++ f2fs_put_page(page, 1);
2516 ++ return -EFAULT;
2517 ++ }
2518 + seg_i->next_segno = segno;
2519 + reset_curseg(sbi, i, 0);
2520 + seg_i->alloc_type = ckpt->alloc_type[i];
2521 +diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
2522 +index 29dee9630eec..a18b8d7a3075 100644
2523 +--- a/fs/notify/fanotify/fanotify.c
2524 ++++ b/fs/notify/fanotify/fanotify.c
2525 +@@ -148,10 +148,13 @@ struct fanotify_event_info *fanotify_alloc_event(struct fsnotify_group *group,
2526 + /*
2527 + * For queues with unlimited length lost events are not expected and
2528 + * can possibly have security implications. Avoid losing events when
2529 +- * memory is short.
2530 ++ * memory is short. For the limited size queues, avoid OOM killer in the
2531 ++ * target monitoring memcg as it may have security repercussion.
2532 + */
2533 + if (group->max_events == UINT_MAX)
2534 + gfp |= __GFP_NOFAIL;
2535 ++ else
2536 ++ gfp |= __GFP_RETRY_MAYFAIL;
2537 +
2538 + /* Whoever is interested in the event, pays for the allocation. */
2539 + memalloc_use_memcg(group->memcg);
2540 +diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
2541 +index f4184b4f3815..16b8702af0e7 100644
2542 +--- a/fs/notify/inotify/inotify_fsnotify.c
2543 ++++ b/fs/notify/inotify/inotify_fsnotify.c
2544 +@@ -99,9 +99,13 @@ int inotify_handle_event(struct fsnotify_group *group,
2545 + i_mark = container_of(inode_mark, struct inotify_inode_mark,
2546 + fsn_mark);
2547 +
2548 +- /* Whoever is interested in the event, pays for the allocation. */
2549 ++ /*
2550 ++ * Whoever is interested in the event, pays for the allocation. Do not
2551 ++ * trigger OOM killer in the target monitoring memcg as it may have
2552 ++ * security repercussion.
2553 ++ */
2554 + memalloc_use_memcg(group->memcg);
2555 +- event = kmalloc(alloc_len, GFP_KERNEL_ACCOUNT);
2556 ++ event = kmalloc(alloc_len, GFP_KERNEL_ACCOUNT | __GFP_RETRY_MAYFAIL);
2557 + memalloc_unuse_memcg();
2558 +
2559 + if (unlikely(!event)) {
2560 +diff --git a/fs/open.c b/fs/open.c
2561 +index a00350018a47..878478745924 100644
2562 +--- a/fs/open.c
2563 ++++ b/fs/open.c
2564 +@@ -373,6 +373,25 @@ long do_faccessat(int dfd, const char __user *filename, int mode)
2565 + override_cred->cap_permitted;
2566 + }
2567 +
2568 ++ /*
2569 ++ * The new set of credentials can *only* be used in
2570 ++ * task-synchronous circumstances, and does not need
2571 ++ * RCU freeing, unless somebody then takes a separate
2572 ++ * reference to it.
2573 ++ *
2574 ++ * NOTE! This is _only_ true because this credential
2575 ++ * is used purely for override_creds() that installs
2576 ++ * it as the subjective cred. Other threads will be
2577 ++ * accessing ->real_cred, not the subjective cred.
2578 ++ *
2579 ++ * If somebody _does_ make a copy of this (using the
2580 ++ * 'get_current_cred()' function), that will clear the
2581 ++ * non_rcu field, because now that other user may be
2582 ++ * expecting RCU freeing. But normal thread-synchronous
2583 ++ * cred accesses will keep things non-RCY.
2584 ++ */
2585 ++ override_cred->non_rcu = 1;
2586 ++
2587 + old_cred = override_creds(override_cred);
2588 + retry:
2589 + res = user_path_at(dfd, filename, lookup_flags, &path);
2590 +diff --git a/fs/proc/base.c b/fs/proc/base.c
2591 +index f999e8bd3771..a7fbda72afeb 100644
2592 +--- a/fs/proc/base.c
2593 ++++ b/fs/proc/base.c
2594 +@@ -1960,9 +1960,12 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags)
2595 + goto out;
2596 +
2597 + if (!dname_to_vma_addr(dentry, &vm_start, &vm_end)) {
2598 +- down_read(&mm->mmap_sem);
2599 +- exact_vma_exists = !!find_exact_vma(mm, vm_start, vm_end);
2600 +- up_read(&mm->mmap_sem);
2601 ++ status = down_read_killable(&mm->mmap_sem);
2602 ++ if (!status) {
2603 ++ exact_vma_exists = !!find_exact_vma(mm, vm_start,
2604 ++ vm_end);
2605 ++ up_read(&mm->mmap_sem);
2606 ++ }
2607 + }
2608 +
2609 + mmput(mm);
2610 +@@ -2008,8 +2011,11 @@ static int map_files_get_link(struct dentry *dentry, struct path *path)
2611 + if (rc)
2612 + goto out_mmput;
2613 +
2614 ++ rc = down_read_killable(&mm->mmap_sem);
2615 ++ if (rc)
2616 ++ goto out_mmput;
2617 ++
2618 + rc = -ENOENT;
2619 +- down_read(&mm->mmap_sem);
2620 + vma = find_exact_vma(mm, vm_start, vm_end);
2621 + if (vma && vma->vm_file) {
2622 + *path = vma->vm_file->f_path;
2623 +@@ -2105,7 +2111,11 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
2624 + if (!mm)
2625 + goto out_put_task;
2626 +
2627 +- down_read(&mm->mmap_sem);
2628 ++ result = ERR_PTR(-EINTR);
2629 ++ if (down_read_killable(&mm->mmap_sem))
2630 ++ goto out_put_mm;
2631 ++
2632 ++ result = ERR_PTR(-ENOENT);
2633 + vma = find_exact_vma(mm, vm_start, vm_end);
2634 + if (!vma)
2635 + goto out_no_vma;
2636 +@@ -2116,6 +2126,7 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
2637 +
2638 + out_no_vma:
2639 + up_read(&mm->mmap_sem);
2640 ++out_put_mm:
2641 + mmput(mm);
2642 + out_put_task:
2643 + put_task_struct(task);
2644 +@@ -2157,7 +2168,12 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
2645 + mm = get_task_mm(task);
2646 + if (!mm)
2647 + goto out_put_task;
2648 +- down_read(&mm->mmap_sem);
2649 ++
2650 ++ ret = down_read_killable(&mm->mmap_sem);
2651 ++ if (ret) {
2652 ++ mmput(mm);
2653 ++ goto out_put_task;
2654 ++ }
2655 +
2656 + nr_files = 0;
2657 +
2658 +diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
2659 +index c5819baee35c..71aba44c4fa6 100644
2660 +--- a/fs/proc/task_mmu.c
2661 ++++ b/fs/proc/task_mmu.c
2662 +@@ -166,7 +166,11 @@ static void *m_start(struct seq_file *m, loff_t *ppos)
2663 + if (!mm || !mmget_not_zero(mm))
2664 + return NULL;
2665 +
2666 +- down_read(&mm->mmap_sem);
2667 ++ if (down_read_killable(&mm->mmap_sem)) {
2668 ++ mmput(mm);
2669 ++ return ERR_PTR(-EINTR);
2670 ++ }
2671 ++
2672 + hold_task_mempolicy(priv);
2673 + priv->tail_vma = get_gate_vma(mm);
2674 +
2675 +@@ -826,7 +830,10 @@ static int show_smaps_rollup(struct seq_file *m, void *v)
2676 +
2677 + memset(&mss, 0, sizeof(mss));
2678 +
2679 +- down_read(&mm->mmap_sem);
2680 ++ ret = down_read_killable(&mm->mmap_sem);
2681 ++ if (ret)
2682 ++ goto out_put_mm;
2683 ++
2684 + hold_task_mempolicy(priv);
2685 +
2686 + for (vma = priv->mm->mmap; vma; vma = vma->vm_next) {
2687 +@@ -843,8 +850,9 @@ static int show_smaps_rollup(struct seq_file *m, void *v)
2688 +
2689 + release_task_mempolicy(priv);
2690 + up_read(&mm->mmap_sem);
2691 +- mmput(mm);
2692 +
2693 ++out_put_mm:
2694 ++ mmput(mm);
2695 + out_put_task:
2696 + put_task_struct(priv->task);
2697 + priv->task = NULL;
2698 +@@ -1127,7 +1135,10 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
2699 + goto out_mm;
2700 + }
2701 +
2702 +- down_read(&mm->mmap_sem);
2703 ++ if (down_read_killable(&mm->mmap_sem)) {
2704 ++ count = -EINTR;
2705 ++ goto out_mm;
2706 ++ }
2707 + tlb_gather_mmu(&tlb, mm, 0, -1);
2708 + if (type == CLEAR_REFS_SOFT_DIRTY) {
2709 + for (vma = mm->mmap; vma; vma = vma->vm_next) {
2710 +@@ -1531,7 +1542,9 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
2711 + /* overflow ? */
2712 + if (end < start_vaddr || end > end_vaddr)
2713 + end = end_vaddr;
2714 +- down_read(&mm->mmap_sem);
2715 ++ ret = down_read_killable(&mm->mmap_sem);
2716 ++ if (ret)
2717 ++ goto out_free;
2718 + ret = walk_page_range(start_vaddr, end, &pagemap_walk);
2719 + up_read(&mm->mmap_sem);
2720 + start_vaddr = end;
2721 +diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
2722 +index 0b63d68dedb2..5161894a6d62 100644
2723 +--- a/fs/proc/task_nommu.c
2724 ++++ b/fs/proc/task_nommu.c
2725 +@@ -211,7 +211,11 @@ static void *m_start(struct seq_file *m, loff_t *pos)
2726 + if (!mm || !mmget_not_zero(mm))
2727 + return NULL;
2728 +
2729 +- down_read(&mm->mmap_sem);
2730 ++ if (down_read_killable(&mm->mmap_sem)) {
2731 ++ mmput(mm);
2732 ++ return ERR_PTR(-EINTR);
2733 ++ }
2734 ++
2735 + /* start from the Nth VMA */
2736 + for (p = rb_first(&mm->mm_rb); p; p = rb_next(p))
2737 + if (n-- == 0)
2738 +diff --git a/include/linux/cred.h b/include/linux/cred.h
2739 +index 7eed6101c791..1dc351d8548b 100644
2740 +--- a/include/linux/cred.h
2741 ++++ b/include/linux/cred.h
2742 +@@ -150,7 +150,11 @@ struct cred {
2743 + struct user_struct *user; /* real user ID subscription */
2744 + struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */
2745 + struct group_info *group_info; /* supplementary groups for euid/fsgid */
2746 +- struct rcu_head rcu; /* RCU deletion hook */
2747 ++ /* RCU deletion */
2748 ++ union {
2749 ++ int non_rcu; /* Can we skip RCU deletion? */
2750 ++ struct rcu_head rcu; /* RCU deletion hook */
2751 ++ };
2752 + } __randomize_layout;
2753 +
2754 + extern void __put_cred(struct cred *);
2755 +@@ -248,6 +252,7 @@ static inline const struct cred *get_cred(const struct cred *cred)
2756 + {
2757 + struct cred *nonconst_cred = (struct cred *) cred;
2758 + validate_creds(cred);
2759 ++ nonconst_cred->non_rcu = 0;
2760 + return get_new_cred(nonconst_cred);
2761 + }
2762 +
2763 +diff --git a/include/linux/host1x.h b/include/linux/host1x.h
2764 +index 89110d896d72..aef6e2f73802 100644
2765 +--- a/include/linux/host1x.h
2766 ++++ b/include/linux/host1x.h
2767 +@@ -310,6 +310,8 @@ struct host1x_device {
2768 + struct list_head clients;
2769 +
2770 + bool registered;
2771 ++
2772 ++ struct device_dma_parameters dma_parms;
2773 + };
2774 +
2775 + static inline struct host1x_device *to_host1x_device(struct device *dev)
2776 +diff --git a/kernel/cred.c b/kernel/cred.c
2777 +index efd04b2ec84c..5ab1f7ec946e 100644
2778 +--- a/kernel/cred.c
2779 ++++ b/kernel/cred.c
2780 +@@ -147,7 +147,10 @@ void __put_cred(struct cred *cred)
2781 + BUG_ON(cred == current->cred);
2782 + BUG_ON(cred == current->real_cred);
2783 +
2784 +- call_rcu(&cred->rcu, put_cred_rcu);
2785 ++ if (cred->non_rcu)
2786 ++ put_cred_rcu(&cred->rcu);
2787 ++ else
2788 ++ call_rcu(&cred->rcu, put_cred_rcu);
2789 + }
2790 + EXPORT_SYMBOL(__put_cred);
2791 +
2792 +@@ -258,6 +261,7 @@ struct cred *prepare_creds(void)
2793 + old = task->cred;
2794 + memcpy(new, old, sizeof(struct cred));
2795 +
2796 ++ new->non_rcu = 0;
2797 + atomic_set(&new->usage, 1);
2798 + set_cred_subscribers(new, 0);
2799 + get_group_info(new->group_info);
2800 +@@ -537,7 +541,19 @@ const struct cred *override_creds(const struct cred *new)
2801 +
2802 + validate_creds(old);
2803 + validate_creds(new);
2804 +- get_cred(new);
2805 ++
2806 ++ /*
2807 ++ * NOTE! This uses 'get_new_cred()' rather than 'get_cred()'.
2808 ++ *
2809 ++ * That means that we do not clear the 'non_rcu' flag, since
2810 ++ * we are only installing the cred into the thread-synchronous
2811 ++ * '->cred' pointer, not the '->real_cred' pointer that is
2812 ++ * visible to other threads under RCU.
2813 ++ *
2814 ++ * Also note that we did validate_creds() manually, not depending
2815 ++ * on the validation in 'get_cred()'.
2816 ++ */
2817 ++ get_new_cred((struct cred *)new);
2818 + alter_cred_subscribers(new, 1);
2819 + rcu_assign_pointer(current->cred, new);
2820 + alter_cred_subscribers(old, -1);
2821 +@@ -620,6 +636,7 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon)
2822 + validate_creds(old);
2823 +
2824 + *new = *old;
2825 ++ new->non_rcu = 0;
2826 + atomic_set(&new->usage, 1);
2827 + set_cred_subscribers(new, 0);
2828 + get_uid(new->user);
2829 +diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
2830 +index 3dd980dfba2d..6fcc4650f0c4 100644
2831 +--- a/kernel/locking/lockdep_proc.c
2832 ++++ b/kernel/locking/lockdep_proc.c
2833 +@@ -200,7 +200,6 @@ static void lockdep_stats_debug_show(struct seq_file *m)
2834 +
2835 + static int lockdep_stats_show(struct seq_file *m, void *v)
2836 + {
2837 +- struct lock_class *class;
2838 + unsigned long nr_unused = 0, nr_uncategorized = 0,
2839 + nr_irq_safe = 0, nr_irq_unsafe = 0,
2840 + nr_softirq_safe = 0, nr_softirq_unsafe = 0,
2841 +@@ -210,6 +209,9 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
2842 + nr_hardirq_read_safe = 0, nr_hardirq_read_unsafe = 0,
2843 + sum_forward_deps = 0;
2844 +
2845 ++#ifdef CONFIG_PROVE_LOCKING
2846 ++ struct lock_class *class;
2847 ++
2848 + list_for_each_entry(class, &all_lock_classes, lock_entry) {
2849 +
2850 + if (class->usage_mask == 0)
2851 +@@ -241,12 +243,12 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
2852 + if (class->usage_mask & LOCKF_ENABLED_HARDIRQ_READ)
2853 + nr_hardirq_read_unsafe++;
2854 +
2855 +-#ifdef CONFIG_PROVE_LOCKING
2856 + sum_forward_deps += lockdep_count_forward_deps(class);
2857 +-#endif
2858 + }
2859 + #ifdef CONFIG_DEBUG_LOCKDEP
2860 + DEBUG_LOCKS_WARN_ON(debug_atomic_read(nr_unused_locks) != nr_unused);
2861 ++#endif
2862 ++
2863 + #endif
2864 + seq_printf(m, " lock-classes: %11lu [max: %lu]\n",
2865 + nr_lock_classes, MAX_LOCKDEP_KEYS);
2866 +diff --git a/mm/gup.c b/mm/gup.c
2867 +index caadd31714a5..f3088d25bd92 100644
2868 +--- a/mm/gup.c
2869 ++++ b/mm/gup.c
2870 +@@ -458,11 +458,14 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address,
2871 + pgd = pgd_offset_k(address);
2872 + else
2873 + pgd = pgd_offset_gate(mm, address);
2874 +- BUG_ON(pgd_none(*pgd));
2875 ++ if (pgd_none(*pgd))
2876 ++ return -EFAULT;
2877 + p4d = p4d_offset(pgd, address);
2878 +- BUG_ON(p4d_none(*p4d));
2879 ++ if (p4d_none(*p4d))
2880 ++ return -EFAULT;
2881 + pud = pud_offset(p4d, address);
2882 +- BUG_ON(pud_none(*pud));
2883 ++ if (pud_none(*pud))
2884 ++ return -EFAULT;
2885 + pmd = pmd_offset(pud, address);
2886 + if (!pmd_present(*pmd))
2887 + return -EFAULT;
2888 +@@ -1367,7 +1370,8 @@ static inline pte_t gup_get_pte(pte_t *ptep)
2889 + }
2890 + #endif
2891 +
2892 +-static void undo_dev_pagemap(int *nr, int nr_start, struct page **pages)
2893 ++static void __maybe_unused undo_dev_pagemap(int *nr, int nr_start,
2894 ++ struct page **pages)
2895 + {
2896 + while ((*nr) - nr_start) {
2897 + struct page *page = pages[--(*nr)];
2898 +diff --git a/mm/kmemleak.c b/mm/kmemleak.c
2899 +index 72e3fb3bb037..6c94b6865ac2 100644
2900 +--- a/mm/kmemleak.c
2901 ++++ b/mm/kmemleak.c
2902 +@@ -576,7 +576,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
2903 + if (in_irq()) {
2904 + object->pid = 0;
2905 + strncpy(object->comm, "hardirq", sizeof(object->comm));
2906 +- } else if (in_softirq()) {
2907 ++ } else if (in_serving_softirq()) {
2908 + object->pid = 0;
2909 + strncpy(object->comm, "softirq", sizeof(object->comm));
2910 + } else {
2911 +diff --git a/mm/memory.c b/mm/memory.c
2912 +index e0010cb870e0..fb5655b518c9 100644
2913 +--- a/mm/memory.c
2914 ++++ b/mm/memory.c
2915 +@@ -4491,7 +4491,9 @@ int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
2916 + void *old_buf = buf;
2917 + int write = gup_flags & FOLL_WRITE;
2918 +
2919 +- down_read(&mm->mmap_sem);
2920 ++ if (down_read_killable(&mm->mmap_sem))
2921 ++ return 0;
2922 ++
2923 + /* ignore errors, just check how much was successfully transferred */
2924 + while (len) {
2925 + int bytes, ret, offset;
2926 +diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
2927 +index 82bb1a939c0e..06dedb175572 100644
2928 +--- a/mm/mmu_notifier.c
2929 ++++ b/mm/mmu_notifier.c
2930 +@@ -316,7 +316,7 @@ static int do_mmu_notifier_register(struct mmu_notifier *mn,
2931 + * thanks to mm_take_all_locks().
2932 + */
2933 + spin_lock(&mm->mmu_notifier_mm->lock);
2934 +- hlist_add_head(&mn->hlist, &mm->mmu_notifier_mm->list);
2935 ++ hlist_add_head_rcu(&mn->hlist, &mm->mmu_notifier_mm->list);
2936 + spin_unlock(&mm->mmu_notifier_mm->lock);
2937 +
2938 + mm_drop_all_locks(mm);
2939 +diff --git a/mm/nommu.c b/mm/nommu.c
2940 +index e4aac33216ae..1d63ecfc98c5 100644
2941 +--- a/mm/nommu.c
2942 ++++ b/mm/nommu.c
2943 +@@ -1779,7 +1779,8 @@ int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
2944 + struct vm_area_struct *vma;
2945 + int write = gup_flags & FOLL_WRITE;
2946 +
2947 +- down_read(&mm->mmap_sem);
2948 ++ if (down_read_killable(&mm->mmap_sem))
2949 ++ return 0;
2950 +
2951 + /* the access must start within one of the target process's mappings */
2952 + vma = find_vma(mm, addr);
2953 +diff --git a/mm/swap.c b/mm/swap.c
2954 +index a3fc028e338e..45fdbfb6b2a6 100644
2955 +--- a/mm/swap.c
2956 ++++ b/mm/swap.c
2957 +@@ -740,15 +740,20 @@ void release_pages(struct page **pages, int nr)
2958 + if (is_huge_zero_page(page))
2959 + continue;
2960 +
2961 +- /* Device public page can not be huge page */
2962 +- if (is_device_public_page(page)) {
2963 ++ if (is_zone_device_page(page)) {
2964 + if (locked_pgdat) {
2965 + spin_unlock_irqrestore(&locked_pgdat->lru_lock,
2966 + flags);
2967 + locked_pgdat = NULL;
2968 + }
2969 +- put_devmap_managed_page(page);
2970 +- continue;
2971 ++ /*
2972 ++ * ZONE_DEVICE pages that return 'false' from
2973 ++ * put_devmap_managed_page() do not require special
2974 ++ * processing, and instead, expect a call to
2975 ++ * put_page_testzero().
2976 ++ */
2977 ++ if (put_devmap_managed_page(page))
2978 ++ continue;
2979 + }
2980 +
2981 + page = compound_head(page);
2982 +diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
2983 +index a827547aa102..b131561a9469 100644
2984 +--- a/net/vmw_vsock/hyperv_transport.c
2985 ++++ b/net/vmw_vsock/hyperv_transport.c
2986 +@@ -217,18 +217,6 @@ static void hvs_set_channel_pending_send_size(struct vmbus_channel *chan)
2987 + set_channel_pending_send_size(chan,
2988 + HVS_PKT_LEN(HVS_SEND_BUF_SIZE));
2989 +
2990 +- /* See hvs_stream_has_space(): we must make sure the host has seen
2991 +- * the new pending send size, before we can re-check the writable
2992 +- * bytes.
2993 +- */
2994 +- virt_mb();
2995 +-}
2996 +-
2997 +-static void hvs_clear_channel_pending_send_size(struct vmbus_channel *chan)
2998 +-{
2999 +- set_channel_pending_send_size(chan, 0);
3000 +-
3001 +- /* Ditto */
3002 + virt_mb();
3003 + }
3004 +
3005 +@@ -298,9 +286,6 @@ static void hvs_channel_cb(void *ctx)
3006 + if (hvs_channel_readable(chan))
3007 + sk->sk_data_ready(sk);
3008 +
3009 +- /* See hvs_stream_has_space(): when we reach here, the writable bytes
3010 +- * may be already less than HVS_PKT_LEN(HVS_SEND_BUF_SIZE).
3011 +- */
3012 + if (hv_get_bytes_to_write(&chan->outbound) > 0)
3013 + sk->sk_write_space(sk);
3014 + }
3015 +@@ -328,8 +313,9 @@ static void hvs_open_connection(struct vmbus_channel *chan)
3016 +
3017 + struct sockaddr_vm addr;
3018 + struct sock *sk, *new = NULL;
3019 +- struct vsock_sock *vnew;
3020 +- struct hvsock *hvs, *hvs_new;
3021 ++ struct vsock_sock *vnew = NULL;
3022 ++ struct hvsock *hvs = NULL;
3023 ++ struct hvsock *hvs_new = NULL;
3024 + int ret;
3025 +
3026 + if_type = &chan->offermsg.offer.if_type;
3027 +@@ -388,6 +374,13 @@ static void hvs_open_connection(struct vmbus_channel *chan)
3028 + set_per_channel_state(chan, conn_from_host ? new : sk);
3029 + vmbus_set_chn_rescind_callback(chan, hvs_close_connection);
3030 +
3031 ++ /* Set the pending send size to max packet size to always get
3032 ++ * notifications from the host when there is enough writable space.
3033 ++ * The host is optimized to send notifications only when the pending
3034 ++ * size boundary is crossed, and not always.
3035 ++ */
3036 ++ hvs_set_channel_pending_send_size(chan);
3037 ++
3038 + if (conn_from_host) {
3039 + new->sk_state = TCP_ESTABLISHED;
3040 + sk->sk_ack_backlog++;
3041 +@@ -651,23 +644,8 @@ static s64 hvs_stream_has_data(struct vsock_sock *vsk)
3042 + static s64 hvs_stream_has_space(struct vsock_sock *vsk)
3043 + {
3044 + struct hvsock *hvs = vsk->trans;
3045 +- struct vmbus_channel *chan = hvs->chan;
3046 +- s64 ret;
3047 +-
3048 +- ret = hvs_channel_writable_bytes(chan);
3049 +- if (ret > 0) {
3050 +- hvs_clear_channel_pending_send_size(chan);
3051 +- } else {
3052 +- /* See hvs_channel_cb() */
3053 +- hvs_set_channel_pending_send_size(chan);
3054 +-
3055 +- /* Re-check the writable bytes to avoid race */
3056 +- ret = hvs_channel_writable_bytes(chan);
3057 +- if (ret > 0)
3058 +- hvs_clear_channel_pending_send_size(chan);
3059 +- }
3060 +
3061 +- return ret;
3062 ++ return hvs_channel_writable_bytes(hvs->chan);
3063 + }
3064 +
3065 + static u64 hvs_stream_rcvhiwat(struct vsock_sock *vsk)
3066 +diff --git a/scripts/genksyms/keywords.c b/scripts/genksyms/keywords.c
3067 +index 9f40bcd17d07..f6956aa41366 100644
3068 +--- a/scripts/genksyms/keywords.c
3069 ++++ b/scripts/genksyms/keywords.c
3070 +@@ -24,6 +24,10 @@ static struct resword {
3071 + { "__volatile__", VOLATILE_KEYW },
3072 + { "__builtin_va_list", VA_LIST_KEYW },
3073 +
3074 ++ { "__int128", BUILTIN_INT_KEYW },
3075 ++ { "__int128_t", BUILTIN_INT_KEYW },
3076 ++ { "__uint128_t", BUILTIN_INT_KEYW },
3077 ++
3078 + // According to rth, c99 defines "_Bool", __restrict", __restrict__", "restrict". KAO
3079 + { "_Bool", BOOL_KEYW },
3080 + { "_restrict", RESTRICT_KEYW },
3081 +diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y
3082 +index 00a6d7e54971..1ebcf52cd0f9 100644
3083 +--- a/scripts/genksyms/parse.y
3084 ++++ b/scripts/genksyms/parse.y
3085 +@@ -76,6 +76,7 @@ static void record_compound(struct string_list **keyw,
3086 + %token ATTRIBUTE_KEYW
3087 + %token AUTO_KEYW
3088 + %token BOOL_KEYW
3089 ++%token BUILTIN_INT_KEYW
3090 + %token CHAR_KEYW
3091 + %token CONST_KEYW
3092 + %token DOUBLE_KEYW
3093 +@@ -263,6 +264,7 @@ simple_type_specifier:
3094 + | VOID_KEYW
3095 + | BOOL_KEYW
3096 + | VA_LIST_KEYW
3097 ++ | BUILTIN_INT_KEYW
3098 + | TYPE { (*$1)->tag = SYM_TYPEDEF; $$ = $1; }
3099 + ;
3100 +
3101 +diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
3102 +index 0c9c54b57515..31ed7f3f0e15 100644
3103 +--- a/scripts/kallsyms.c
3104 ++++ b/scripts/kallsyms.c
3105 +@@ -152,6 +152,9 @@ static int read_symbol(FILE *in, struct sym_entry *s)
3106 + /* exclude debugging symbols */
3107 + else if (stype == 'N' || stype == 'n')
3108 + return -1;
3109 ++ /* exclude s390 kasan local symbols */
3110 ++ else if (!strncmp(sym, ".LASANPC", 8))
3111 ++ return -1;
3112 +
3113 + /* include the type field in the symbol name, so that it gets
3114 + * compressed together */
3115 +diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
3116 +index 2e7793735e14..ccfbfde61556 100644
3117 +--- a/scripts/recordmcount.h
3118 ++++ b/scripts/recordmcount.h
3119 +@@ -326,7 +326,8 @@ static uint_t *sift_rel_mcount(uint_t *mlocp,
3120 + if (!mcountsym)
3121 + mcountsym = get_mcountsym(sym0, relp, str0);
3122 +
3123 +- if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
3124 ++ if (mcountsym && mcountsym == Elf_r_sym(relp) &&
3125 ++ !is_fake_mcount(relp)) {
3126 + uint_t const addend =
3127 + _w(_w(relp->r_offset) - recval + mcount_adjust);
3128 + mrelp->r_offset = _w(offbase
3129 +diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c
3130 +index 9cbf6927abe9..ca50ff444796 100644
3131 +--- a/sound/ac97/bus.c
3132 ++++ b/sound/ac97/bus.c
3133 +@@ -125,17 +125,12 @@ static int ac97_codec_add(struct ac97_controller *ac97_ctrl, int idx,
3134 + vendor_id);
3135 +
3136 + ret = device_add(&codec->dev);
3137 +- if (ret)
3138 +- goto err_free_codec;
3139 ++ if (ret) {
3140 ++ put_device(&codec->dev);
3141 ++ return ret;
3142 ++ }
3143 +
3144 + return 0;
3145 +-err_free_codec:
3146 +- of_node_put(codec->dev.of_node);
3147 +- put_device(&codec->dev);
3148 +- kfree(codec);
3149 +- ac97_ctrl->codecs[idx] = NULL;
3150 +-
3151 +- return ret;
3152 + }
3153 +
3154 + unsigned int snd_ac97_bus_scan_one(struct ac97_controller *adrv,
3155 +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
3156 +index 3cbd2119e148..b70fbfa80546 100644
3157 +--- a/sound/pci/hda/patch_conexant.c
3158 ++++ b/sound/pci/hda/patch_conexant.c
3159 +@@ -1096,6 +1096,7 @@ static int patch_conexant_auto(struct hda_codec *codec)
3160 + */
3161 +
3162 + static const struct hda_device_id snd_hda_id_conexant[] = {
3163 ++ HDA_CODEC_ENTRY(0x14f11f86, "CX8070", patch_conexant_auto),
3164 + HDA_CODEC_ENTRY(0x14f12008, "CX8200", patch_conexant_auto),
3165 + HDA_CODEC_ENTRY(0x14f15045, "CX20549 (Venice)", patch_conexant_auto),
3166 + HDA_CODEC_ENTRY(0x14f15047, "CX20551 (Waikiki)", patch_conexant_auto),
3167 +diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
3168 +index 5f3c87264e66..da627b015b32 100644
3169 +--- a/sound/usb/line6/podhd.c
3170 ++++ b/sound/usb/line6/podhd.c
3171 +@@ -417,7 +417,7 @@ static const struct line6_properties podhd_properties_table[] = {
3172 + .name = "POD HD500",
3173 + .capabilities = LINE6_CAP_PCM
3174 + | LINE6_CAP_HWMON,
3175 +- .altsetting = 1,
3176 ++ .altsetting = 0,
3177 + .ep_ctrl_r = 0x81,
3178 + .ep_ctrl_w = 0x01,
3179 + .ep_audio_r = 0x86,
3180 +diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
3181 +index 7a6d61c6c012..55272fef3b50 100644
3182 +--- a/tools/iio/iio_utils.c
3183 ++++ b/tools/iio/iio_utils.c
3184 +@@ -159,9 +159,9 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used,
3185 + *be = (endianchar == 'b');
3186 + *bytes = padint / 8;
3187 + if (*bits_used == 64)
3188 +- *mask = ~0;
3189 ++ *mask = ~(0ULL);
3190 + else
3191 +- *mask = (1ULL << *bits_used) - 1;
3192 ++ *mask = (1ULL << *bits_used) - 1ULL;
3193 +
3194 + *is_signed = (signchar == 's');
3195 + if (fclose(sysfsfp)) {
3196 +diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
3197 +index 40720150ccd8..789962565c9c 100644
3198 +--- a/tools/perf/builtin-stat.c
3199 ++++ b/tools/perf/builtin-stat.c
3200 +@@ -2497,8 +2497,8 @@ static int add_default_attributes(void)
3201 + fprintf(stderr,
3202 + "Cannot set up top down events %s: %d\n",
3203 + str, err);
3204 +- free(str);
3205 + parse_events_print_error(&errinfo, str);
3206 ++ free(str);
3207 + return -1;
3208 + }
3209 + } else {
3210 +diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
3211 +index 33eefc33e0ea..d0733251a386 100644
3212 +--- a/tools/perf/builtin-top.c
3213 ++++ b/tools/perf/builtin-top.c
3214 +@@ -99,7 +99,7 @@ static void perf_top__resize(struct perf_top *top)
3215 +
3216 + static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
3217 + {
3218 +- struct perf_evsel *evsel = hists_to_evsel(he->hists);
3219 ++ struct perf_evsel *evsel;
3220 + struct symbol *sym;
3221 + struct annotation *notes;
3222 + struct map *map;
3223 +@@ -108,6 +108,8 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
3224 + if (!he || !he->ms.sym)
3225 + return -1;
3226 +
3227 ++ evsel = hists_to_evsel(he->hists);
3228 ++
3229 + sym = he->ms.sym;
3230 + map = he->ms.map;
3231 +
3232 +@@ -224,7 +226,7 @@ static void perf_top__record_precise_ip(struct perf_top *top,
3233 + static void perf_top__show_details(struct perf_top *top)
3234 + {
3235 + struct hist_entry *he = top->sym_filter_entry;
3236 +- struct perf_evsel *evsel = hists_to_evsel(he->hists);
3237 ++ struct perf_evsel *evsel;
3238 + struct annotation *notes;
3239 + struct symbol *symbol;
3240 + int more;
3241 +@@ -232,6 +234,8 @@ static void perf_top__show_details(struct perf_top *top)
3242 + if (!he)
3243 + return;
3244 +
3245 ++ evsel = hists_to_evsel(he->hists);
3246 ++
3247 + symbol = he->ms.sym;
3248 + notes = symbol__annotation(symbol);
3249 +
3250 +diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c
3251 +index b1af2499a3c9..7a9b123c7bfc 100644
3252 +--- a/tools/perf/tests/mmap-thread-lookup.c
3253 ++++ b/tools/perf/tests/mmap-thread-lookup.c
3254 +@@ -52,7 +52,7 @@ static void *thread_fn(void *arg)
3255 + {
3256 + struct thread_data *td = arg;
3257 + ssize_t ret;
3258 +- int go;
3259 ++ int go = 0;
3260 +
3261 + if (thread_init(td))
3262 + return NULL;
3263 +diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
3264 +index a96f62ca984a..692d2fa31c35 100644
3265 +--- a/tools/perf/ui/browsers/hists.c
3266 ++++ b/tools/perf/ui/browsers/hists.c
3267 +@@ -633,7 +633,11 @@ int hist_browser__run(struct hist_browser *browser, const char *help,
3268 + switch (key) {
3269 + case K_TIMER: {
3270 + u64 nr_entries;
3271 +- hbt->timer(hbt->arg);
3272 ++
3273 ++ WARN_ON_ONCE(!hbt);
3274 ++
3275 ++ if (hbt)
3276 ++ hbt->timer(hbt->arg);
3277 +
3278 + if (hist_browser__has_filter(browser) ||
3279 + symbol_conf.report_hierarchy)
3280 +@@ -2707,7 +2711,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
3281 + {
3282 + struct hists *hists = evsel__hists(evsel);
3283 + struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env, annotation_opts);
3284 +- struct branch_info *bi;
3285 ++ struct branch_info *bi = NULL;
3286 + #define MAX_OPTIONS 16
3287 + char *options[MAX_OPTIONS];
3288 + struct popup_action actions[MAX_OPTIONS];
3289 +@@ -2973,7 +2977,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
3290 + goto skip_annotation;
3291 +
3292 + if (sort__mode == SORT_MODE__BRANCH) {
3293 +- bi = browser->he_selection->branch_info;
3294 ++
3295 ++ if (browser->he_selection)
3296 ++ bi = browser->he_selection->branch_info;
3297 +
3298 + if (bi == NULL)
3299 + goto skip_annotation;
3300 +@@ -3144,7 +3150,8 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
3301 +
3302 + switch (key) {
3303 + case K_TIMER:
3304 +- hbt->timer(hbt->arg);
3305 ++ if (hbt)
3306 ++ hbt->timer(hbt->arg);
3307 +
3308 + if (!menu->lost_events_warned &&
3309 + menu->lost_events &&
3310 +diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
3311 +index c357051dd2b6..daea1fdf7385 100644
3312 +--- a/tools/perf/util/annotate.c
3313 ++++ b/tools/perf/util/annotate.c
3314 +@@ -1079,16 +1079,14 @@ static int disasm_line__parse(char *line, const char **namep, char **rawp)
3315 + *namep = strdup(name);
3316 +
3317 + if (*namep == NULL)
3318 +- goto out_free_name;
3319 ++ goto out;
3320 +
3321 + (*rawp)[0] = tmp;
3322 + *rawp = ltrim(*rawp);
3323 +
3324 + return 0;
3325 +
3326 +-out_free_name:
3327 +- free((void *)namep);
3328 +- *namep = NULL;
3329 ++out:
3330 + return -1;
3331 + }
3332 +
3333 +diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
3334 +index 11086097fc9f..f016d1b330e5 100644
3335 +--- a/tools/perf/util/session.c
3336 ++++ b/tools/perf/util/session.c
3337 +@@ -1141,6 +1141,9 @@ static void dump_read(struct perf_evsel *evsel, union perf_event *event)
3338 + evsel ? perf_evsel__name(evsel) : "FAIL",
3339 + event->read.value);
3340 +
3341 ++ if (!evsel)
3342 ++ return;
3343 ++
3344 + read_format = evsel->attr.read_format;
3345 +
3346 + if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)