Contents of /trunk/kernel-alx/patches-4.9/0279-4.9.180-all-fixes.patch
Parent Directory | Revision Log
Revision 3356 -
(show annotations)
(download)
Tue Jun 18 09:42:08 2019 UTC (5 years, 3 months ago) by niro
File size: 122555 byte(s)
Tue Jun 18 09:42:08 2019 UTC (5 years, 3 months ago) by niro
File size: 122555 byte(s)
-linux-4.9.180
1 | diff --git a/Makefile b/Makefile |
2 | index d60795319d8a..0b996e9d2c5f 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 9 |
8 | -SUBLEVEL = 179 |
9 | +SUBLEVEL = 180 |
10 | EXTRAVERSION = |
11 | NAME = Roaring Lionus |
12 | |
13 | diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h |
14 | index b74b174ac9fc..b458e4122794 100644 |
15 | --- a/arch/arm/include/asm/cp15.h |
16 | +++ b/arch/arm/include/asm/cp15.h |
17 | @@ -67,6 +67,8 @@ |
18 | #define BPIALL __ACCESS_CP15(c7, 0, c5, 6) |
19 | #define ICIALLU __ACCESS_CP15(c7, 0, c5, 0) |
20 | |
21 | +#define CNTVCT __ACCESS_CP15_64(1, c14) |
22 | + |
23 | extern unsigned long cr_alignment; /* defined in entry-armv.S */ |
24 | |
25 | static inline unsigned long get_cr(void) |
26 | diff --git a/arch/arm/vdso/vgettimeofday.c b/arch/arm/vdso/vgettimeofday.c |
27 | index 79214d5ff097..3af02d2a0b7f 100644 |
28 | --- a/arch/arm/vdso/vgettimeofday.c |
29 | +++ b/arch/arm/vdso/vgettimeofday.c |
30 | @@ -18,9 +18,9 @@ |
31 | #include <linux/compiler.h> |
32 | #include <linux/hrtimer.h> |
33 | #include <linux/time.h> |
34 | -#include <asm/arch_timer.h> |
35 | #include <asm/barrier.h> |
36 | #include <asm/bug.h> |
37 | +#include <asm/cp15.h> |
38 | #include <asm/page.h> |
39 | #include <asm/unistd.h> |
40 | #include <asm/vdso_datapage.h> |
41 | @@ -123,7 +123,8 @@ static notrace u64 get_ns(struct vdso_data *vdata) |
42 | u64 cycle_now; |
43 | u64 nsec; |
44 | |
45 | - cycle_now = arch_counter_get_cntvct(); |
46 | + isb(); |
47 | + cycle_now = read_sysreg(CNTVCT); |
48 | |
49 | cycle_delta = (cycle_now - vdata->cs_cycle_last) & vdata->cs_mask; |
50 | |
51 | diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
52 | index 3a30a3994e4a..73e3718356b0 100644 |
53 | --- a/arch/arm64/include/asm/pgtable.h |
54 | +++ b/arch/arm64/include/asm/pgtable.h |
55 | @@ -413,6 +413,8 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) |
56 | return pmd_val(pmd) & PHYS_MASK & (s32)PAGE_MASK; |
57 | } |
58 | |
59 | +static inline void pte_unmap(pte_t *pte) { } |
60 | + |
61 | /* Find an entry in the third-level page table. */ |
62 | #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
63 | |
64 | @@ -421,7 +423,6 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) |
65 | |
66 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) |
67 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) |
68 | -#define pte_unmap(pte) do { } while (0) |
69 | #define pte_unmap_nested(pte) do { } while (0) |
70 | |
71 | #define pte_set_fixmap(addr) ((pte_t *)set_fixmap_offset(FIX_PTE, addr)) |
72 | diff --git a/arch/arm64/include/asm/vdso_datapage.h b/arch/arm64/include/asm/vdso_datapage.h |
73 | index 2b9a63771eda..f89263c8e11a 100644 |
74 | --- a/arch/arm64/include/asm/vdso_datapage.h |
75 | +++ b/arch/arm64/include/asm/vdso_datapage.h |
76 | @@ -38,6 +38,7 @@ struct vdso_data { |
77 | __u32 tz_minuteswest; /* Whacky timezone stuff */ |
78 | __u32 tz_dsttime; |
79 | __u32 use_syscall; |
80 | + __u32 hrtimer_res; |
81 | }; |
82 | |
83 | #endif /* !__ASSEMBLY__ */ |
84 | diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c |
85 | index bd239b1b7a68..95878bea27f9 100644 |
86 | --- a/arch/arm64/kernel/asm-offsets.c |
87 | +++ b/arch/arm64/kernel/asm-offsets.c |
88 | @@ -92,7 +92,7 @@ int main(void) |
89 | DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); |
90 | DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); |
91 | DEFINE(CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_RAW); |
92 | - DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); |
93 | + DEFINE(CLOCK_REALTIME_RES, offsetof(struct vdso_data, hrtimer_res)); |
94 | DEFINE(CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE); |
95 | DEFINE(CLOCK_MONOTONIC_COARSE,CLOCK_MONOTONIC_COARSE); |
96 | DEFINE(CLOCK_COARSE_RES, LOW_RES_NSEC); |
97 | diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c |
98 | index e137ceaf5016..82b465207ed0 100644 |
99 | --- a/arch/arm64/kernel/cpu_ops.c |
100 | +++ b/arch/arm64/kernel/cpu_ops.c |
101 | @@ -85,6 +85,7 @@ static const char *__init cpu_read_enable_method(int cpu) |
102 | pr_err("%s: missing enable-method property\n", |
103 | dn->full_name); |
104 | } |
105 | + of_node_put(dn); |
106 | } else { |
107 | enable_method = acpi_get_enable_method(cpu); |
108 | if (!enable_method) { |
109 | diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c |
110 | index 4bcfe01b5aad..c9b9a5a322eb 100644 |
111 | --- a/arch/arm64/kernel/vdso.c |
112 | +++ b/arch/arm64/kernel/vdso.c |
113 | @@ -213,6 +213,9 @@ void update_vsyscall(struct timekeeper *tk) |
114 | vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; |
115 | vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; |
116 | |
117 | + /* Read without the seqlock held by clock_getres() */ |
118 | + WRITE_ONCE(vdso_data->hrtimer_res, hrtimer_resolution); |
119 | + |
120 | if (!use_syscall) { |
121 | /* tkr_mono.cycle_last == tkr_raw.cycle_last */ |
122 | vdso_data->cs_cycle_last = tk->tkr_mono.cycle_last; |
123 | diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S |
124 | index 76320e920965..df829c4346fa 100644 |
125 | --- a/arch/arm64/kernel/vdso/gettimeofday.S |
126 | +++ b/arch/arm64/kernel/vdso/gettimeofday.S |
127 | @@ -301,13 +301,14 @@ ENTRY(__kernel_clock_getres) |
128 | ccmp w0, #CLOCK_MONOTONIC_RAW, #0x4, ne |
129 | b.ne 1f |
130 | |
131 | - ldr x2, 5f |
132 | + adr vdso_data, _vdso_data |
133 | + ldr w2, [vdso_data, #CLOCK_REALTIME_RES] |
134 | b 2f |
135 | 1: |
136 | cmp w0, #CLOCK_REALTIME_COARSE |
137 | ccmp w0, #CLOCK_MONOTONIC_COARSE, #0x4, ne |
138 | b.ne 4f |
139 | - ldr x2, 6f |
140 | + ldr x2, 5f |
141 | 2: |
142 | cbz w1, 3f |
143 | stp xzr, x2, [x1] |
144 | @@ -321,8 +322,6 @@ ENTRY(__kernel_clock_getres) |
145 | svc #0 |
146 | ret |
147 | 5: |
148 | - .quad CLOCK_REALTIME_RES |
149 | -6: |
150 | .quad CLOCK_COARSE_RES |
151 | .cfi_endproc |
152 | ENDPROC(__kernel_clock_getres) |
153 | diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S |
154 | index f5fde8d389c9..3ceec224d3d2 100644 |
155 | --- a/arch/arm64/mm/proc.S |
156 | +++ b/arch/arm64/mm/proc.S |
157 | @@ -64,17 +64,18 @@ ENTRY(cpu_do_suspend) |
158 | mrs x2, tpidr_el0 |
159 | mrs x3, tpidrro_el0 |
160 | mrs x4, contextidr_el1 |
161 | - mrs x5, cpacr_el1 |
162 | - mrs x6, tcr_el1 |
163 | - mrs x7, vbar_el1 |
164 | - mrs x8, mdscr_el1 |
165 | - mrs x9, oslsr_el1 |
166 | - mrs x10, sctlr_el1 |
167 | + mrs x5, osdlr_el1 |
168 | + mrs x6, cpacr_el1 |
169 | + mrs x7, tcr_el1 |
170 | + mrs x8, vbar_el1 |
171 | + mrs x9, mdscr_el1 |
172 | + mrs x10, oslsr_el1 |
173 | + mrs x11, sctlr_el1 |
174 | stp x2, x3, [x0] |
175 | - stp x4, xzr, [x0, #16] |
176 | - stp x5, x6, [x0, #32] |
177 | - stp x7, x8, [x0, #48] |
178 | - stp x9, x10, [x0, #64] |
179 | + stp x4, x5, [x0, #16] |
180 | + stp x6, x7, [x0, #32] |
181 | + stp x8, x9, [x0, #48] |
182 | + stp x10, x11, [x0, #64] |
183 | ret |
184 | ENDPROC(cpu_do_suspend) |
185 | |
186 | @@ -96,8 +97,8 @@ ENTRY(cpu_do_resume) |
187 | msr cpacr_el1, x6 |
188 | |
189 | /* Don't change t0sz here, mask those bits when restoring */ |
190 | - mrs x5, tcr_el1 |
191 | - bfi x8, x5, TCR_T0SZ_OFFSET, TCR_TxSZ_WIDTH |
192 | + mrs x7, tcr_el1 |
193 | + bfi x8, x7, TCR_T0SZ_OFFSET, TCR_TxSZ_WIDTH |
194 | |
195 | msr tcr_el1, x8 |
196 | msr vbar_el1, x9 |
197 | @@ -115,6 +116,7 @@ ENTRY(cpu_do_resume) |
198 | /* |
199 | * Restore oslsr_el1 by writing oslar_el1 |
200 | */ |
201 | + msr osdlr_el1, x5 |
202 | ubfx x11, x11, #1, #1 |
203 | msr oslar_el1, x11 |
204 | reset_pmuserenr_el0 x0 // Disable PMU access from EL0 |
205 | diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c |
206 | index 9d9f6f334d3c..3da3e2b1b51b 100644 |
207 | --- a/arch/powerpc/boot/addnote.c |
208 | +++ b/arch/powerpc/boot/addnote.c |
209 | @@ -223,7 +223,11 @@ main(int ac, char **av) |
210 | PUT_16(E_PHNUM, np + 2); |
211 | |
212 | /* write back */ |
213 | - lseek(fd, (long) 0, SEEK_SET); |
214 | + i = lseek(fd, (long) 0, SEEK_SET); |
215 | + if (i < 0) { |
216 | + perror("lseek"); |
217 | + exit(1); |
218 | + } |
219 | i = write(fd, buf, n); |
220 | if (i < 0) { |
221 | perror("write"); |
222 | diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c |
223 | index 9cad2ed812ab..31e9064ba628 100644 |
224 | --- a/arch/powerpc/mm/numa.c |
225 | +++ b/arch/powerpc/mm/numa.c |
226 | @@ -1574,6 +1574,9 @@ int start_topology_update(void) |
227 | { |
228 | int rc = 0; |
229 | |
230 | + if (!topology_updates_enabled) |
231 | + return 0; |
232 | + |
233 | if (firmware_has_feature(FW_FEATURE_PRRN)) { |
234 | if (!prrn_enabled) { |
235 | prrn_enabled = 1; |
236 | @@ -1603,6 +1606,9 @@ int stop_topology_update(void) |
237 | { |
238 | int rc = 0; |
239 | |
240 | + if (!topology_updates_enabled) |
241 | + return 0; |
242 | + |
243 | if (prrn_enabled) { |
244 | prrn_enabled = 0; |
245 | #ifdef CONFIG_SMP |
246 | @@ -1648,11 +1654,13 @@ static ssize_t topology_write(struct file *file, const char __user *buf, |
247 | |
248 | kbuf[read_len] = '\0'; |
249 | |
250 | - if (!strncmp(kbuf, "on", 2)) |
251 | + if (!strncmp(kbuf, "on", 2)) { |
252 | + topology_updates_enabled = true; |
253 | start_topology_update(); |
254 | - else if (!strncmp(kbuf, "off", 3)) |
255 | + } else if (!strncmp(kbuf, "off", 3)) { |
256 | stop_topology_update(); |
257 | - else |
258 | + topology_updates_enabled = false; |
259 | + } else |
260 | return -EINVAL; |
261 | |
262 | return count; |
263 | @@ -1667,9 +1675,7 @@ static const struct file_operations topology_ops = { |
264 | |
265 | static int topology_update_init(void) |
266 | { |
267 | - /* Do not poll for changes if disabled at boot */ |
268 | - if (topology_updates_enabled) |
269 | - start_topology_update(); |
270 | + start_topology_update(); |
271 | |
272 | if (!proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops)) |
273 | return -ENOMEM; |
274 | diff --git a/arch/x86/Makefile b/arch/x86/Makefile |
275 | index b5226a009973..2996a1d0a410 100644 |
276 | --- a/arch/x86/Makefile |
277 | +++ b/arch/x86/Makefile |
278 | @@ -47,7 +47,7 @@ export REALMODE_CFLAGS |
279 | export BITS |
280 | |
281 | ifdef CONFIG_X86_NEED_RELOCS |
282 | - LDFLAGS_vmlinux := --emit-relocs |
283 | + LDFLAGS_vmlinux := --emit-relocs --discard-none |
284 | endif |
285 | |
286 | # |
287 | diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c |
288 | index cb13c0564ea7..9978ea4382bf 100644 |
289 | --- a/arch/x86/ia32/ia32_signal.c |
290 | +++ b/arch/x86/ia32/ia32_signal.c |
291 | @@ -60,9 +60,8 @@ |
292 | } while (0) |
293 | |
294 | #define RELOAD_SEG(seg) { \ |
295 | - unsigned int pre = GET_SEG(seg); \ |
296 | + unsigned int pre = (seg) | 3; \ |
297 | unsigned int cur = get_user_seg(seg); \ |
298 | - pre |= 3; \ |
299 | if (pre != cur) \ |
300 | set_user_seg(seg, pre); \ |
301 | } |
302 | @@ -71,6 +70,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, |
303 | struct sigcontext_32 __user *sc) |
304 | { |
305 | unsigned int tmpflags, err = 0; |
306 | + u16 gs, fs, es, ds; |
307 | void __user *buf; |
308 | u32 tmp; |
309 | |
310 | @@ -78,16 +78,10 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, |
311 | current->restart_block.fn = do_no_restart_syscall; |
312 | |
313 | get_user_try { |
314 | - /* |
315 | - * Reload fs and gs if they have changed in the signal |
316 | - * handler. This does not handle long fs/gs base changes in |
317 | - * the handler, but does not clobber them at least in the |
318 | - * normal case. |
319 | - */ |
320 | - RELOAD_SEG(gs); |
321 | - RELOAD_SEG(fs); |
322 | - RELOAD_SEG(ds); |
323 | - RELOAD_SEG(es); |
324 | + gs = GET_SEG(gs); |
325 | + fs = GET_SEG(fs); |
326 | + ds = GET_SEG(ds); |
327 | + es = GET_SEG(es); |
328 | |
329 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); |
330 | COPY(dx); COPY(cx); COPY(ip); COPY(ax); |
331 | @@ -105,6 +99,17 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, |
332 | buf = compat_ptr(tmp); |
333 | } get_user_catch(err); |
334 | |
335 | + /* |
336 | + * Reload fs and gs if they have changed in the signal |
337 | + * handler. This does not handle long fs/gs base changes in |
338 | + * the handler, but does not clobber them at least in the |
339 | + * normal case. |
340 | + */ |
341 | + RELOAD_SEG(gs); |
342 | + RELOAD_SEG(fs); |
343 | + RELOAD_SEG(ds); |
344 | + RELOAD_SEG(es); |
345 | + |
346 | err |= fpu__restore_sig(buf, 1); |
347 | |
348 | force_iret(); |
349 | diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c |
350 | index d9ad49ca3cbe..e348bee411e3 100644 |
351 | --- a/arch/x86/kernel/cpu/mcheck/mce.c |
352 | +++ b/arch/x86/kernel/cpu/mcheck/mce.c |
353 | @@ -673,20 +673,50 @@ bool machine_check_poll(enum mcp_flags flags, mce_banks_t *b) |
354 | |
355 | barrier(); |
356 | m.status = mce_rdmsrl(msr_ops.status(i)); |
357 | + |
358 | + /* If this entry is not valid, ignore it */ |
359 | if (!(m.status & MCI_STATUS_VAL)) |
360 | continue; |
361 | |
362 | |
363 | /* |
364 | - * Uncorrected or signalled events are handled by the exception |
365 | - * handler when it is enabled, so don't process those here. |
366 | - * |
367 | - * TBD do the same check for MCI_STATUS_EN here? |
368 | + * If we are logging everything (at CPU online) or this |
369 | + * is a corrected error, then we must log it. |
370 | */ |
371 | - if (!(flags & MCP_UC) && |
372 | - (m.status & (mca_cfg.ser ? MCI_STATUS_S : MCI_STATUS_UC))) |
373 | - continue; |
374 | + if ((flags & MCP_UC) || !(m.status & MCI_STATUS_UC)) |
375 | + goto log_it; |
376 | + |
377 | + /* |
378 | + * Newer Intel systems that support software error |
379 | + * recovery need to make additional checks. Other |
380 | + * CPUs should skip over uncorrected errors, but log |
381 | + * everything else. |
382 | + */ |
383 | + if (!mca_cfg.ser) { |
384 | + if (m.status & MCI_STATUS_UC) |
385 | + continue; |
386 | + goto log_it; |
387 | + } |
388 | + |
389 | + /* Log "not enabled" (speculative) errors */ |
390 | + if (!(m.status & MCI_STATUS_EN)) |
391 | + goto log_it; |
392 | + |
393 | + /* |
394 | + * Log UCNA (SDM: 15.6.3 "UCR Error Classification") |
395 | + * UC == 1 && PCC == 0 && S == 0 |
396 | + */ |
397 | + if (!(m.status & MCI_STATUS_PCC) && !(m.status & MCI_STATUS_S)) |
398 | + goto log_it; |
399 | + |
400 | + /* |
401 | + * Skip anything else. Presumption is that our read of this |
402 | + * bank is racing with a machine check. Leave the log alone |
403 | + * for do_machine_check() to deal with it. |
404 | + */ |
405 | + continue; |
406 | |
407 | +log_it: |
408 | error_seen = true; |
409 | |
410 | mce_read_aux(&m, i); |
411 | diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c |
412 | index bcd1b82c86e8..005e9a77a664 100644 |
413 | --- a/arch/x86/kernel/irq_64.c |
414 | +++ b/arch/x86/kernel/irq_64.c |
415 | @@ -25,9 +25,18 @@ int sysctl_panic_on_stackoverflow; |
416 | /* |
417 | * Probabilistic stack overflow check: |
418 | * |
419 | - * Only check the stack in process context, because everything else |
420 | - * runs on the big interrupt stacks. Checking reliably is too expensive, |
421 | - * so we just check from interrupts. |
422 | + * Regular device interrupts can enter on the following stacks: |
423 | + * |
424 | + * - User stack |
425 | + * |
426 | + * - Kernel task stack |
427 | + * |
428 | + * - Interrupt stack if a device driver reenables interrupts |
429 | + * which should only happen in really old drivers. |
430 | + * |
431 | + * - Debug IST stack |
432 | + * |
433 | + * All other contexts are invalid. |
434 | */ |
435 | static inline void stack_overflow_check(struct pt_regs *regs) |
436 | { |
437 | @@ -52,8 +61,8 @@ static inline void stack_overflow_check(struct pt_regs *regs) |
438 | return; |
439 | |
440 | oist = this_cpu_ptr(&orig_ist); |
441 | - estack_top = (u64)oist->ist[0] - EXCEPTION_STKSZ + STACK_TOP_MARGIN; |
442 | - estack_bottom = (u64)oist->ist[N_EXCEPTION_STACKS - 1]; |
443 | + estack_bottom = (u64)oist->ist[DEBUG_STACK]; |
444 | + estack_top = estack_bottom - DEBUG_STKSZ + STACK_TOP_MARGIN; |
445 | if (regs->sp >= estack_top && regs->sp <= estack_bottom) |
446 | return; |
447 | |
448 | diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c |
449 | index b1a5d252d482..ca010dfb9682 100644 |
450 | --- a/arch/x86/kernel/signal.c |
451 | +++ b/arch/x86/kernel/signal.c |
452 | @@ -129,16 +129,6 @@ static int restore_sigcontext(struct pt_regs *regs, |
453 | COPY_SEG_CPL3(cs); |
454 | COPY_SEG_CPL3(ss); |
455 | |
456 | -#ifdef CONFIG_X86_64 |
457 | - /* |
458 | - * Fix up SS if needed for the benefit of old DOSEMU and |
459 | - * CRIU. |
460 | - */ |
461 | - if (unlikely(!(uc_flags & UC_STRICT_RESTORE_SS) && |
462 | - user_64bit_mode(regs))) |
463 | - force_valid_ss(regs); |
464 | -#endif |
465 | - |
466 | get_user_ex(tmpflags, &sc->flags); |
467 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); |
468 | regs->orig_ax = -1; /* disable syscall checks */ |
469 | @@ -147,6 +137,15 @@ static int restore_sigcontext(struct pt_regs *regs, |
470 | buf = (void __user *)buf_val; |
471 | } get_user_catch(err); |
472 | |
473 | +#ifdef CONFIG_X86_64 |
474 | + /* |
475 | + * Fix up SS if needed for the benefit of old DOSEMU and |
476 | + * CRIU. |
477 | + */ |
478 | + if (unlikely(!(uc_flags & UC_STRICT_RESTORE_SS) && user_64bit_mode(regs))) |
479 | + force_valid_ss(regs); |
480 | +#endif |
481 | + |
482 | err |= fpu__restore_sig(buf, IS_ENABLED(CONFIG_X86_32)); |
483 | |
484 | force_iret(); |
485 | @@ -458,6 +457,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, |
486 | { |
487 | struct rt_sigframe __user *frame; |
488 | void __user *fp = NULL; |
489 | + unsigned long uc_flags; |
490 | int err = 0; |
491 | |
492 | frame = get_sigframe(&ksig->ka, regs, sizeof(struct rt_sigframe), &fp); |
493 | @@ -470,9 +470,11 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, |
494 | return -EFAULT; |
495 | } |
496 | |
497 | + uc_flags = frame_uc_flags(regs); |
498 | + |
499 | put_user_try { |
500 | /* Create the ucontext. */ |
501 | - put_user_ex(frame_uc_flags(regs), &frame->uc.uc_flags); |
502 | + put_user_ex(uc_flags, &frame->uc.uc_flags); |
503 | put_user_ex(0, &frame->uc.uc_link); |
504 | save_altstack_ex(&frame->uc.uc_stack, regs->sp); |
505 | |
506 | @@ -538,6 +540,7 @@ static int x32_setup_rt_frame(struct ksignal *ksig, |
507 | { |
508 | #ifdef CONFIG_X86_X32_ABI |
509 | struct rt_sigframe_x32 __user *frame; |
510 | + unsigned long uc_flags; |
511 | void __user *restorer; |
512 | int err = 0; |
513 | void __user *fpstate = NULL; |
514 | @@ -552,9 +555,11 @@ static int x32_setup_rt_frame(struct ksignal *ksig, |
515 | return -EFAULT; |
516 | } |
517 | |
518 | + uc_flags = frame_uc_flags(regs); |
519 | + |
520 | put_user_try { |
521 | /* Create the ucontext. */ |
522 | - put_user_ex(frame_uc_flags(regs), &frame->uc.uc_flags); |
523 | + put_user_ex(uc_flags, &frame->uc.uc_flags); |
524 | put_user_ex(0, &frame->uc.uc_link); |
525 | compat_save_altstack_ex(&frame->uc.uc_stack, regs->sp); |
526 | put_user_ex(0, &frame->uc.uc__pad0); |
527 | diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S |
528 | index 55f04875293f..51b772f9d886 100644 |
529 | --- a/arch/x86/kernel/vmlinux.lds.S |
530 | +++ b/arch/x86/kernel/vmlinux.lds.S |
531 | @@ -111,11 +111,11 @@ SECTIONS |
532 | *(.text.__x86.indirect_thunk) |
533 | __indirect_thunk_end = .; |
534 | #endif |
535 | - |
536 | - /* End of text section */ |
537 | - _etext = .; |
538 | } :text = 0x9090 |
539 | |
540 | + /* End of text section */ |
541 | + _etext = .; |
542 | + |
543 | NOTES :text :note |
544 | |
545 | EXCEPTION_TABLE(16) :text = 0x9090 |
546 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
547 | index 9338136a6a23..f7a7b98b3271 100644 |
548 | --- a/arch/x86/kvm/svm.c |
549 | +++ b/arch/x86/kvm/svm.c |
550 | @@ -1518,7 +1518,11 @@ static void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
551 | if (!kvm_vcpu_apicv_active(vcpu)) |
552 | return; |
553 | |
554 | - if (WARN_ON(h_physical_id >= AVIC_MAX_PHYSICAL_ID_COUNT)) |
555 | + /* |
556 | + * Since the host physical APIC id is 8 bits, |
557 | + * we can support host APIC ID upto 255. |
558 | + */ |
559 | + if (WARN_ON(h_physical_id > AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK)) |
560 | return; |
561 | |
562 | entry = READ_ONCE(*(svm->avic_physical_id_cache)); |
563 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
564 | index 1f32c4e32a00..72efecc4288b 100644 |
565 | --- a/arch/x86/kvm/x86.c |
566 | +++ b/arch/x86/kvm/x86.c |
567 | @@ -1109,7 +1109,7 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
568 | u64 efer = msr_info->data; |
569 | |
570 | if (efer & efer_reserved_bits) |
571 | - return false; |
572 | + return 1; |
573 | |
574 | if (!msr_info->host_initiated) { |
575 | if (!__kvm_valid_efer(vcpu, efer)) |
576 | diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c |
577 | index 5c419b8f99a0..c140198d9fa5 100644 |
578 | --- a/arch/x86/mm/fault.c |
579 | +++ b/arch/x86/mm/fault.c |
580 | @@ -430,8 +430,6 @@ static noinline int vmalloc_fault(unsigned long address) |
581 | if (!(address >= VMALLOC_START && address < VMALLOC_END)) |
582 | return -1; |
583 | |
584 | - WARN_ON_ONCE(in_nmi()); |
585 | - |
586 | /* |
587 | * Copy kernel mappings over when needed. This can also |
588 | * happen within a race in page table update. In the later |
589 | diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c |
590 | index 98517216879d..a2714890fe43 100644 |
591 | --- a/drivers/base/power/main.c |
592 | +++ b/drivers/base/power/main.c |
593 | @@ -1383,6 +1383,10 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) |
594 | if (dev->power.syscore) |
595 | goto Complete; |
596 | |
597 | + /* Avoid direct_complete to let wakeup_path propagate. */ |
598 | + if (device_may_wakeup(dev) || dev->power.wakeup_path) |
599 | + dev->power.direct_complete = false; |
600 | + |
601 | if (dev->power.direct_complete) { |
602 | if (pm_runtime_status_suspended(dev)) { |
603 | pm_runtime_disable(dev); |
604 | diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c |
605 | index 8c0017d48571..800ced0a5a24 100644 |
606 | --- a/drivers/char/virtio_console.c |
607 | +++ b/drivers/char/virtio_console.c |
608 | @@ -75,7 +75,7 @@ struct ports_driver_data { |
609 | /* All the console devices handled by this driver */ |
610 | struct list_head consoles; |
611 | }; |
612 | -static struct ports_driver_data pdrvdata; |
613 | +static struct ports_driver_data pdrvdata = { .next_vtermno = 1}; |
614 | |
615 | static DEFINE_SPINLOCK(pdrvdata_lock); |
616 | static DECLARE_COMPLETION(early_console_added); |
617 | @@ -1425,6 +1425,7 @@ static int add_port(struct ports_device *portdev, u32 id) |
618 | port->async_queue = NULL; |
619 | |
620 | port->cons.ws.ws_row = port->cons.ws.ws_col = 0; |
621 | + port->cons.vtermno = 0; |
622 | |
623 | port->host_connected = port->guest_connected = false; |
624 | port->stats = (struct port_stats) { 0 }; |
625 | diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
626 | index a38a23f0b3f4..e917521a3ef9 100644 |
627 | --- a/drivers/cpufreq/cpufreq.c |
628 | +++ b/drivers/cpufreq/cpufreq.c |
629 | @@ -1065,6 +1065,7 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) |
630 | cpufreq_global_kobject, "policy%u", cpu); |
631 | if (ret) { |
632 | pr_err("%s: failed to init policy->kobj: %d\n", __func__, ret); |
633 | + kobject_put(&policy->kobj); |
634 | goto err_free_real_cpus; |
635 | } |
636 | |
637 | diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c |
638 | index 38d1a8216084..32c9524a6ec5 100644 |
639 | --- a/drivers/cpufreq/cpufreq_governor.c |
640 | +++ b/drivers/cpufreq/cpufreq_governor.c |
641 | @@ -449,6 +449,8 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) |
642 | /* Failure, so roll back. */ |
643 | pr_err("initialization failed (dbs_data kobject init error %d)\n", ret); |
644 | |
645 | + kobject_put(&dbs_data->attr_set.kobj); |
646 | + |
647 | policy->governor_data = NULL; |
648 | |
649 | if (!have_governor_per_policy()) |
650 | diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c |
651 | index 35dd4d7ffee0..58c933f48300 100644 |
652 | --- a/drivers/cpufreq/pasemi-cpufreq.c |
653 | +++ b/drivers/cpufreq/pasemi-cpufreq.c |
654 | @@ -146,6 +146,7 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) |
655 | |
656 | cpu = of_get_cpu_node(policy->cpu, NULL); |
657 | |
658 | + of_node_put(cpu); |
659 | if (!cpu) |
660 | goto out; |
661 | |
662 | diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c |
663 | index ff44016ea031..641f8021855a 100644 |
664 | --- a/drivers/cpufreq/pmac32-cpufreq.c |
665 | +++ b/drivers/cpufreq/pmac32-cpufreq.c |
666 | @@ -551,6 +551,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) |
667 | volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select"); |
668 | if (volt_gpio_np) |
669 | voltage_gpio = read_gpio(volt_gpio_np); |
670 | + of_node_put(volt_gpio_np); |
671 | if (!voltage_gpio){ |
672 | pr_err("missing cpu-vcore-select gpio\n"); |
673 | return 1; |
674 | @@ -587,6 +588,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode) |
675 | if (volt_gpio_np) |
676 | voltage_gpio = read_gpio(volt_gpio_np); |
677 | |
678 | + of_node_put(volt_gpio_np); |
679 | pvr = mfspr(SPRN_PVR); |
680 | has_cpu_l2lve = !((pvr & 0xf00) == 0x100); |
681 | |
682 | diff --git a/drivers/cpufreq/ppc_cbe_cpufreq.c b/drivers/cpufreq/ppc_cbe_cpufreq.c |
683 | index 5a4c5a639f61..2eaeebcc93af 100644 |
684 | --- a/drivers/cpufreq/ppc_cbe_cpufreq.c |
685 | +++ b/drivers/cpufreq/ppc_cbe_cpufreq.c |
686 | @@ -86,6 +86,7 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) |
687 | if (!cbe_get_cpu_pmd_regs(policy->cpu) || |
688 | !cbe_get_cpu_mic_tm_regs(policy->cpu)) { |
689 | pr_info("invalid CBE regs pointers for cpufreq\n"); |
690 | + of_node_put(cpu); |
691 | return -EINVAL; |
692 | } |
693 | |
694 | diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
695 | index 0de2f62d51ff..ec16ec2e284d 100644 |
696 | --- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
697 | +++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
698 | @@ -250,7 +250,10 @@ static int sun4i_hash(struct ahash_request *areq) |
699 | } |
700 | } else { |
701 | /* Since we have the flag final, we can go up to modulo 4 */ |
702 | - end = ((areq->nbytes + op->len) / 4) * 4 - op->len; |
703 | + if (areq->nbytes < 4) |
704 | + end = 0; |
705 | + else |
706 | + end = ((areq->nbytes + op->len) / 4) * 4 - op->len; |
707 | } |
708 | |
709 | /* TODO if SGlen % 4 and op->len == 0 then DMA */ |
710 | diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl |
711 | index d9281a28818d..930a3f1e3ec0 100644 |
712 | --- a/drivers/crypto/vmx/aesp8-ppc.pl |
713 | +++ b/drivers/crypto/vmx/aesp8-ppc.pl |
714 | @@ -1318,7 +1318,7 @@ Loop_ctr32_enc: |
715 | addi $idx,$idx,16 |
716 | bdnz Loop_ctr32_enc |
717 | |
718 | - vadduwm $ivec,$ivec,$one |
719 | + vadduqm $ivec,$ivec,$one |
720 | vmr $dat,$inptail |
721 | lvx $inptail,0,$inp |
722 | addi $inp,$inp,16 |
723 | diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c |
724 | index b222dd7afe8e..12d904829324 100644 |
725 | --- a/drivers/dma/at_xdmac.c |
726 | +++ b/drivers/dma/at_xdmac.c |
727 | @@ -1608,7 +1608,11 @@ static void at_xdmac_tasklet(unsigned long data) |
728 | struct at_xdmac_desc, |
729 | xfer_node); |
730 | dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, desc); |
731 | - BUG_ON(!desc->active_xfer); |
732 | + if (!desc->active_xfer) { |
733 | + dev_err(chan2dev(&atchan->chan), "Xfer not active: exiting"); |
734 | + spin_unlock_bh(&atchan->lock); |
735 | + return; |
736 | + } |
737 | |
738 | txd = &desc->tx_dma_desc; |
739 | |
740 | diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c |
741 | index 6d7e3cd4aba4..57b375d0de29 100644 |
742 | --- a/drivers/dma/pl330.c |
743 | +++ b/drivers/dma/pl330.c |
744 | @@ -1020,6 +1020,7 @@ static void _stop(struct pl330_thread *thrd) |
745 | { |
746 | void __iomem *regs = thrd->dmac->base; |
747 | u8 insn[6] = {0, 0, 0, 0, 0, 0}; |
748 | + u32 inten = readl(regs + INTEN); |
749 | |
750 | if (_state(thrd) == PL330_STATE_FAULT_COMPLETING) |
751 | UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); |
752 | @@ -1032,10 +1033,13 @@ static void _stop(struct pl330_thread *thrd) |
753 | |
754 | _emit_KILL(0, insn); |
755 | |
756 | - /* Stop generating interrupts for SEV */ |
757 | - writel(readl(regs + INTEN) & ~(1 << thrd->ev), regs + INTEN); |
758 | - |
759 | _execute_DBGINSN(thrd, insn, is_manager(thrd)); |
760 | + |
761 | + /* clear the event */ |
762 | + if (inten & (1 << thrd->ev)) |
763 | + writel(1 << thrd->ev, regs + INTCLR); |
764 | + /* Stop generating interrupts for SEV */ |
765 | + writel(inten & ~(1 << thrd->ev), regs + INTEN); |
766 | } |
767 | |
768 | /* Start doing req 'idx' of thread 'thrd' */ |
769 | diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c |
770 | index b10cbaa82ff5..e9e46a520745 100644 |
771 | --- a/drivers/dma/tegra210-adma.c |
772 | +++ b/drivers/dma/tegra210-adma.c |
773 | @@ -22,7 +22,6 @@ |
774 | #include <linux/of_device.h> |
775 | #include <linux/of_dma.h> |
776 | #include <linux/of_irq.h> |
777 | -#include <linux/pm_clock.h> |
778 | #include <linux/pm_runtime.h> |
779 | #include <linux/slab.h> |
780 | |
781 | @@ -141,6 +140,7 @@ struct tegra_adma { |
782 | struct dma_device dma_dev; |
783 | struct device *dev; |
784 | void __iomem *base_addr; |
785 | + struct clk *ahub_clk; |
786 | unsigned int nr_channels; |
787 | unsigned long rx_requests_reserved; |
788 | unsigned long tx_requests_reserved; |
789 | @@ -637,8 +637,9 @@ static int tegra_adma_runtime_suspend(struct device *dev) |
790 | struct tegra_adma *tdma = dev_get_drvdata(dev); |
791 | |
792 | tdma->global_cmd = tdma_read(tdma, ADMA_GLOBAL_CMD); |
793 | + clk_disable_unprepare(tdma->ahub_clk); |
794 | |
795 | - return pm_clk_suspend(dev); |
796 | + return 0; |
797 | } |
798 | |
799 | static int tegra_adma_runtime_resume(struct device *dev) |
800 | @@ -646,10 +647,11 @@ static int tegra_adma_runtime_resume(struct device *dev) |
801 | struct tegra_adma *tdma = dev_get_drvdata(dev); |
802 | int ret; |
803 | |
804 | - ret = pm_clk_resume(dev); |
805 | - if (ret) |
806 | + ret = clk_prepare_enable(tdma->ahub_clk); |
807 | + if (ret) { |
808 | + dev_err(dev, "ahub clk_enable failed: %d\n", ret); |
809 | return ret; |
810 | - |
811 | + } |
812 | tdma_write(tdma, ADMA_GLOBAL_CMD, tdma->global_cmd); |
813 | |
814 | return 0; |
815 | @@ -692,13 +694,11 @@ static int tegra_adma_probe(struct platform_device *pdev) |
816 | if (IS_ERR(tdma->base_addr)) |
817 | return PTR_ERR(tdma->base_addr); |
818 | |
819 | - ret = pm_clk_create(&pdev->dev); |
820 | - if (ret) |
821 | - return ret; |
822 | - |
823 | - ret = of_pm_clk_add_clk(&pdev->dev, "d_audio"); |
824 | - if (ret) |
825 | - goto clk_destroy; |
826 | + tdma->ahub_clk = devm_clk_get(&pdev->dev, "d_audio"); |
827 | + if (IS_ERR(tdma->ahub_clk)) { |
828 | + dev_err(&pdev->dev, "Error: Missing ahub controller clock\n"); |
829 | + return PTR_ERR(tdma->ahub_clk); |
830 | + } |
831 | |
832 | pm_runtime_enable(&pdev->dev); |
833 | |
834 | @@ -775,8 +775,6 @@ rpm_put: |
835 | pm_runtime_put_sync(&pdev->dev); |
836 | rpm_disable: |
837 | pm_runtime_disable(&pdev->dev); |
838 | -clk_destroy: |
839 | - pm_clk_destroy(&pdev->dev); |
840 | |
841 | return ret; |
842 | } |
843 | @@ -786,6 +784,7 @@ static int tegra_adma_remove(struct platform_device *pdev) |
844 | struct tegra_adma *tdma = platform_get_drvdata(pdev); |
845 | int i; |
846 | |
847 | + of_dma_controller_free(pdev->dev.of_node); |
848 | dma_async_device_unregister(&tdma->dma_dev); |
849 | |
850 | for (i = 0; i < tdma->nr_channels; ++i) |
851 | @@ -793,7 +792,6 @@ static int tegra_adma_remove(struct platform_device *pdev) |
852 | |
853 | pm_runtime_put_sync(&pdev->dev); |
854 | pm_runtime_disable(&pdev->dev); |
855 | - pm_clk_destroy(&pdev->dev); |
856 | |
857 | return 0; |
858 | } |
859 | diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c |
860 | index 56e6c4c7c60d..4c0b6df8b5dd 100644 |
861 | --- a/drivers/extcon/extcon-arizona.c |
862 | +++ b/drivers/extcon/extcon-arizona.c |
863 | @@ -1684,6 +1684,16 @@ static int arizona_extcon_remove(struct platform_device *pdev) |
864 | struct arizona_extcon_info *info = platform_get_drvdata(pdev); |
865 | struct arizona *arizona = info->arizona; |
866 | int jack_irq_rise, jack_irq_fall; |
867 | + bool change; |
868 | + |
869 | + regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1, |
870 | + ARIZONA_MICD_ENA, 0, |
871 | + &change); |
872 | + |
873 | + if (change) { |
874 | + regulator_disable(info->micvdd); |
875 | + pm_runtime_put(info->dev); |
876 | + } |
877 | |
878 | gpiod_put(info->micd_pol_gpio); |
879 | |
880 | diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c |
881 | index c37b7b5f1dd3..921f7f690ae9 100644 |
882 | --- a/drivers/gpu/drm/drm_fops.c |
883 | +++ b/drivers/gpu/drm/drm_fops.c |
884 | @@ -515,6 +515,7 @@ put_back_event: |
885 | file_priv->event_space -= length; |
886 | list_add(&e->link, &file_priv->event_list); |
887 | spin_unlock_irq(&dev->event_lock); |
888 | + wake_up_interruptible(&file_priv->event_wait); |
889 | break; |
890 | } |
891 | |
892 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
893 | index 70597854397f..ceb4df96e0d5 100644 |
894 | --- a/drivers/hid/hid-core.c |
895 | +++ b/drivers/hid/hid-core.c |
896 | @@ -200,13 +200,14 @@ static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) |
897 | * Add a usage to the temporary parser table. |
898 | */ |
899 | |
900 | -static int hid_add_usage(struct hid_parser *parser, unsigned usage) |
901 | +static int hid_add_usage(struct hid_parser *parser, unsigned usage, u8 size) |
902 | { |
903 | if (parser->local.usage_index >= HID_MAX_USAGES) { |
904 | hid_err(parser->device, "usage index exceeded\n"); |
905 | return -1; |
906 | } |
907 | parser->local.usage[parser->local.usage_index] = usage; |
908 | + parser->local.usage_size[parser->local.usage_index] = size; |
909 | parser->local.collection_index[parser->local.usage_index] = |
910 | parser->collection_stack_ptr ? |
911 | parser->collection_stack[parser->collection_stack_ptr - 1] : 0; |
912 | @@ -463,10 +464,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
913 | return 0; |
914 | } |
915 | |
916 | - if (item->size <= 2) |
917 | - data = (parser->global.usage_page << 16) + data; |
918 | - |
919 | - return hid_add_usage(parser, data); |
920 | + return hid_add_usage(parser, data, item->size); |
921 | |
922 | case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: |
923 | |
924 | @@ -475,9 +473,6 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
925 | return 0; |
926 | } |
927 | |
928 | - if (item->size <= 2) |
929 | - data = (parser->global.usage_page << 16) + data; |
930 | - |
931 | parser->local.usage_minimum = data; |
932 | return 0; |
933 | |
934 | @@ -488,9 +483,6 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
935 | return 0; |
936 | } |
937 | |
938 | - if (item->size <= 2) |
939 | - data = (parser->global.usage_page << 16) + data; |
940 | - |
941 | count = data - parser->local.usage_minimum; |
942 | if (count + parser->local.usage_index >= HID_MAX_USAGES) { |
943 | /* |
944 | @@ -510,7 +502,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
945 | } |
946 | |
947 | for (n = parser->local.usage_minimum; n <= data; n++) |
948 | - if (hid_add_usage(parser, n)) { |
949 | + if (hid_add_usage(parser, n, item->size)) { |
950 | dbg_hid("hid_add_usage failed\n"); |
951 | return -1; |
952 | } |
953 | @@ -524,6 +516,22 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
954 | return 0; |
955 | } |
956 | |
957 | +/* |
958 | + * Concatenate Usage Pages into Usages where relevant: |
959 | + * As per specification, 6.2.2.8: "When the parser encounters a main item it |
960 | + * concatenates the last declared Usage Page with a Usage to form a complete |
961 | + * usage value." |
962 | + */ |
963 | + |
964 | +static void hid_concatenate_usage_page(struct hid_parser *parser) |
965 | +{ |
966 | + int i; |
967 | + |
968 | + for (i = 0; i < parser->local.usage_index; i++) |
969 | + if (parser->local.usage_size[i] <= 2) |
970 | + parser->local.usage[i] += parser->global.usage_page << 16; |
971 | +} |
972 | + |
973 | /* |
974 | * Process a main item. |
975 | */ |
976 | @@ -533,6 +541,8 @@ static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) |
977 | __u32 data; |
978 | int ret; |
979 | |
980 | + hid_concatenate_usage_page(parser); |
981 | + |
982 | data = item_udata(item); |
983 | |
984 | switch (item->tag) { |
985 | @@ -746,6 +756,8 @@ static int hid_scan_main(struct hid_parser *parser, struct hid_item *item) |
986 | __u32 data; |
987 | int i; |
988 | |
989 | + hid_concatenate_usage_page(parser); |
990 | + |
991 | data = item_udata(item); |
992 | |
993 | switch (item->tag) { |
994 | diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c |
995 | index 3198faf5cff4..38d9deb03d16 100644 |
996 | --- a/drivers/hid/hid-logitech-hidpp.c |
997 | +++ b/drivers/hid/hid-logitech-hidpp.c |
998 | @@ -449,13 +449,16 @@ static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature, |
999 | |
1000 | static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) |
1001 | { |
1002 | + const u8 ping_byte = 0x5a; |
1003 | + u8 ping_data[3] = { 0, 0, ping_byte }; |
1004 | struct hidpp_report response; |
1005 | int ret; |
1006 | |
1007 | - ret = hidpp_send_fap_command_sync(hidpp, |
1008 | + ret = hidpp_send_rap_command_sync(hidpp, |
1009 | + REPORT_ID_HIDPP_SHORT, |
1010 | HIDPP_PAGE_ROOT_IDX, |
1011 | CMD_ROOT_GET_PROTOCOL_VERSION, |
1012 | - NULL, 0, &response); |
1013 | + ping_data, sizeof(ping_data), &response); |
1014 | |
1015 | if (ret == HIDPP_ERROR_INVALID_SUBID) { |
1016 | hidpp->protocol_major = 1; |
1017 | @@ -475,8 +478,14 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) |
1018 | if (ret) |
1019 | return ret; |
1020 | |
1021 | - hidpp->protocol_major = response.fap.params[0]; |
1022 | - hidpp->protocol_minor = response.fap.params[1]; |
1023 | + if (response.rap.params[2] != ping_byte) { |
1024 | + hid_err(hidpp->hid_dev, "%s: ping mismatch 0x%02x != 0x%02x\n", |
1025 | + __func__, response.rap.params[2], ping_byte); |
1026 | + return -EPROTO; |
1027 | + } |
1028 | + |
1029 | + hidpp->protocol_major = response.rap.params[0]; |
1030 | + hidpp->protocol_minor = response.rap.params[1]; |
1031 | |
1032 | return ret; |
1033 | } |
1034 | diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c |
1035 | index facd05cda26d..e8c089886427 100644 |
1036 | --- a/drivers/hwmon/f71805f.c |
1037 | +++ b/drivers/hwmon/f71805f.c |
1038 | @@ -96,17 +96,23 @@ superio_select(int base, int ld) |
1039 | outb(ld, base + 1); |
1040 | } |
1041 | |
1042 | -static inline void |
1043 | +static inline int |
1044 | superio_enter(int base) |
1045 | { |
1046 | + if (!request_muxed_region(base, 2, DRVNAME)) |
1047 | + return -EBUSY; |
1048 | + |
1049 | outb(0x87, base); |
1050 | outb(0x87, base); |
1051 | + |
1052 | + return 0; |
1053 | } |
1054 | |
1055 | static inline void |
1056 | superio_exit(int base) |
1057 | { |
1058 | outb(0xaa, base); |
1059 | + release_region(base, 2); |
1060 | } |
1061 | |
1062 | /* |
1063 | @@ -1561,7 +1567,7 @@ exit: |
1064 | static int __init f71805f_find(int sioaddr, unsigned short *address, |
1065 | struct f71805f_sio_data *sio_data) |
1066 | { |
1067 | - int err = -ENODEV; |
1068 | + int err; |
1069 | u16 devid; |
1070 | |
1071 | static const char * const names[] = { |
1072 | @@ -1569,8 +1575,11 @@ static int __init f71805f_find(int sioaddr, unsigned short *address, |
1073 | "F71872F/FG or F71806F/FG", |
1074 | }; |
1075 | |
1076 | - superio_enter(sioaddr); |
1077 | + err = superio_enter(sioaddr); |
1078 | + if (err) |
1079 | + return err; |
1080 | |
1081 | + err = -ENODEV; |
1082 | devid = superio_inw(sioaddr, SIO_REG_MANID); |
1083 | if (devid != SIO_FINTEK_ID) |
1084 | goto exit; |
1085 | diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c |
1086 | index cb9fdd37bd0d..2b5b8c3de8fc 100644 |
1087 | --- a/drivers/hwmon/pc87427.c |
1088 | +++ b/drivers/hwmon/pc87427.c |
1089 | @@ -106,6 +106,13 @@ static const char *logdev_str[2] = { DRVNAME " FMC", DRVNAME " HMC" }; |
1090 | #define LD_IN 1 |
1091 | #define LD_TEMP 1 |
1092 | |
1093 | +static inline int superio_enter(int sioaddr) |
1094 | +{ |
1095 | + if (!request_muxed_region(sioaddr, 2, DRVNAME)) |
1096 | + return -EBUSY; |
1097 | + return 0; |
1098 | +} |
1099 | + |
1100 | static inline void superio_outb(int sioaddr, int reg, int val) |
1101 | { |
1102 | outb(reg, sioaddr); |
1103 | @@ -122,6 +129,7 @@ static inline void superio_exit(int sioaddr) |
1104 | { |
1105 | outb(0x02, sioaddr); |
1106 | outb(0x02, sioaddr + 1); |
1107 | + release_region(sioaddr, 2); |
1108 | } |
1109 | |
1110 | /* |
1111 | @@ -1220,7 +1228,11 @@ static int __init pc87427_find(int sioaddr, struct pc87427_sio_data *sio_data) |
1112 | { |
1113 | u16 val; |
1114 | u8 cfg, cfg_b; |
1115 | - int i, err = 0; |
1116 | + int i, err; |
1117 | + |
1118 | + err = superio_enter(sioaddr); |
1119 | + if (err) |
1120 | + return err; |
1121 | |
1122 | /* Identify device */ |
1123 | val = force_id ? force_id : superio_inb(sioaddr, SIOREG_DEVID); |
1124 | diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c |
1125 | index 6bd200756560..cbdb5c4991ae 100644 |
1126 | --- a/drivers/hwmon/smsc47b397.c |
1127 | +++ b/drivers/hwmon/smsc47b397.c |
1128 | @@ -72,14 +72,19 @@ static inline void superio_select(int ld) |
1129 | superio_outb(0x07, ld); |
1130 | } |
1131 | |
1132 | -static inline void superio_enter(void) |
1133 | +static inline int superio_enter(void) |
1134 | { |
1135 | + if (!request_muxed_region(REG, 2, DRVNAME)) |
1136 | + return -EBUSY; |
1137 | + |
1138 | outb(0x55, REG); |
1139 | + return 0; |
1140 | } |
1141 | |
1142 | static inline void superio_exit(void) |
1143 | { |
1144 | outb(0xAA, REG); |
1145 | + release_region(REG, 2); |
1146 | } |
1147 | |
1148 | #define SUPERIO_REG_DEVID 0x20 |
1149 | @@ -300,8 +305,12 @@ static int __init smsc47b397_find(void) |
1150 | u8 id, rev; |
1151 | char *name; |
1152 | unsigned short addr; |
1153 | + int err; |
1154 | + |
1155 | + err = superio_enter(); |
1156 | + if (err) |
1157 | + return err; |
1158 | |
1159 | - superio_enter(); |
1160 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
1161 | |
1162 | switch (id) { |
1163 | diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c |
1164 | index 5d323186d2c1..d24df0c50bea 100644 |
1165 | --- a/drivers/hwmon/smsc47m1.c |
1166 | +++ b/drivers/hwmon/smsc47m1.c |
1167 | @@ -73,16 +73,21 @@ superio_inb(int reg) |
1168 | /* logical device for fans is 0x0A */ |
1169 | #define superio_select() superio_outb(0x07, 0x0A) |
1170 | |
1171 | -static inline void |
1172 | +static inline int |
1173 | superio_enter(void) |
1174 | { |
1175 | + if (!request_muxed_region(REG, 2, DRVNAME)) |
1176 | + return -EBUSY; |
1177 | + |
1178 | outb(0x55, REG); |
1179 | + return 0; |
1180 | } |
1181 | |
1182 | static inline void |
1183 | superio_exit(void) |
1184 | { |
1185 | outb(0xAA, REG); |
1186 | + release_region(REG, 2); |
1187 | } |
1188 | |
1189 | #define SUPERIO_REG_ACT 0x30 |
1190 | @@ -531,8 +536,12 @@ static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) |
1191 | { |
1192 | u8 val; |
1193 | unsigned short addr; |
1194 | + int err; |
1195 | + |
1196 | + err = superio_enter(); |
1197 | + if (err) |
1198 | + return err; |
1199 | |
1200 | - superio_enter(); |
1201 | val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
1202 | |
1203 | /* |
1204 | @@ -608,13 +617,14 @@ static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) |
1205 | static void smsc47m1_restore(const struct smsc47m1_sio_data *sio_data) |
1206 | { |
1207 | if ((sio_data->activate & 0x01) == 0) { |
1208 | - superio_enter(); |
1209 | - superio_select(); |
1210 | - |
1211 | - pr_info("Disabling device\n"); |
1212 | - superio_outb(SUPERIO_REG_ACT, sio_data->activate); |
1213 | - |
1214 | - superio_exit(); |
1215 | + if (!superio_enter()) { |
1216 | + superio_select(); |
1217 | + pr_info("Disabling device\n"); |
1218 | + superio_outb(SUPERIO_REG_ACT, sio_data->activate); |
1219 | + superio_exit(); |
1220 | + } else { |
1221 | + pr_warn("Failed to disable device\n"); |
1222 | + } |
1223 | } |
1224 | } |
1225 | |
1226 | diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c |
1227 | index 3a6bfa51cb94..95d5e8ec8b7f 100644 |
1228 | --- a/drivers/hwmon/vt1211.c |
1229 | +++ b/drivers/hwmon/vt1211.c |
1230 | @@ -226,15 +226,21 @@ static inline void superio_select(int sio_cip, int ldn) |
1231 | outb(ldn, sio_cip + 1); |
1232 | } |
1233 | |
1234 | -static inline void superio_enter(int sio_cip) |
1235 | +static inline int superio_enter(int sio_cip) |
1236 | { |
1237 | + if (!request_muxed_region(sio_cip, 2, DRVNAME)) |
1238 | + return -EBUSY; |
1239 | + |
1240 | outb(0x87, sio_cip); |
1241 | outb(0x87, sio_cip); |
1242 | + |
1243 | + return 0; |
1244 | } |
1245 | |
1246 | static inline void superio_exit(int sio_cip) |
1247 | { |
1248 | outb(0xaa, sio_cip); |
1249 | + release_region(sio_cip, 2); |
1250 | } |
1251 | |
1252 | /* --------------------------------------------------------------------- |
1253 | @@ -1282,11 +1288,14 @@ EXIT: |
1254 | |
1255 | static int __init vt1211_find(int sio_cip, unsigned short *address) |
1256 | { |
1257 | - int err = -ENODEV; |
1258 | + int err; |
1259 | int devid; |
1260 | |
1261 | - superio_enter(sio_cip); |
1262 | + err = superio_enter(sio_cip); |
1263 | + if (err) |
1264 | + return err; |
1265 | |
1266 | + err = -ENODEV; |
1267 | devid = force_id ? force_id : superio_inb(sio_cip, SIO_VT1211_DEVID); |
1268 | if (devid != SIO_VT1211_ID) |
1269 | goto EXIT; |
1270 | diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c |
1271 | index a1d072ecb717..30f200ad6b97 100644 |
1272 | --- a/drivers/iio/adc/ad_sigma_delta.c |
1273 | +++ b/drivers/iio/adc/ad_sigma_delta.c |
1274 | @@ -62,7 +62,7 @@ int ad_sd_write_reg(struct ad_sigma_delta *sigma_delta, unsigned int reg, |
1275 | struct spi_transfer t = { |
1276 | .tx_buf = data, |
1277 | .len = size + 1, |
1278 | - .cs_change = sigma_delta->bus_locked, |
1279 | + .cs_change = sigma_delta->keep_cs_asserted, |
1280 | }; |
1281 | struct spi_message m; |
1282 | int ret; |
1283 | @@ -217,6 +217,7 @@ static int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, |
1284 | |
1285 | spi_bus_lock(sigma_delta->spi->master); |
1286 | sigma_delta->bus_locked = true; |
1287 | + sigma_delta->keep_cs_asserted = true; |
1288 | reinit_completion(&sigma_delta->completion); |
1289 | |
1290 | ret = ad_sigma_delta_set_mode(sigma_delta, mode); |
1291 | @@ -234,9 +235,10 @@ static int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, |
1292 | ret = 0; |
1293 | } |
1294 | out: |
1295 | + sigma_delta->keep_cs_asserted = false; |
1296 | + ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
1297 | sigma_delta->bus_locked = false; |
1298 | spi_bus_unlock(sigma_delta->spi->master); |
1299 | - ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
1300 | |
1301 | return ret; |
1302 | } |
1303 | @@ -288,6 +290,7 @@ int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, |
1304 | |
1305 | spi_bus_lock(sigma_delta->spi->master); |
1306 | sigma_delta->bus_locked = true; |
1307 | + sigma_delta->keep_cs_asserted = true; |
1308 | reinit_completion(&sigma_delta->completion); |
1309 | |
1310 | ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_SINGLE); |
1311 | @@ -297,9 +300,6 @@ int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, |
1312 | ret = wait_for_completion_interruptible_timeout( |
1313 | &sigma_delta->completion, HZ); |
1314 | |
1315 | - sigma_delta->bus_locked = false; |
1316 | - spi_bus_unlock(sigma_delta->spi->master); |
1317 | - |
1318 | if (ret == 0) |
1319 | ret = -EIO; |
1320 | if (ret < 0) |
1321 | @@ -315,7 +315,10 @@ out: |
1322 | sigma_delta->irq_dis = true; |
1323 | } |
1324 | |
1325 | + sigma_delta->keep_cs_asserted = false; |
1326 | ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
1327 | + sigma_delta->bus_locked = false; |
1328 | + spi_bus_unlock(sigma_delta->spi->master); |
1329 | mutex_unlock(&indio_dev->mlock); |
1330 | |
1331 | if (ret) |
1332 | @@ -352,6 +355,8 @@ static int ad_sd_buffer_postenable(struct iio_dev *indio_dev) |
1333 | |
1334 | spi_bus_lock(sigma_delta->spi->master); |
1335 | sigma_delta->bus_locked = true; |
1336 | + sigma_delta->keep_cs_asserted = true; |
1337 | + |
1338 | ret = ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_CONTINUOUS); |
1339 | if (ret) |
1340 | goto err_unlock; |
1341 | @@ -380,6 +385,7 @@ static int ad_sd_buffer_postdisable(struct iio_dev *indio_dev) |
1342 | sigma_delta->irq_dis = true; |
1343 | } |
1344 | |
1345 | + sigma_delta->keep_cs_asserted = false; |
1346 | ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
1347 | |
1348 | sigma_delta->bus_locked = false; |
1349 | diff --git a/drivers/iio/common/ssp_sensors/ssp_iio.c b/drivers/iio/common/ssp_sensors/ssp_iio.c |
1350 | index a3ae165f8d9f..16180e6321bd 100644 |
1351 | --- a/drivers/iio/common/ssp_sensors/ssp_iio.c |
1352 | +++ b/drivers/iio/common/ssp_sensors/ssp_iio.c |
1353 | @@ -80,7 +80,7 @@ int ssp_common_process_data(struct iio_dev *indio_dev, void *buf, |
1354 | unsigned int len, int64_t timestamp) |
1355 | { |
1356 | __le32 time; |
1357 | - int64_t calculated_time; |
1358 | + int64_t calculated_time = 0; |
1359 | struct ssp_sensor_data *spd = iio_priv(indio_dev); |
1360 | |
1361 | if (indio_dev->scan_bytes == 0) |
1362 | diff --git a/drivers/iio/magnetometer/hmc5843_i2c.c b/drivers/iio/magnetometer/hmc5843_i2c.c |
1363 | index 3de7f4426ac4..86abba5827a2 100644 |
1364 | --- a/drivers/iio/magnetometer/hmc5843_i2c.c |
1365 | +++ b/drivers/iio/magnetometer/hmc5843_i2c.c |
1366 | @@ -58,8 +58,13 @@ static const struct regmap_config hmc5843_i2c_regmap_config = { |
1367 | static int hmc5843_i2c_probe(struct i2c_client *cli, |
1368 | const struct i2c_device_id *id) |
1369 | { |
1370 | + struct regmap *regmap = devm_regmap_init_i2c(cli, |
1371 | + &hmc5843_i2c_regmap_config); |
1372 | + if (IS_ERR(regmap)) |
1373 | + return PTR_ERR(regmap); |
1374 | + |
1375 | return hmc5843_common_probe(&cli->dev, |
1376 | - devm_regmap_init_i2c(cli, &hmc5843_i2c_regmap_config), |
1377 | + regmap, |
1378 | id->driver_data, id->name); |
1379 | } |
1380 | |
1381 | diff --git a/drivers/iio/magnetometer/hmc5843_spi.c b/drivers/iio/magnetometer/hmc5843_spi.c |
1382 | index 535f03a70d63..79b2b707f90e 100644 |
1383 | --- a/drivers/iio/magnetometer/hmc5843_spi.c |
1384 | +++ b/drivers/iio/magnetometer/hmc5843_spi.c |
1385 | @@ -58,6 +58,7 @@ static const struct regmap_config hmc5843_spi_regmap_config = { |
1386 | static int hmc5843_spi_probe(struct spi_device *spi) |
1387 | { |
1388 | int ret; |
1389 | + struct regmap *regmap; |
1390 | const struct spi_device_id *id = spi_get_device_id(spi); |
1391 | |
1392 | spi->mode = SPI_MODE_3; |
1393 | @@ -67,8 +68,12 @@ static int hmc5843_spi_probe(struct spi_device *spi) |
1394 | if (ret) |
1395 | return ret; |
1396 | |
1397 | + regmap = devm_regmap_init_spi(spi, &hmc5843_spi_regmap_config); |
1398 | + if (IS_ERR(regmap)) |
1399 | + return PTR_ERR(regmap); |
1400 | + |
1401 | return hmc5843_common_probe(&spi->dev, |
1402 | - devm_regmap_init_spi(spi, &hmc5843_spi_regmap_config), |
1403 | + regmap, |
1404 | id->driver_data, id->name); |
1405 | } |
1406 | |
1407 | diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c |
1408 | index a2322b2dbd82..e5752352e0fb 100644 |
1409 | --- a/drivers/infiniband/hw/cxgb4/cm.c |
1410 | +++ b/drivers/infiniband/hw/cxgb4/cm.c |
1411 | @@ -455,6 +455,8 @@ static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp) |
1412 | skb_reset_transport_header(skb); |
1413 | } else { |
1414 | skb = alloc_skb(len, gfp); |
1415 | + if (!skb) |
1416 | + return NULL; |
1417 | } |
1418 | t4_set_arp_err_handler(skb, NULL, NULL); |
1419 | return skb; |
1420 | diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c |
1421 | index dd344ee9e62b..ebacd21714ef 100644 |
1422 | --- a/drivers/md/bcache/alloc.c |
1423 | +++ b/drivers/md/bcache/alloc.c |
1424 | @@ -322,10 +322,11 @@ static int bch_allocator_thread(void *arg) |
1425 | * possibly issue discards to them, then we add the bucket to |
1426 | * the free list: |
1427 | */ |
1428 | - while (!fifo_empty(&ca->free_inc)) { |
1429 | + while (1) { |
1430 | long bucket; |
1431 | |
1432 | - fifo_pop(&ca->free_inc, bucket); |
1433 | + if (!fifo_pop(&ca->free_inc, bucket)) |
1434 | + break; |
1435 | |
1436 | if (ca->discard) { |
1437 | mutex_unlock(&ca->set->bucket_lock); |
1438 | diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c |
1439 | index c76a0176b5c6..6ee5370eb916 100644 |
1440 | --- a/drivers/md/bcache/journal.c |
1441 | +++ b/drivers/md/bcache/journal.c |
1442 | @@ -309,6 +309,18 @@ void bch_journal_mark(struct cache_set *c, struct list_head *list) |
1443 | } |
1444 | } |
1445 | |
1446 | +bool is_discard_enabled(struct cache_set *s) |
1447 | +{ |
1448 | + struct cache *ca; |
1449 | + unsigned int i; |
1450 | + |
1451 | + for_each_cache(ca, s, i) |
1452 | + if (ca->discard) |
1453 | + return true; |
1454 | + |
1455 | + return false; |
1456 | +} |
1457 | + |
1458 | int bch_journal_replay(struct cache_set *s, struct list_head *list) |
1459 | { |
1460 | int ret = 0, keys = 0, entries = 0; |
1461 | @@ -322,9 +334,17 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list) |
1462 | list_for_each_entry(i, list, list) { |
1463 | BUG_ON(i->pin && atomic_read(i->pin) != 1); |
1464 | |
1465 | - cache_set_err_on(n != i->j.seq, s, |
1466 | -"bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)", |
1467 | - n, i->j.seq - 1, start, end); |
1468 | + if (n != i->j.seq) { |
1469 | + if (n == start && is_discard_enabled(s)) |
1470 | + pr_info("bcache: journal entries %llu-%llu may be discarded! (replaying %llu-%llu)", |
1471 | + n, i->j.seq - 1, start, end); |
1472 | + else { |
1473 | + pr_err("bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)", |
1474 | + n, i->j.seq - 1, start, end); |
1475 | + ret = -EIO; |
1476 | + goto err; |
1477 | + } |
1478 | + } |
1479 | |
1480 | for (k = i->j.start; |
1481 | k < bset_bkey_last(&i->j); |
1482 | diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
1483 | index 362efc8dd16f..9f2588eaaf5f 100644 |
1484 | --- a/drivers/md/bcache/super.c |
1485 | +++ b/drivers/md/bcache/super.c |
1486 | @@ -1561,7 +1561,7 @@ err: |
1487 | return NULL; |
1488 | } |
1489 | |
1490 | -static void run_cache_set(struct cache_set *c) |
1491 | +static int run_cache_set(struct cache_set *c) |
1492 | { |
1493 | const char *err = "cannot allocate memory"; |
1494 | struct cached_dev *dc, *t; |
1495 | @@ -1653,7 +1653,9 @@ static void run_cache_set(struct cache_set *c) |
1496 | if (j->version < BCACHE_JSET_VERSION_UUID) |
1497 | __uuid_write(c); |
1498 | |
1499 | - bch_journal_replay(c, &journal); |
1500 | + err = "bcache: replay journal failed"; |
1501 | + if (bch_journal_replay(c, &journal)) |
1502 | + goto err; |
1503 | } else { |
1504 | pr_notice("invalidating existing data"); |
1505 | |
1506 | @@ -1721,11 +1723,13 @@ static void run_cache_set(struct cache_set *c) |
1507 | flash_devs_run(c); |
1508 | |
1509 | set_bit(CACHE_SET_RUNNING, &c->flags); |
1510 | - return; |
1511 | + return 0; |
1512 | err: |
1513 | closure_sync(&cl); |
1514 | /* XXX: test this, it's broken */ |
1515 | bch_cache_set_error(c, "%s", err); |
1516 | + |
1517 | + return -EIO; |
1518 | } |
1519 | |
1520 | static bool can_attach_cache(struct cache *ca, struct cache_set *c) |
1521 | @@ -1789,8 +1793,11 @@ found: |
1522 | ca->set->cache[ca->sb.nr_this_dev] = ca; |
1523 | c->cache_by_alloc[c->caches_loaded++] = ca; |
1524 | |
1525 | - if (c->caches_loaded == c->sb.nr_in_set) |
1526 | - run_cache_set(c); |
1527 | + if (c->caches_loaded == c->sb.nr_in_set) { |
1528 | + err = "failed to run cache set"; |
1529 | + if (run_cache_set(c) < 0) |
1530 | + goto err; |
1531 | + } |
1532 | |
1533 | return NULL; |
1534 | err: |
1535 | diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c |
1536 | index 31f16105184c..59a4563c0466 100644 |
1537 | --- a/drivers/media/dvb-frontends/m88ds3103.c |
1538 | +++ b/drivers/media/dvb-frontends/m88ds3103.c |
1539 | @@ -309,6 +309,9 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) |
1540 | u16 u16tmp; |
1541 | u32 tuner_frequency_khz, target_mclk; |
1542 | s32 s32tmp; |
1543 | + static const struct reg_sequence reset_buf[] = { |
1544 | + {0x07, 0x80}, {0x07, 0x00} |
1545 | + }; |
1546 | |
1547 | dev_dbg(&client->dev, |
1548 | "delivery_system=%d modulation=%d frequency=%u symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n", |
1549 | @@ -321,11 +324,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) |
1550 | } |
1551 | |
1552 | /* reset */ |
1553 | - ret = regmap_write(dev->regmap, 0x07, 0x80); |
1554 | - if (ret) |
1555 | - goto err; |
1556 | - |
1557 | - ret = regmap_write(dev->regmap, 0x07, 0x00); |
1558 | + ret = regmap_multi_reg_write(dev->regmap, reset_buf, 2); |
1559 | if (ret) |
1560 | goto err; |
1561 | |
1562 | diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c |
1563 | index 1f999e9c0118..3554eea77e04 100644 |
1564 | --- a/drivers/media/i2c/ov2659.c |
1565 | +++ b/drivers/media/i2c/ov2659.c |
1566 | @@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, |
1567 | if (ov2659_formats[index].code == mf->code) |
1568 | break; |
1569 | |
1570 | - if (index < 0) |
1571 | - return -EINVAL; |
1572 | + if (index < 0) { |
1573 | + index = 0; |
1574 | + mf->code = ov2659_formats[index].code; |
1575 | + } |
1576 | |
1577 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
1578 | mf->code = ov2659_formats[index].code; |
1579 | diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c |
1580 | index e21b7e1c2ee1..fc187c5aeb1e 100644 |
1581 | --- a/drivers/media/i2c/soc_camera/ov6650.c |
1582 | +++ b/drivers/media/i2c/soc_camera/ov6650.c |
1583 | @@ -840,9 +840,16 @@ static int ov6650_video_probe(struct i2c_client *client) |
1584 | u8 pidh, pidl, midh, midl; |
1585 | int ret; |
1586 | |
1587 | + priv->clk = v4l2_clk_get(&client->dev, NULL); |
1588 | + if (IS_ERR(priv->clk)) { |
1589 | + ret = PTR_ERR(priv->clk); |
1590 | + dev_err(&client->dev, "v4l2_clk request err: %d\n", ret); |
1591 | + return ret; |
1592 | + } |
1593 | + |
1594 | ret = ov6650_s_power(&priv->subdev, 1); |
1595 | if (ret < 0) |
1596 | - return ret; |
1597 | + goto eclkput; |
1598 | |
1599 | msleep(20); |
1600 | |
1601 | @@ -879,6 +886,11 @@ static int ov6650_video_probe(struct i2c_client *client) |
1602 | |
1603 | done: |
1604 | ov6650_s_power(&priv->subdev, 0); |
1605 | + if (!ret) |
1606 | + return 0; |
1607 | +eclkput: |
1608 | + v4l2_clk_put(priv->clk); |
1609 | + |
1610 | return ret; |
1611 | } |
1612 | |
1613 | @@ -1035,18 +1047,9 @@ static int ov6650_probe(struct i2c_client *client, |
1614 | priv->code = MEDIA_BUS_FMT_YUYV8_2X8; |
1615 | priv->colorspace = V4L2_COLORSPACE_JPEG; |
1616 | |
1617 | - priv->clk = v4l2_clk_get(&client->dev, NULL); |
1618 | - if (IS_ERR(priv->clk)) { |
1619 | - ret = PTR_ERR(priv->clk); |
1620 | - goto eclkget; |
1621 | - } |
1622 | - |
1623 | ret = ov6650_video_probe(client); |
1624 | - if (ret) { |
1625 | - v4l2_clk_put(priv->clk); |
1626 | -eclkget: |
1627 | + if (ret) |
1628 | v4l2_ctrl_handler_free(&priv->hdl); |
1629 | - } |
1630 | |
1631 | return ret; |
1632 | } |
1633 | diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c |
1634 | index c889ec9f8a5a..f5fc8bcbd14b 100644 |
1635 | --- a/drivers/media/pci/saa7146/hexium_gemini.c |
1636 | +++ b/drivers/media/pci/saa7146/hexium_gemini.c |
1637 | @@ -270,9 +270,8 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d |
1638 | /* enable i2c-port pins */ |
1639 | saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26)); |
1640 | |
1641 | - hexium->i2c_adapter = (struct i2c_adapter) { |
1642 | - .name = "hexium gemini", |
1643 | - }; |
1644 | + strscpy(hexium->i2c_adapter.name, "hexium gemini", |
1645 | + sizeof(hexium->i2c_adapter.name)); |
1646 | saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); |
1647 | if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { |
1648 | DEB_S("cannot register i2c-device. skipping.\n"); |
1649 | diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c |
1650 | index c306a92e8909..dc07ca37ebd0 100644 |
1651 | --- a/drivers/media/pci/saa7146/hexium_orion.c |
1652 | +++ b/drivers/media/pci/saa7146/hexium_orion.c |
1653 | @@ -232,9 +232,8 @@ static int hexium_probe(struct saa7146_dev *dev) |
1654 | saa7146_write(dev, DD1_STREAM_B, 0x00000000); |
1655 | saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26)); |
1656 | |
1657 | - hexium->i2c_adapter = (struct i2c_adapter) { |
1658 | - .name = "hexium orion", |
1659 | - }; |
1660 | + strscpy(hexium->i2c_adapter.name, "hexium orion", |
1661 | + sizeof(hexium->i2c_adapter.name)); |
1662 | saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); |
1663 | if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { |
1664 | DEB_S("cannot register i2c-device. skipping.\n"); |
1665 | diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c |
1666 | index b6625047250d..717ee9a6a80e 100644 |
1667 | --- a/drivers/media/platform/coda/coda-bit.c |
1668 | +++ b/drivers/media/platform/coda/coda-bit.c |
1669 | @@ -1829,6 +1829,9 @@ static int coda_prepare_decode(struct coda_ctx *ctx) |
1670 | /* Clear decode success flag */ |
1671 | coda_write(dev, 0, CODA_RET_DEC_PIC_SUCCESS); |
1672 | |
1673 | + /* Clear error return value */ |
1674 | + coda_write(dev, 0, CODA_RET_DEC_PIC_ERR_MB); |
1675 | + |
1676 | trace_coda_dec_pic_run(ctx, meta); |
1677 | |
1678 | coda_command_async(ctx, CODA_COMMAND_PIC_RUN); |
1679 | diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c |
1680 | index 25d4fd4f4c0b..a72982df4777 100644 |
1681 | --- a/drivers/media/platform/vivid/vivid-vid-cap.c |
1682 | +++ b/drivers/media/platform/vivid/vivid-vid-cap.c |
1683 | @@ -984,7 +984,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection |
1684 | v4l2_rect_map_inside(&s->r, &dev->fmt_cap_rect); |
1685 | if (dev->bitmap_cap && (compose->width != s->r.width || |
1686 | compose->height != s->r.height)) { |
1687 | - kfree(dev->bitmap_cap); |
1688 | + vfree(dev->bitmap_cap); |
1689 | dev->bitmap_cap = NULL; |
1690 | } |
1691 | *compose = s->r; |
1692 | diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c |
1693 | index 642b89c66bcb..c1457cf46698 100644 |
1694 | --- a/drivers/media/radio/wl128x/fmdrv_common.c |
1695 | +++ b/drivers/media/radio/wl128x/fmdrv_common.c |
1696 | @@ -494,7 +494,8 @@ int fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, |
1697 | return -EIO; |
1698 | } |
1699 | /* Send response data to caller */ |
1700 | - if (response != NULL && response_len != NULL && evt_hdr->dlen) { |
1701 | + if (response != NULL && response_len != NULL && evt_hdr->dlen && |
1702 | + evt_hdr->dlen <= payload_len) { |
1703 | /* Skip header info and copy only response data */ |
1704 | skb_pull(skb, sizeof(struct fm_event_msg_hdr)); |
1705 | memcpy(response, skb->data, evt_hdr->dlen); |
1706 | @@ -590,6 +591,8 @@ static void fm_irq_handle_flag_getcmd_resp(struct fmdev *fmdev) |
1707 | return; |
1708 | |
1709 | fm_evt_hdr = (void *)skb->data; |
1710 | + if (fm_evt_hdr->dlen > sizeof(fmdev->irq_info.flag)) |
1711 | + return; |
1712 | |
1713 | /* Skip header info and copy only response data */ |
1714 | skb_pull(skb, sizeof(struct fm_event_msg_hdr)); |
1715 | @@ -1315,7 +1318,7 @@ static int load_default_rx_configuration(struct fmdev *fmdev) |
1716 | static int fm_power_up(struct fmdev *fmdev, u8 mode) |
1717 | { |
1718 | u16 payload; |
1719 | - __be16 asic_id, asic_ver; |
1720 | + __be16 asic_id = 0, asic_ver = 0; |
1721 | int resp_len, ret; |
1722 | u8 fw_name[50]; |
1723 | |
1724 | diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c |
1725 | index 85dd9a8e83ff..48eeb5a6a209 100644 |
1726 | --- a/drivers/media/usb/au0828/au0828-video.c |
1727 | +++ b/drivers/media/usb/au0828/au0828-video.c |
1728 | @@ -764,6 +764,9 @@ static int au0828_analog_stream_enable(struct au0828_dev *d) |
1729 | |
1730 | dprintk(1, "au0828_analog_stream_enable called\n"); |
1731 | |
1732 | + if (test_bit(DEV_DISCONNECTED, &d->dev_state)) |
1733 | + return -ENODEV; |
1734 | + |
1735 | iface = usb_ifnum_to_if(d->usbdev, 0); |
1736 | if (iface && iface->cur_altsetting->desc.bAlternateSetting != 5) { |
1737 | dprintk(1, "Changing intf#0 to alt 5\n"); |
1738 | @@ -852,9 +855,9 @@ int au0828_start_analog_streaming(struct vb2_queue *vq, unsigned int count) |
1739 | return rc; |
1740 | } |
1741 | |
1742 | + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 1); |
1743 | + |
1744 | if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
1745 | - v4l2_device_call_all(&dev->v4l2_dev, 0, video, |
1746 | - s_stream, 1); |
1747 | dev->vid_timeout_running = 1; |
1748 | mod_timer(&dev->vid_timeout, jiffies + (HZ / 10)); |
1749 | } else if (vq->type == V4L2_BUF_TYPE_VBI_CAPTURE) { |
1750 | @@ -874,10 +877,11 @@ static void au0828_stop_streaming(struct vb2_queue *vq) |
1751 | |
1752 | dprintk(1, "au0828_stop_streaming called %d\n", dev->streaming_users); |
1753 | |
1754 | - if (dev->streaming_users-- == 1) |
1755 | + if (dev->streaming_users-- == 1) { |
1756 | au0828_uninit_isoc(dev); |
1757 | + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); |
1758 | + } |
1759 | |
1760 | - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); |
1761 | dev->vid_timeout_running = 0; |
1762 | del_timer_sync(&dev->vid_timeout); |
1763 | |
1764 | @@ -906,8 +910,10 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq) |
1765 | dprintk(1, "au0828_stop_vbi_streaming called %d\n", |
1766 | dev->streaming_users); |
1767 | |
1768 | - if (dev->streaming_users-- == 1) |
1769 | + if (dev->streaming_users-- == 1) { |
1770 | au0828_uninit_isoc(dev); |
1771 | + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); |
1772 | + } |
1773 | |
1774 | spin_lock_irqsave(&dev->slock, flags); |
1775 | if (dev->isoc_ctl.vbi_buf != NULL) { |
1776 | diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c |
1777 | index d793c630f1dd..05e7edb213de 100644 |
1778 | --- a/drivers/media/usb/cpia2/cpia2_v4l.c |
1779 | +++ b/drivers/media/usb/cpia2/cpia2_v4l.c |
1780 | @@ -1248,8 +1248,7 @@ static int __init cpia2_init(void) |
1781 | LOG("%s v%s\n", |
1782 | ABOUT, CPIA_VERSION); |
1783 | check_parameters(); |
1784 | - cpia2_usb_init(); |
1785 | - return 0; |
1786 | + return cpia2_usb_init(); |
1787 | } |
1788 | |
1789 | |
1790 | diff --git a/drivers/media/usb/go7007/go7007-fw.c b/drivers/media/usb/go7007/go7007-fw.c |
1791 | index 60bf5f0644d1..a5efcd4f7b4f 100644 |
1792 | --- a/drivers/media/usb/go7007/go7007-fw.c |
1793 | +++ b/drivers/media/usb/go7007/go7007-fw.c |
1794 | @@ -1499,8 +1499,8 @@ static int modet_to_package(struct go7007 *go, __le16 *code, int space) |
1795 | return cnt; |
1796 | } |
1797 | |
1798 | -static int do_special(struct go7007 *go, u16 type, __le16 *code, int space, |
1799 | - int *framelen) |
1800 | +static noinline_for_stack int do_special(struct go7007 *go, u16 type, |
1801 | + __le16 *code, int space, int *framelen) |
1802 | { |
1803 | switch (type) { |
1804 | case SPECIAL_FRM_HEAD: |
1805 | diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
1806 | index 1eb4f7ba2967..ff489645e070 100644 |
1807 | --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
1808 | +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
1809 | @@ -670,6 +670,8 @@ static int ctrl_get_input(struct pvr2_ctrl *cptr,int *vp) |
1810 | |
1811 | static int ctrl_check_input(struct pvr2_ctrl *cptr,int v) |
1812 | { |
1813 | + if (v < 0 || v > PVR2_CVAL_INPUT_MAX) |
1814 | + return 0; |
1815 | return ((1 << v) & cptr->hdw->input_allowed_mask) != 0; |
1816 | } |
1817 | |
1818 | diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.h b/drivers/media/usb/pvrusb2/pvrusb2-hdw.h |
1819 | index a82a00dd7329..80869990ffbb 100644 |
1820 | --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.h |
1821 | +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.h |
1822 | @@ -54,6 +54,7 @@ |
1823 | #define PVR2_CVAL_INPUT_COMPOSITE 2 |
1824 | #define PVR2_CVAL_INPUT_SVIDEO 3 |
1825 | #define PVR2_CVAL_INPUT_RADIO 4 |
1826 | +#define PVR2_CVAL_INPUT_MAX PVR2_CVAL_INPUT_RADIO |
1827 | |
1828 | enum pvr2_config { |
1829 | pvr2_config_empty, /* No configuration */ |
1830 | diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c |
1831 | index adc9c0c614fb..4493c299d85e 100644 |
1832 | --- a/drivers/mmc/core/pwrseq_emmc.c |
1833 | +++ b/drivers/mmc/core/pwrseq_emmc.c |
1834 | @@ -30,19 +30,14 @@ struct mmc_pwrseq_emmc { |
1835 | |
1836 | #define to_pwrseq_emmc(p) container_of(p, struct mmc_pwrseq_emmc, pwrseq) |
1837 | |
1838 | -static void __mmc_pwrseq_emmc_reset(struct mmc_pwrseq_emmc *pwrseq) |
1839 | -{ |
1840 | - gpiod_set_value(pwrseq->reset_gpio, 1); |
1841 | - udelay(1); |
1842 | - gpiod_set_value(pwrseq->reset_gpio, 0); |
1843 | - udelay(200); |
1844 | -} |
1845 | - |
1846 | static void mmc_pwrseq_emmc_reset(struct mmc_host *host) |
1847 | { |
1848 | struct mmc_pwrseq_emmc *pwrseq = to_pwrseq_emmc(host->pwrseq); |
1849 | |
1850 | - __mmc_pwrseq_emmc_reset(pwrseq); |
1851 | + gpiod_set_value_cansleep(pwrseq->reset_gpio, 1); |
1852 | + udelay(1); |
1853 | + gpiod_set_value_cansleep(pwrseq->reset_gpio, 0); |
1854 | + udelay(200); |
1855 | } |
1856 | |
1857 | static int mmc_pwrseq_emmc_reset_nb(struct notifier_block *this, |
1858 | @@ -50,8 +45,11 @@ static int mmc_pwrseq_emmc_reset_nb(struct notifier_block *this, |
1859 | { |
1860 | struct mmc_pwrseq_emmc *pwrseq = container_of(this, |
1861 | struct mmc_pwrseq_emmc, reset_nb); |
1862 | + gpiod_set_value(pwrseq->reset_gpio, 1); |
1863 | + udelay(1); |
1864 | + gpiod_set_value(pwrseq->reset_gpio, 0); |
1865 | + udelay(200); |
1866 | |
1867 | - __mmc_pwrseq_emmc_reset(pwrseq); |
1868 | return NOTIFY_DONE; |
1869 | } |
1870 | |
1871 | @@ -72,14 +70,18 @@ static int mmc_pwrseq_emmc_probe(struct platform_device *pdev) |
1872 | if (IS_ERR(pwrseq->reset_gpio)) |
1873 | return PTR_ERR(pwrseq->reset_gpio); |
1874 | |
1875 | - /* |
1876 | - * register reset handler to ensure emmc reset also from |
1877 | - * emergency_reboot(), priority 255 is the highest priority |
1878 | - * so it will be executed before any system reboot handler. |
1879 | - */ |
1880 | - pwrseq->reset_nb.notifier_call = mmc_pwrseq_emmc_reset_nb; |
1881 | - pwrseq->reset_nb.priority = 255; |
1882 | - register_restart_handler(&pwrseq->reset_nb); |
1883 | + if (!gpiod_cansleep(pwrseq->reset_gpio)) { |
1884 | + /* |
1885 | + * register reset handler to ensure emmc reset also from |
1886 | + * emergency_reboot(), priority 255 is the highest priority |
1887 | + * so it will be executed before any system reboot handler. |
1888 | + */ |
1889 | + pwrseq->reset_nb.notifier_call = mmc_pwrseq_emmc_reset_nb; |
1890 | + pwrseq->reset_nb.priority = 255; |
1891 | + register_restart_handler(&pwrseq->reset_nb); |
1892 | + } else { |
1893 | + dev_notice(dev, "EMMC reset pin tied to a sleepy GPIO driver; reset on emergency-reboot disabled\n"); |
1894 | + } |
1895 | |
1896 | pwrseq->pwrseq.ops = &mmc_pwrseq_emmc_ops; |
1897 | pwrseq->pwrseq.dev = dev; |
1898 | diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c |
1899 | index f09148a4ab55..00ba8807dafe 100644 |
1900 | --- a/drivers/mmc/core/sd.c |
1901 | +++ b/drivers/mmc/core/sd.c |
1902 | @@ -214,6 +214,14 @@ static int mmc_decode_scr(struct mmc_card *card) |
1903 | |
1904 | if (scr->sda_spec3) |
1905 | scr->cmds = UNSTUFF_BITS(resp, 32, 2); |
1906 | + |
1907 | + /* SD Spec says: any SD Card shall set at least bits 0 and 2 */ |
1908 | + if (!(scr->bus_widths & SD_SCR_BUS_WIDTH_1) || |
1909 | + !(scr->bus_widths & SD_SCR_BUS_WIDTH_4)) { |
1910 | + pr_err("%s: invalid bus width\n", mmc_hostname(card->host)); |
1911 | + return -EINVAL; |
1912 | + } |
1913 | + |
1914 | return 0; |
1915 | } |
1916 | |
1917 | diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c |
1918 | index 6224ad37fd80..c2df68e958b3 100644 |
1919 | --- a/drivers/mmc/host/mmc_spi.c |
1920 | +++ b/drivers/mmc/host/mmc_spi.c |
1921 | @@ -819,6 +819,10 @@ mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t, |
1922 | } |
1923 | |
1924 | status = spi_sync_locked(spi, &host->m); |
1925 | + if (status < 0) { |
1926 | + dev_dbg(&spi->dev, "read error %d\n", status); |
1927 | + return status; |
1928 | + } |
1929 | |
1930 | if (host->dma_dev) { |
1931 | dma_sync_single_for_cpu(host->dma_dev, |
1932 | diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
1933 | index a51d636c2312..6f11cd95bb5f 100644 |
1934 | --- a/drivers/mmc/host/sdhci-of-esdhc.c |
1935 | +++ b/drivers/mmc/host/sdhci-of-esdhc.c |
1936 | @@ -636,6 +636,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) |
1937 | if (esdhc->vendor_ver > VENDOR_V_22) |
1938 | host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ; |
1939 | |
1940 | + if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) { |
1941 | + host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST; |
1942 | + host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
1943 | + } |
1944 | + |
1945 | if (of_device_is_compatible(np, "fsl,p5040-esdhc") || |
1946 | of_device_is_compatible(np, "fsl,p5020-esdhc") || |
1947 | of_device_is_compatible(np, "fsl,p4080-esdhc") || |
1948 | diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1949 | index 0c298878bf46..0780900b37c7 100644 |
1950 | --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1951 | +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1952 | @@ -2116,7 +2116,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev) |
1953 | |
1954 | host_info->os_type = ENA_ADMIN_OS_LINUX; |
1955 | host_info->kernel_ver = LINUX_VERSION_CODE; |
1956 | - strncpy(host_info->kernel_ver_str, utsname()->version, |
1957 | + strlcpy(host_info->kernel_ver_str, utsname()->version, |
1958 | sizeof(host_info->kernel_ver_str) - 1); |
1959 | host_info->os_dist = 0; |
1960 | strncpy(host_info->os_dist_str, utsname()->release, |
1961 | diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.h b/drivers/net/ethernet/chelsio/cxgb3/l2t.h |
1962 | index 8cffcdfd5678..38b5858c335a 100644 |
1963 | --- a/drivers/net/ethernet/chelsio/cxgb3/l2t.h |
1964 | +++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.h |
1965 | @@ -75,8 +75,8 @@ struct l2t_data { |
1966 | struct l2t_entry *rover; /* starting point for next allocation */ |
1967 | atomic_t nfree; /* number of free entries */ |
1968 | rwlock_t lock; |
1969 | - struct l2t_entry l2tab[0]; |
1970 | struct rcu_head rcu_head; /* to handle rcu cleanup */ |
1971 | + struct l2t_entry l2tab[]; |
1972 | }; |
1973 | |
1974 | typedef void (*arp_failure_handler_func)(struct t3cdev * dev, |
1975 | diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
1976 | index c71a52a2f801..5478a2ab45c4 100644 |
1977 | --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
1978 | +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
1979 | @@ -5203,15 +5203,24 @@ static int __init cxgb4_init_module(void) |
1980 | |
1981 | ret = pci_register_driver(&cxgb4_driver); |
1982 | if (ret < 0) |
1983 | - debugfs_remove(cxgb4_debugfs_root); |
1984 | + goto err_pci; |
1985 | |
1986 | #if IS_ENABLED(CONFIG_IPV6) |
1987 | if (!inet6addr_registered) { |
1988 | - register_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
1989 | - inet6addr_registered = true; |
1990 | + ret = register_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
1991 | + if (ret) |
1992 | + pci_unregister_driver(&cxgb4_driver); |
1993 | + else |
1994 | + inet6addr_registered = true; |
1995 | } |
1996 | #endif |
1997 | |
1998 | + if (ret == 0) |
1999 | + return ret; |
2000 | + |
2001 | +err_pci: |
2002 | + debugfs_remove(cxgb4_debugfs_root); |
2003 | + |
2004 | return ret; |
2005 | } |
2006 | |
2007 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
2008 | index 7836072d3f63..886378c5334f 100644 |
2009 | --- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
2010 | +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
2011 | @@ -2285,6 +2285,10 @@ void i40e_vlan_stripping_enable(struct i40e_vsi *vsi) |
2012 | struct i40e_vsi_context ctxt; |
2013 | i40e_status ret; |
2014 | |
2015 | + /* Don't modify stripping options if a port VLAN is active */ |
2016 | + if (vsi->info.pvid) |
2017 | + return; |
2018 | + |
2019 | if ((vsi->info.valid_sections & |
2020 | cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID)) && |
2021 | ((vsi->info.port_vlan_flags & I40E_AQ_VSI_PVLAN_MODE_MASK) == 0)) |
2022 | @@ -2315,6 +2319,10 @@ void i40e_vlan_stripping_disable(struct i40e_vsi *vsi) |
2023 | struct i40e_vsi_context ctxt; |
2024 | i40e_status ret; |
2025 | |
2026 | + /* Don't modify stripping options if a port VLAN is active */ |
2027 | + if (vsi->info.pvid) |
2028 | + return; |
2029 | + |
2030 | if ((vsi->info.valid_sections & |
2031 | cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID)) && |
2032 | ((vsi->info.port_vlan_flags & I40E_AQ_VSI_PVLAN_EMOD_MASK) == |
2033 | diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c |
2034 | index 0e180677c7fc..09dbab464fe1 100644 |
2035 | --- a/drivers/net/wireless/atmel/at76c50x-usb.c |
2036 | +++ b/drivers/net/wireless/atmel/at76c50x-usb.c |
2037 | @@ -2583,8 +2583,8 @@ static int __init at76_mod_init(void) |
2038 | if (result < 0) |
2039 | printk(KERN_ERR DRIVER_NAME |
2040 | ": usb_register failed (status %d)\n", result); |
2041 | - |
2042 | - led_trigger_register_simple("at76_usb-tx", &ledtrig_tx); |
2043 | + else |
2044 | + led_trigger_register_simple("at76_usb-tx", &ledtrig_tx); |
2045 | return result; |
2046 | } |
2047 | |
2048 | diff --git a/drivers/net/wireless/broadcom/b43/phy_lp.c b/drivers/net/wireless/broadcom/b43/phy_lp.c |
2049 | index 6922cbb99a04..5a0699fb4b9a 100644 |
2050 | --- a/drivers/net/wireless/broadcom/b43/phy_lp.c |
2051 | +++ b/drivers/net/wireless/broadcom/b43/phy_lp.c |
2052 | @@ -1834,7 +1834,7 @@ static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains, |
2053 | static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) |
2054 | { |
2055 | struct b43_phy_lp *lpphy = dev->phy.lp; |
2056 | - struct lpphy_tx_gains gains, oldgains; |
2057 | + struct lpphy_tx_gains oldgains; |
2058 | int old_txpctl, old_afe_ovr, old_rf, old_bbmult; |
2059 | |
2060 | lpphy_read_tx_pctl_mode_from_hardware(dev); |
2061 | @@ -1848,9 +1848,9 @@ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) |
2062 | lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); |
2063 | |
2064 | if (dev->dev->chip_id == 0x4325 && dev->dev->chip_rev == 0) |
2065 | - lpphy_papd_cal(dev, gains, 0, 1, 30); |
2066 | + lpphy_papd_cal(dev, oldgains, 0, 1, 30); |
2067 | else |
2068 | - lpphy_papd_cal(dev, gains, 0, 1, 65); |
2069 | + lpphy_papd_cal(dev, oldgains, 0, 1, 65); |
2070 | |
2071 | if (old_afe_ovr) |
2072 | lpphy_set_tx_gains(dev, oldgains); |
2073 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
2074 | index 530f52120972..8f8fe6f2af5b 100644 |
2075 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
2076 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
2077 | @@ -5374,6 +5374,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, |
2078 | conn_info->req_ie = |
2079 | kmemdup(cfg->extra_buf, conn_info->req_ie_len, |
2080 | GFP_KERNEL); |
2081 | + if (!conn_info->req_ie) |
2082 | + conn_info->req_ie_len = 0; |
2083 | } else { |
2084 | conn_info->req_ie_len = 0; |
2085 | conn_info->req_ie = NULL; |
2086 | @@ -5390,6 +5392,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, |
2087 | conn_info->resp_ie = |
2088 | kmemdup(cfg->extra_buf, conn_info->resp_ie_len, |
2089 | GFP_KERNEL); |
2090 | + if (!conn_info->resp_ie) |
2091 | + conn_info->resp_ie_len = 0; |
2092 | } else { |
2093 | conn_info->resp_ie_len = 0; |
2094 | conn_info->resp_ie = NULL; |
2095 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
2096 | index f877301c9454..ecfe056d7643 100644 |
2097 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
2098 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
2099 | @@ -685,17 +685,17 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, |
2100 | bool rtnl_locked) |
2101 | { |
2102 | struct brcmf_if *ifp; |
2103 | + int ifidx; |
2104 | |
2105 | ifp = drvr->iflist[bsscfgidx]; |
2106 | - drvr->iflist[bsscfgidx] = NULL; |
2107 | if (!ifp) { |
2108 | brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx); |
2109 | return; |
2110 | } |
2111 | brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx, |
2112 | ifp->ifidx); |
2113 | - if (drvr->if2bss[ifp->ifidx] == bsscfgidx) |
2114 | - drvr->if2bss[ifp->ifidx] = BRCMF_BSSIDX_INVALID; |
2115 | + ifidx = ifp->ifidx; |
2116 | + |
2117 | if (ifp->ndev) { |
2118 | if (bsscfgidx == 0) { |
2119 | if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { |
2120 | @@ -723,6 +723,10 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, |
2121 | brcmf_p2p_ifp_removed(ifp, rtnl_locked); |
2122 | kfree(ifp); |
2123 | } |
2124 | + |
2125 | + drvr->iflist[bsscfgidx] = NULL; |
2126 | + if (drvr->if2bss[ifidx] == bsscfgidx) |
2127 | + drvr->if2bss[ifidx] = BRCMF_BSSIDX_INVALID; |
2128 | } |
2129 | |
2130 | void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked) |
2131 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c |
2132 | index 053f3b59f21e..acf513fd9e6d 100644 |
2133 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c |
2134 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c |
2135 | @@ -157,7 +157,7 @@ struct brcmf_usbdev_info { |
2136 | |
2137 | struct usb_device *usbdev; |
2138 | struct device *dev; |
2139 | - struct mutex dev_init_lock; |
2140 | + struct completion dev_init_done; |
2141 | |
2142 | int ctl_in_pipe, ctl_out_pipe; |
2143 | struct urb *ctl_urb; /* URB for control endpoint */ |
2144 | @@ -681,12 +681,18 @@ static int brcmf_usb_up(struct device *dev) |
2145 | |
2146 | static void brcmf_cancel_all_urbs(struct brcmf_usbdev_info *devinfo) |
2147 | { |
2148 | + int i; |
2149 | + |
2150 | if (devinfo->ctl_urb) |
2151 | usb_kill_urb(devinfo->ctl_urb); |
2152 | if (devinfo->bulk_urb) |
2153 | usb_kill_urb(devinfo->bulk_urb); |
2154 | - brcmf_usb_free_q(&devinfo->tx_postq, true); |
2155 | - brcmf_usb_free_q(&devinfo->rx_postq, true); |
2156 | + if (devinfo->tx_reqs) |
2157 | + for (i = 0; i < devinfo->bus_pub.ntxq; i++) |
2158 | + usb_kill_urb(devinfo->tx_reqs[i].urb); |
2159 | + if (devinfo->rx_reqs) |
2160 | + for (i = 0; i < devinfo->bus_pub.nrxq; i++) |
2161 | + usb_kill_urb(devinfo->rx_reqs[i].urb); |
2162 | } |
2163 | |
2164 | static void brcmf_usb_down(struct device *dev) |
2165 | @@ -1189,11 +1195,11 @@ static void brcmf_usb_probe_phase2(struct device *dev, int ret, |
2166 | if (ret) |
2167 | goto error; |
2168 | |
2169 | - mutex_unlock(&devinfo->dev_init_lock); |
2170 | + complete(&devinfo->dev_init_done); |
2171 | return; |
2172 | error: |
2173 | brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), ret); |
2174 | - mutex_unlock(&devinfo->dev_init_lock); |
2175 | + complete(&devinfo->dev_init_done); |
2176 | device_release_driver(dev); |
2177 | } |
2178 | |
2179 | @@ -1239,7 +1245,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) |
2180 | if (ret) |
2181 | goto fail; |
2182 | /* we are done */ |
2183 | - mutex_unlock(&devinfo->dev_init_lock); |
2184 | + complete(&devinfo->dev_init_done); |
2185 | return 0; |
2186 | } |
2187 | bus->chip = bus_pub->devid; |
2188 | @@ -1300,11 +1306,10 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) |
2189 | |
2190 | devinfo->usbdev = usb; |
2191 | devinfo->dev = &usb->dev; |
2192 | - /* Take an init lock, to protect for disconnect while still loading. |
2193 | + /* Init completion, to protect for disconnect while still loading. |
2194 | * Necessary because of the asynchronous firmware load construction |
2195 | */ |
2196 | - mutex_init(&devinfo->dev_init_lock); |
2197 | - mutex_lock(&devinfo->dev_init_lock); |
2198 | + init_completion(&devinfo->dev_init_done); |
2199 | |
2200 | usb_set_intfdata(intf, devinfo); |
2201 | |
2202 | @@ -1382,7 +1387,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) |
2203 | return 0; |
2204 | |
2205 | fail: |
2206 | - mutex_unlock(&devinfo->dev_init_lock); |
2207 | + complete(&devinfo->dev_init_done); |
2208 | kfree(devinfo); |
2209 | usb_set_intfdata(intf, NULL); |
2210 | return ret; |
2211 | @@ -1397,7 +1402,7 @@ brcmf_usb_disconnect(struct usb_interface *intf) |
2212 | devinfo = (struct brcmf_usbdev_info *)usb_get_intfdata(intf); |
2213 | |
2214 | if (devinfo) { |
2215 | - mutex_lock(&devinfo->dev_init_lock); |
2216 | + wait_for_completion(&devinfo->dev_init_done); |
2217 | /* Make sure that devinfo still exists. Firmware probe routines |
2218 | * may have released the device and cleared the intfdata. |
2219 | */ |
2220 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c |
2221 | index 8eff2753abad..d493021f6031 100644 |
2222 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c |
2223 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c |
2224 | @@ -35,9 +35,10 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy, |
2225 | struct brcmf_if *ifp; |
2226 | const struct brcmf_vndr_dcmd_hdr *cmdhdr = data; |
2227 | struct sk_buff *reply; |
2228 | - int ret, payload, ret_len; |
2229 | + unsigned int payload, ret_len; |
2230 | void *dcmd_buf = NULL, *wr_pointer; |
2231 | u16 msglen, maxmsglen = PAGE_SIZE - 0x100; |
2232 | + int ret; |
2233 | |
2234 | if (len < sizeof(*cmdhdr)) { |
2235 | brcmf_err("vendor command too short: %d\n", len); |
2236 | @@ -65,7 +66,7 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy, |
2237 | brcmf_err("oversize return buffer %d\n", ret_len); |
2238 | ret_len = BRCMF_DCMD_MAXLEN; |
2239 | } |
2240 | - payload = max(ret_len, len) + 1; |
2241 | + payload = max_t(unsigned int, ret_len, len) + 1; |
2242 | dcmd_buf = vzalloc(payload); |
2243 | if (NULL == dcmd_buf) |
2244 | return -ENOMEM; |
2245 | diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
2246 | index c21f8bd32d08..25f2a0aceaa2 100644 |
2247 | --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
2248 | +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
2249 | @@ -1225,10 +1225,15 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, |
2250 | static void iwl_pcie_rx_handle(struct iwl_trans *trans, int queue) |
2251 | { |
2252 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
2253 | - struct iwl_rxq *rxq = &trans_pcie->rxq[queue]; |
2254 | + struct iwl_rxq *rxq; |
2255 | u32 r, i, count = 0; |
2256 | bool emergency = false; |
2257 | |
2258 | + if (WARN_ON_ONCE(!trans_pcie->rxq || !trans_pcie->rxq[queue].bd)) |
2259 | + return; |
2260 | + |
2261 | + rxq = &trans_pcie->rxq[queue]; |
2262 | + |
2263 | restart: |
2264 | spin_lock(&rxq->lock); |
2265 | /* uCode's read index (stored in shared DRAM) indicates the last Rx |
2266 | diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
2267 | index 4da3541471e6..46d0099fd6e8 100644 |
2268 | --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
2269 | +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
2270 | @@ -4018,16 +4018,20 @@ static int mwifiex_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, |
2271 | |
2272 | if (mwifiex_send_cmd(priv, 0, 0, 0, hostcmd, true)) { |
2273 | dev_err(priv->adapter->dev, "Failed to process hostcmd\n"); |
2274 | + kfree(hostcmd); |
2275 | return -EFAULT; |
2276 | } |
2277 | |
2278 | /* process hostcmd response*/ |
2279 | skb = cfg80211_testmode_alloc_reply_skb(wiphy, hostcmd->len); |
2280 | - if (!skb) |
2281 | + if (!skb) { |
2282 | + kfree(hostcmd); |
2283 | return -ENOMEM; |
2284 | + } |
2285 | err = nla_put(skb, MWIFIEX_TM_ATTR_DATA, |
2286 | hostcmd->len, hostcmd->cmd); |
2287 | if (err) { |
2288 | + kfree(hostcmd); |
2289 | kfree_skb(skb); |
2290 | return -EMSGSIZE; |
2291 | } |
2292 | diff --git a/drivers/net/wireless/marvell/mwifiex/cfp.c b/drivers/net/wireless/marvell/mwifiex/cfp.c |
2293 | index 1ff22055e54f..9ddaa767ea74 100644 |
2294 | --- a/drivers/net/wireless/marvell/mwifiex/cfp.c |
2295 | +++ b/drivers/net/wireless/marvell/mwifiex/cfp.c |
2296 | @@ -533,5 +533,8 @@ u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv, |
2297 | rate_index = (rx_rate > MWIFIEX_RATE_INDEX_OFDM0) ? |
2298 | rx_rate - 1 : rx_rate; |
2299 | |
2300 | + if (rate_index >= MWIFIEX_MAX_AC_RX_RATES) |
2301 | + rate_index = MWIFIEX_MAX_AC_RX_RATES - 1; |
2302 | + |
2303 | return rate_index; |
2304 | } |
2305 | diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c |
2306 | index 4ac928bf1f8e..7de18ed10db8 100644 |
2307 | --- a/drivers/net/wireless/realtek/rtlwifi/base.c |
2308 | +++ b/drivers/net/wireless/realtek/rtlwifi/base.c |
2309 | @@ -466,6 +466,11 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) |
2310 | /* <2> work queue */ |
2311 | rtlpriv->works.hw = hw; |
2312 | rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); |
2313 | + if (unlikely(!rtlpriv->works.rtl_wq)) { |
2314 | + pr_err("Failed to allocate work queue\n"); |
2315 | + return; |
2316 | + } |
2317 | + |
2318 | INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, |
2319 | (void *)rtl_watchdog_wq_callback); |
2320 | INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, |
2321 | diff --git a/drivers/net/wireless/st/cw1200/main.c b/drivers/net/wireless/st/cw1200/main.c |
2322 | index dc478cedbde0..84624c812a15 100644 |
2323 | --- a/drivers/net/wireless/st/cw1200/main.c |
2324 | +++ b/drivers/net/wireless/st/cw1200/main.c |
2325 | @@ -345,6 +345,11 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr, |
2326 | mutex_init(&priv->wsm_cmd_mux); |
2327 | mutex_init(&priv->conf_mutex); |
2328 | priv->workqueue = create_singlethread_workqueue("cw1200_wq"); |
2329 | + if (!priv->workqueue) { |
2330 | + ieee80211_free_hw(hw); |
2331 | + return NULL; |
2332 | + } |
2333 | + |
2334 | sema_init(&priv->scan.lock, 1); |
2335 | INIT_WORK(&priv->scan.work, cw1200_scan_work); |
2336 | INIT_DELAYED_WORK(&priv->scan.probe_work, cw1200_probe_work); |
2337 | diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c |
2338 | index 66a089d561cf..9108004a0d9b 100644 |
2339 | --- a/drivers/nvdimm/label.c |
2340 | +++ b/drivers/nvdimm/label.c |
2341 | @@ -490,15 +490,26 @@ static unsigned long nd_label_offset(struct nvdimm_drvdata *ndd, |
2342 | - (unsigned long) to_namespace_index(ndd, 0); |
2343 | } |
2344 | |
2345 | +static void reap_victim(struct nd_mapping *nd_mapping, |
2346 | + struct nd_label_ent *victim) |
2347 | +{ |
2348 | + struct nvdimm_drvdata *ndd = to_ndd(nd_mapping); |
2349 | + u32 slot = to_slot(ndd, victim->label); |
2350 | + |
2351 | + dev_dbg(ndd->dev, "free: %d\n", slot); |
2352 | + nd_label_free_slot(ndd, slot); |
2353 | + victim->label = NULL; |
2354 | +} |
2355 | + |
2356 | static int __pmem_label_update(struct nd_region *nd_region, |
2357 | struct nd_mapping *nd_mapping, struct nd_namespace_pmem *nspm, |
2358 | int pos, unsigned long flags) |
2359 | { |
2360 | u64 cookie = nd_region_interleave_set_cookie(nd_region); |
2361 | struct nvdimm_drvdata *ndd = to_ndd(nd_mapping); |
2362 | - struct nd_label_ent *label_ent, *victim = NULL; |
2363 | struct nd_namespace_label *nd_label; |
2364 | struct nd_namespace_index *nsindex; |
2365 | + struct nd_label_ent *label_ent; |
2366 | struct nd_label_id label_id; |
2367 | struct resource *res; |
2368 | unsigned long *free; |
2369 | @@ -551,18 +562,10 @@ static int __pmem_label_update(struct nd_region *nd_region, |
2370 | list_for_each_entry(label_ent, &nd_mapping->labels, list) { |
2371 | if (!label_ent->label) |
2372 | continue; |
2373 | - if (memcmp(nspm->uuid, label_ent->label->uuid, |
2374 | - NSLABEL_UUID_LEN) != 0) |
2375 | - continue; |
2376 | - victim = label_ent; |
2377 | - list_move_tail(&victim->list, &nd_mapping->labels); |
2378 | - break; |
2379 | - } |
2380 | - if (victim) { |
2381 | - dev_dbg(ndd->dev, "%s: free: %d\n", __func__, slot); |
2382 | - slot = to_slot(ndd, victim->label); |
2383 | - nd_label_free_slot(ndd, slot); |
2384 | - victim->label = NULL; |
2385 | + if (test_and_clear_bit(ND_LABEL_REAP, &label_ent->flags) |
2386 | + || memcmp(nspm->uuid, label_ent->label->uuid, |
2387 | + NSLABEL_UUID_LEN) == 0) |
2388 | + reap_victim(nd_mapping, label_ent); |
2389 | } |
2390 | |
2391 | /* update index */ |
2392 | diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c |
2393 | index cf4a90b50f8b..e83453e1b308 100644 |
2394 | --- a/drivers/nvdimm/namespace_devs.c |
2395 | +++ b/drivers/nvdimm/namespace_devs.c |
2396 | @@ -1210,12 +1210,27 @@ static int namespace_update_uuid(struct nd_region *nd_region, |
2397 | for (i = 0; i < nd_region->ndr_mappings; i++) { |
2398 | struct nd_mapping *nd_mapping = &nd_region->mapping[i]; |
2399 | struct nvdimm_drvdata *ndd = to_ndd(nd_mapping); |
2400 | + struct nd_label_ent *label_ent; |
2401 | struct resource *res; |
2402 | |
2403 | for_each_dpa_resource(ndd, res) |
2404 | if (strcmp(res->name, old_label_id.id) == 0) |
2405 | sprintf((void *) res->name, "%s", |
2406 | new_label_id.id); |
2407 | + |
2408 | + mutex_lock(&nd_mapping->lock); |
2409 | + list_for_each_entry(label_ent, &nd_mapping->labels, list) { |
2410 | + struct nd_namespace_label *nd_label = label_ent->label; |
2411 | + struct nd_label_id label_id; |
2412 | + |
2413 | + if (!nd_label) |
2414 | + continue; |
2415 | + nd_label_gen_id(&label_id, nd_label->uuid, |
2416 | + __le32_to_cpu(nd_label->flags)); |
2417 | + if (strcmp(old_label_id.id, label_id.id) == 0) |
2418 | + set_bit(ND_LABEL_REAP, &label_ent->flags); |
2419 | + } |
2420 | + mutex_unlock(&nd_mapping->lock); |
2421 | } |
2422 | kfree(*old_uuid); |
2423 | out: |
2424 | diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h |
2425 | index d869236b474f..bd29e598bac1 100644 |
2426 | --- a/drivers/nvdimm/nd.h |
2427 | +++ b/drivers/nvdimm/nd.h |
2428 | @@ -113,8 +113,12 @@ struct nd_percpu_lane { |
2429 | spinlock_t lock; |
2430 | }; |
2431 | |
2432 | +enum nd_label_flags { |
2433 | + ND_LABEL_REAP, |
2434 | +}; |
2435 | struct nd_label_ent { |
2436 | struct list_head list; |
2437 | + unsigned long flags; |
2438 | struct nd_namespace_label *label; |
2439 | }; |
2440 | |
2441 | diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c |
2442 | index 55375b1b3cc8..b2b7e238bda9 100644 |
2443 | --- a/drivers/pinctrl/pinctrl-pistachio.c |
2444 | +++ b/drivers/pinctrl/pinctrl-pistachio.c |
2445 | @@ -1368,6 +1368,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) |
2446 | if (!of_find_property(child, "gpio-controller", NULL)) { |
2447 | dev_err(pctl->dev, |
2448 | "No gpio-controller property for bank %u\n", i); |
2449 | + of_node_put(child); |
2450 | ret = -ENODEV; |
2451 | goto err; |
2452 | } |
2453 | @@ -1375,6 +1376,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) |
2454 | irq = irq_of_parse_and_map(child, 0); |
2455 | if (irq < 0) { |
2456 | dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq); |
2457 | + of_node_put(child); |
2458 | ret = irq; |
2459 | goto err; |
2460 | } |
2461 | diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c |
2462 | index 19e53b3b8e00..166faae3a59c 100644 |
2463 | --- a/drivers/rtc/rtc-88pm860x.c |
2464 | +++ b/drivers/rtc/rtc-88pm860x.c |
2465 | @@ -414,7 +414,7 @@ static int pm860x_rtc_remove(struct platform_device *pdev) |
2466 | struct pm860x_rtc_info *info = platform_get_drvdata(pdev); |
2467 | |
2468 | #ifdef VRTC_CALIBRATION |
2469 | - flush_scheduled_work(); |
2470 | + cancel_delayed_work_sync(&info->calib_work); |
2471 | /* disable measurement */ |
2472 | pm860x_set_bits(info->i2c, PM8607_MEAS_EN2, MEAS2_VRTC, 0); |
2473 | #endif /* VRTC_CALIBRATION */ |
2474 | diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h |
2475 | index f0e57aefb5f2..d167652a6a23 100644 |
2476 | --- a/drivers/s390/cio/cio.h |
2477 | +++ b/drivers/s390/cio/cio.h |
2478 | @@ -114,7 +114,7 @@ struct subchannel { |
2479 | struct schib_config config; |
2480 | } __attribute__ ((aligned(8))); |
2481 | |
2482 | -DECLARE_PER_CPU(struct irb, cio_irb); |
2483 | +DECLARE_PER_CPU_ALIGNED(struct irb, cio_irb); |
2484 | |
2485 | #define to_subchannel(n) container_of(n, struct subchannel, dev) |
2486 | |
2487 | diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c |
2488 | index 1a6f65db615e..ee1f9ee995e5 100644 |
2489 | --- a/drivers/scsi/libsas/sas_expander.c |
2490 | +++ b/drivers/scsi/libsas/sas_expander.c |
2491 | @@ -2027,6 +2027,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) |
2492 | if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { |
2493 | phy->phy_state = PHY_EMPTY; |
2494 | sas_unregister_devs_sas_addr(dev, phy_id, last); |
2495 | + /* |
2496 | + * Even though the PHY is empty, for convenience we discover |
2497 | + * the PHY to update the PHY info, like negotiated linkrate. |
2498 | + */ |
2499 | + sas_ex_phy_discover(dev, phy_id); |
2500 | return res; |
2501 | } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) && |
2502 | dev_type_flutter(type, phy->attached_dev_type)) { |
2503 | diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c |
2504 | index 4ac03b16d17f..52afbcff362f 100644 |
2505 | --- a/drivers/scsi/lpfc/lpfc_ct.c |
2506 | +++ b/drivers/scsi/lpfc/lpfc_ct.c |
2507 | @@ -1561,6 +1561,9 @@ lpfc_fdmi_hba_attr_manufacturer(struct lpfc_vport *vport, |
2508 | ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; |
2509 | memset(ae, 0, 256); |
2510 | |
2511 | + /* This string MUST be consistent with other FC platforms |
2512 | + * supported by Broadcom. |
2513 | + */ |
2514 | strncpy(ae->un.AttrString, |
2515 | "Emulex Corporation", |
2516 | sizeof(ae->un.AttrString)); |
2517 | diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c |
2518 | index 81736457328a..9cca5ddbc50c 100644 |
2519 | --- a/drivers/scsi/lpfc/lpfc_hbadisc.c |
2520 | +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c |
2521 | @@ -901,7 +901,11 @@ lpfc_linkdown(struct lpfc_hba *phba) |
2522 | lpfc_linkdown_port(vports[i]); |
2523 | } |
2524 | lpfc_destroy_vport_work_array(phba, vports); |
2525 | - /* Clean up any firmware default rpi's */ |
2526 | + |
2527 | + /* Clean up any SLI3 firmware default rpi's */ |
2528 | + if (phba->sli_rev > LPFC_SLI_REV3) |
2529 | + goto skip_unreg_did; |
2530 | + |
2531 | mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
2532 | if (mb) { |
2533 | lpfc_unreg_did(phba, 0xffff, LPFC_UNREG_ALL_DFLT_RPIS, mb); |
2534 | @@ -913,6 +917,7 @@ lpfc_linkdown(struct lpfc_hba *phba) |
2535 | } |
2536 | } |
2537 | |
2538 | + skip_unreg_did: |
2539 | /* Setup myDID for link up if we are in pt2pt mode */ |
2540 | if (phba->pport->fc_flag & FC_PT2PT) { |
2541 | phba->pport->fc_myDID = 0; |
2542 | @@ -4654,6 +4659,10 @@ lpfc_unreg_default_rpis(struct lpfc_vport *vport) |
2543 | LPFC_MBOXQ_t *mbox; |
2544 | int rc; |
2545 | |
2546 | + /* Unreg DID is an SLI3 operation. */ |
2547 | + if (phba->sli_rev > LPFC_SLI_REV3) |
2548 | + return; |
2549 | + |
2550 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
2551 | if (mbox) { |
2552 | lpfc_unreg_did(phba, vport->vpi, LPFC_UNREG_ALL_DFLT_RPIS, |
2553 | diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c |
2554 | index 73c99f237b10..f0fcff032f8a 100644 |
2555 | --- a/drivers/scsi/qla2xxx/qla_isr.c |
2556 | +++ b/drivers/scsi/qla2xxx/qla_isr.c |
2557 | @@ -3089,7 +3089,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) |
2558 | ql_log(ql_log_fatal, vha, 0x00c8, |
2559 | "Failed to allocate memory for ha->msix_entries.\n"); |
2560 | ret = -ENOMEM; |
2561 | - goto msix_out; |
2562 | + goto free_irqs; |
2563 | } |
2564 | ha->flags.msix_enabled = 1; |
2565 | |
2566 | @@ -3177,6 +3177,10 @@ msix_register_fail: |
2567 | msix_out: |
2568 | kfree(entries); |
2569 | return ret; |
2570 | + |
2571 | +free_irqs: |
2572 | + pci_free_irq_vectors(ha->pdev); |
2573 | + goto msix_out; |
2574 | } |
2575 | |
2576 | int |
2577 | diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c |
2578 | index c158967b59d7..d220b4f691c7 100644 |
2579 | --- a/drivers/scsi/qla4xxx/ql4_os.c |
2580 | +++ b/drivers/scsi/qla4xxx/ql4_os.c |
2581 | @@ -5939,7 +5939,7 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[]) |
2582 | val = rd_nvram_byte(ha, sec_addr); |
2583 | if (val & BIT_7) |
2584 | ddb_index[1] = (val & 0x7f); |
2585 | - |
2586 | + goto exit_boot_info; |
2587 | } else if (is_qla80XX(ha)) { |
2588 | buf = dma_alloc_coherent(&ha->pdev->dev, size, |
2589 | &buf_dma, GFP_KERNEL); |
2590 | diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
2591 | index 58345d3d4682..b40fe8d583c0 100644 |
2592 | --- a/drivers/scsi/sd.c |
2593 | +++ b/drivers/scsi/sd.c |
2594 | @@ -2403,7 +2403,6 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) |
2595 | int res; |
2596 | struct scsi_device *sdp = sdkp->device; |
2597 | struct scsi_mode_data data; |
2598 | - int disk_ro = get_disk_ro(sdkp->disk); |
2599 | int old_wp = sdkp->write_prot; |
2600 | |
2601 | set_disk_ro(sdkp->disk, 0); |
2602 | @@ -2444,7 +2443,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) |
2603 | "Test WP failed, assume Write Enabled\n"); |
2604 | } else { |
2605 | sdkp->write_prot = ((data.device_specific & 0x80) != 0); |
2606 | - set_disk_ro(sdkp->disk, sdkp->write_prot || disk_ro); |
2607 | + set_disk_ro(sdkp->disk, sdkp->write_prot); |
2608 | if (sdkp->first_scan || old_wp != sdkp->write_prot) { |
2609 | sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", |
2610 | sdkp->write_prot ? "on" : "off"); |
2611 | diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
2612 | index 0b858414c558..0fe4f8e8c8c9 100644 |
2613 | --- a/drivers/scsi/ufs/ufshcd.c |
2614 | +++ b/drivers/scsi/ufs/ufshcd.c |
2615 | @@ -4875,19 +4875,19 @@ static u32 ufshcd_find_max_sup_active_icc_level(struct ufs_hba *hba, |
2616 | goto out; |
2617 | } |
2618 | |
2619 | - if (hba->vreg_info.vcc) |
2620 | + if (hba->vreg_info.vcc && hba->vreg_info.vcc->max_uA) |
2621 | icc_level = ufshcd_get_max_icc_level( |
2622 | hba->vreg_info.vcc->max_uA, |
2623 | POWER_DESC_MAX_ACTV_ICC_LVLS - 1, |
2624 | &desc_buf[PWR_DESC_ACTIVE_LVLS_VCC_0]); |
2625 | |
2626 | - if (hba->vreg_info.vccq) |
2627 | + if (hba->vreg_info.vccq && hba->vreg_info.vccq->max_uA) |
2628 | icc_level = ufshcd_get_max_icc_level( |
2629 | hba->vreg_info.vccq->max_uA, |
2630 | icc_level, |
2631 | &desc_buf[PWR_DESC_ACTIVE_LVLS_VCCQ_0]); |
2632 | |
2633 | - if (hba->vreg_info.vccq2) |
2634 | + if (hba->vreg_info.vccq2 && hba->vreg_info.vccq2->max_uA) |
2635 | icc_level = ufshcd_get_max_icc_level( |
2636 | hba->vreg_info.vccq2->max_uA, |
2637 | icc_level, |
2638 | @@ -5449,6 +5449,15 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, |
2639 | if (!vreg) |
2640 | return 0; |
2641 | |
2642 | + /* |
2643 | + * "set_load" operation shall be required on those regulators |
2644 | + * which specifically configured current limitation. Otherwise |
2645 | + * zero max_uA may cause unexpected behavior when regulator is |
2646 | + * enabled or set as high power mode. |
2647 | + */ |
2648 | + if (!vreg->max_uA) |
2649 | + return 0; |
2650 | + |
2651 | ret = regulator_set_load(vreg->reg, ua); |
2652 | if (ret < 0) { |
2653 | dev_err(dev, "%s: %s set load (ua=%d) failed, err=%d\n", |
2654 | @@ -5495,12 +5504,15 @@ static int ufshcd_config_vreg(struct device *dev, |
2655 | name = vreg->name; |
2656 | |
2657 | if (regulator_count_voltages(reg) > 0) { |
2658 | - min_uV = on ? vreg->min_uV : 0; |
2659 | - ret = regulator_set_voltage(reg, min_uV, vreg->max_uV); |
2660 | - if (ret) { |
2661 | - dev_err(dev, "%s: %s set voltage failed, err=%d\n", |
2662 | + if (vreg->min_uV && vreg->max_uV) { |
2663 | + min_uV = on ? vreg->min_uV : 0; |
2664 | + ret = regulator_set_voltage(reg, min_uV, vreg->max_uV); |
2665 | + if (ret) { |
2666 | + dev_err(dev, |
2667 | + "%s: %s set voltage failed, err=%d\n", |
2668 | __func__, name, ret); |
2669 | - goto out; |
2670 | + goto out; |
2671 | + } |
2672 | } |
2673 | |
2674 | uA_load = on ? vreg->max_uA : 0; |
2675 | diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
2676 | index f2209ec4cb68..8b618f0fa459 100644 |
2677 | --- a/drivers/spi/spi-pxa2xx.c |
2678 | +++ b/drivers/spi/spi-pxa2xx.c |
2679 | @@ -921,10 +921,14 @@ static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate) |
2680 | |
2681 | rate = min_t(int, ssp_clk, rate); |
2682 | |
2683 | + /* |
2684 | + * Calculate the divisor for the SCR (Serial Clock Rate), avoiding |
2685 | + * that the SSP transmission rate can be greater than the device rate |
2686 | + */ |
2687 | if (ssp->type == PXA25x_SSP || ssp->type == CE4100_SSP) |
2688 | - return (ssp_clk / (2 * rate) - 1) & 0xff; |
2689 | + return (DIV_ROUND_UP(ssp_clk, 2 * rate) - 1) & 0xff; |
2690 | else |
2691 | - return (ssp_clk / rate - 1) & 0xfff; |
2692 | + return (DIV_ROUND_UP(ssp_clk, rate) - 1) & 0xfff; |
2693 | } |
2694 | |
2695 | static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, |
2696 | diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c |
2697 | index 093c9cf92bfd..07612e8c58ee 100644 |
2698 | --- a/drivers/spi/spi-rspi.c |
2699 | +++ b/drivers/spi/spi-rspi.c |
2700 | @@ -279,7 +279,8 @@ static int rspi_set_config_register(struct rspi_data *rspi, int access_size) |
2701 | /* Sets parity, interrupt mask */ |
2702 | rspi_write8(rspi, 0x00, RSPI_SPCR2); |
2703 | |
2704 | - /* Sets SPCMD */ |
2705 | + /* Resets sequencer */ |
2706 | + rspi_write8(rspi, 0, RSPI_SPSCR); |
2707 | rspi->spcmd |= SPCMD_SPB_8_TO_16(access_size); |
2708 | rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
2709 | |
2710 | @@ -323,7 +324,8 @@ static int rspi_rz_set_config_register(struct rspi_data *rspi, int access_size) |
2711 | rspi_write8(rspi, 0x00, RSPI_SSLND); |
2712 | rspi_write8(rspi, 0x00, RSPI_SPND); |
2713 | |
2714 | - /* Sets SPCMD */ |
2715 | + /* Resets sequencer */ |
2716 | + rspi_write8(rspi, 0, RSPI_SPSCR); |
2717 | rspi->spcmd |= SPCMD_SPB_8_TO_16(access_size); |
2718 | rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
2719 | |
2720 | @@ -374,7 +376,8 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size) |
2721 | /* Sets buffer to allow normal operation */ |
2722 | rspi_write8(rspi, 0x00, QSPI_SPBFCR); |
2723 | |
2724 | - /* Sets SPCMD */ |
2725 | + /* Resets sequencer */ |
2726 | + rspi_write8(rspi, 0, RSPI_SPSCR); |
2727 | rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
2728 | |
2729 | /* Enables SPI function in master mode */ |
2730 | diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c |
2731 | index 73779cecc3bb..705f515863d4 100644 |
2732 | --- a/drivers/spi/spi-tegra114.c |
2733 | +++ b/drivers/spi/spi-tegra114.c |
2734 | @@ -1067,27 +1067,19 @@ static int tegra_spi_probe(struct platform_device *pdev) |
2735 | |
2736 | spi_irq = platform_get_irq(pdev, 0); |
2737 | tspi->irq = spi_irq; |
2738 | - ret = request_threaded_irq(tspi->irq, tegra_spi_isr, |
2739 | - tegra_spi_isr_thread, IRQF_ONESHOT, |
2740 | - dev_name(&pdev->dev), tspi); |
2741 | - if (ret < 0) { |
2742 | - dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n", |
2743 | - tspi->irq); |
2744 | - goto exit_free_master; |
2745 | - } |
2746 | |
2747 | tspi->clk = devm_clk_get(&pdev->dev, "spi"); |
2748 | if (IS_ERR(tspi->clk)) { |
2749 | dev_err(&pdev->dev, "can not get clock\n"); |
2750 | ret = PTR_ERR(tspi->clk); |
2751 | - goto exit_free_irq; |
2752 | + goto exit_free_master; |
2753 | } |
2754 | |
2755 | tspi->rst = devm_reset_control_get(&pdev->dev, "spi"); |
2756 | if (IS_ERR(tspi->rst)) { |
2757 | dev_err(&pdev->dev, "can not get reset\n"); |
2758 | ret = PTR_ERR(tspi->rst); |
2759 | - goto exit_free_irq; |
2760 | + goto exit_free_master; |
2761 | } |
2762 | |
2763 | tspi->max_buf_size = SPI_FIFO_DEPTH << 2; |
2764 | @@ -1095,7 +1087,7 @@ static int tegra_spi_probe(struct platform_device *pdev) |
2765 | |
2766 | ret = tegra_spi_init_dma_param(tspi, true); |
2767 | if (ret < 0) |
2768 | - goto exit_free_irq; |
2769 | + goto exit_free_master; |
2770 | ret = tegra_spi_init_dma_param(tspi, false); |
2771 | if (ret < 0) |
2772 | goto exit_rx_dma_free; |
2773 | @@ -1117,18 +1109,32 @@ static int tegra_spi_probe(struct platform_device *pdev) |
2774 | dev_err(&pdev->dev, "pm runtime get failed, e = %d\n", ret); |
2775 | goto exit_pm_disable; |
2776 | } |
2777 | + |
2778 | + reset_control_assert(tspi->rst); |
2779 | + udelay(2); |
2780 | + reset_control_deassert(tspi->rst); |
2781 | tspi->def_command1_reg = SPI_M_S; |
2782 | tegra_spi_writel(tspi, tspi->def_command1_reg, SPI_COMMAND1); |
2783 | pm_runtime_put(&pdev->dev); |
2784 | + ret = request_threaded_irq(tspi->irq, tegra_spi_isr, |
2785 | + tegra_spi_isr_thread, IRQF_ONESHOT, |
2786 | + dev_name(&pdev->dev), tspi); |
2787 | + if (ret < 0) { |
2788 | + dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n", |
2789 | + tspi->irq); |
2790 | + goto exit_pm_disable; |
2791 | + } |
2792 | |
2793 | master->dev.of_node = pdev->dev.of_node; |
2794 | ret = devm_spi_register_master(&pdev->dev, master); |
2795 | if (ret < 0) { |
2796 | dev_err(&pdev->dev, "can not register to master err %d\n", ret); |
2797 | - goto exit_pm_disable; |
2798 | + goto exit_free_irq; |
2799 | } |
2800 | return ret; |
2801 | |
2802 | +exit_free_irq: |
2803 | + free_irq(spi_irq, tspi); |
2804 | exit_pm_disable: |
2805 | pm_runtime_disable(&pdev->dev); |
2806 | if (!pm_runtime_status_suspended(&pdev->dev)) |
2807 | @@ -1136,8 +1142,6 @@ exit_pm_disable: |
2808 | tegra_spi_deinit_dma_param(tspi, false); |
2809 | exit_rx_dma_free: |
2810 | tegra_spi_deinit_dma_param(tspi, true); |
2811 | -exit_free_irq: |
2812 | - free_irq(spi_irq, tspi); |
2813 | exit_free_master: |
2814 | spi_master_put(master); |
2815 | return ret; |
2816 | diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c |
2817 | index c54ee6674471..fe707440f8c3 100644 |
2818 | --- a/drivers/spi/spi-topcliff-pch.c |
2819 | +++ b/drivers/spi/spi-topcliff-pch.c |
2820 | @@ -1306,18 +1306,27 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat, |
2821 | return; |
2822 | } |
2823 | |
2824 | -static void pch_alloc_dma_buf(struct pch_spi_board_data *board_dat, |
2825 | +static int pch_alloc_dma_buf(struct pch_spi_board_data *board_dat, |
2826 | struct pch_spi_data *data) |
2827 | { |
2828 | struct pch_spi_dma_ctrl *dma; |
2829 | + int ret; |
2830 | |
2831 | dma = &data->dma; |
2832 | + ret = 0; |
2833 | /* Get Consistent memory for Tx DMA */ |
2834 | dma->tx_buf_virt = dma_alloc_coherent(&board_dat->pdev->dev, |
2835 | PCH_BUF_SIZE, &dma->tx_buf_dma, GFP_KERNEL); |
2836 | + if (!dma->tx_buf_virt) |
2837 | + ret = -ENOMEM; |
2838 | + |
2839 | /* Get Consistent memory for Rx DMA */ |
2840 | dma->rx_buf_virt = dma_alloc_coherent(&board_dat->pdev->dev, |
2841 | PCH_BUF_SIZE, &dma->rx_buf_dma, GFP_KERNEL); |
2842 | + if (!dma->rx_buf_virt) |
2843 | + ret = -ENOMEM; |
2844 | + |
2845 | + return ret; |
2846 | } |
2847 | |
2848 | static int pch_spi_pd_probe(struct platform_device *plat_dev) |
2849 | @@ -1394,7 +1403,9 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev) |
2850 | |
2851 | if (use_dma) { |
2852 | dev_info(&plat_dev->dev, "Use DMA for data transfers\n"); |
2853 | - pch_alloc_dma_buf(board_dat, data); |
2854 | + ret = pch_alloc_dma_buf(board_dat, data); |
2855 | + if (ret) |
2856 | + goto err_spi_register_master; |
2857 | } |
2858 | |
2859 | ret = spi_register_master(master); |
2860 | diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
2861 | index c2e85e23d538..d74d341f9890 100644 |
2862 | --- a/drivers/spi/spi.c |
2863 | +++ b/drivers/spi/spi.c |
2864 | @@ -955,6 +955,8 @@ static int spi_map_msg(struct spi_master *master, struct spi_message *msg) |
2865 | if (max_tx || max_rx) { |
2866 | list_for_each_entry(xfer, &msg->transfers, |
2867 | transfer_list) { |
2868 | + if (!xfer->len) |
2869 | + continue; |
2870 | if (!xfer->tx_buf) |
2871 | xfer->tx_buf = master->dummy_tx; |
2872 | if (!xfer->rx_buf) |
2873 | diff --git a/drivers/ssb/bridge_pcmcia_80211.c b/drivers/ssb/bridge_pcmcia_80211.c |
2874 | index d70568ea02d5..2ff7d90e166a 100644 |
2875 | --- a/drivers/ssb/bridge_pcmcia_80211.c |
2876 | +++ b/drivers/ssb/bridge_pcmcia_80211.c |
2877 | @@ -113,16 +113,21 @@ static struct pcmcia_driver ssb_host_pcmcia_driver = { |
2878 | .resume = ssb_host_pcmcia_resume, |
2879 | }; |
2880 | |
2881 | +static int pcmcia_init_failed; |
2882 | + |
2883 | /* |
2884 | * These are not module init/exit functions! |
2885 | * The module_pcmcia_driver() helper cannot be used here. |
2886 | */ |
2887 | int ssb_host_pcmcia_init(void) |
2888 | { |
2889 | - return pcmcia_register_driver(&ssb_host_pcmcia_driver); |
2890 | + pcmcia_init_failed = pcmcia_register_driver(&ssb_host_pcmcia_driver); |
2891 | + |
2892 | + return pcmcia_init_failed; |
2893 | } |
2894 | |
2895 | void ssb_host_pcmcia_exit(void) |
2896 | { |
2897 | - pcmcia_unregister_driver(&ssb_host_pcmcia_driver); |
2898 | + if (!pcmcia_init_failed) |
2899 | + pcmcia_unregister_driver(&ssb_host_pcmcia_driver); |
2900 | } |
2901 | diff --git a/drivers/tty/ipwireless/main.c b/drivers/tty/ipwireless/main.c |
2902 | index 655c7948261c..2fa4f9123469 100644 |
2903 | --- a/drivers/tty/ipwireless/main.c |
2904 | +++ b/drivers/tty/ipwireless/main.c |
2905 | @@ -113,6 +113,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) |
2906 | |
2907 | ipw->common_memory = ioremap(p_dev->resource[2]->start, |
2908 | resource_size(p_dev->resource[2])); |
2909 | + if (!ipw->common_memory) { |
2910 | + ret = -ENOMEM; |
2911 | + goto exit1; |
2912 | + } |
2913 | if (!request_mem_region(p_dev->resource[2]->start, |
2914 | resource_size(p_dev->resource[2]), |
2915 | IPWIRELESS_PCCARD_NAME)) { |
2916 | @@ -133,6 +137,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) |
2917 | |
2918 | ipw->attr_memory = ioremap(p_dev->resource[3]->start, |
2919 | resource_size(p_dev->resource[3])); |
2920 | + if (!ipw->attr_memory) { |
2921 | + ret = -ENOMEM; |
2922 | + goto exit3; |
2923 | + } |
2924 | if (!request_mem_region(p_dev->resource[3]->start, |
2925 | resource_size(p_dev->resource[3]), |
2926 | IPWIRELESS_PCCARD_NAME)) { |
2927 | diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
2928 | index bdb0d7a08ff9..1dd4c65e9188 100644 |
2929 | --- a/drivers/usb/core/hcd.c |
2930 | +++ b/drivers/usb/core/hcd.c |
2931 | @@ -3033,6 +3033,9 @@ usb_hcd_platform_shutdown(struct platform_device *dev) |
2932 | { |
2933 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
2934 | |
2935 | + /* No need for pm_runtime_put(), we're shutting down */ |
2936 | + pm_runtime_get_sync(&dev->dev); |
2937 | + |
2938 | if (hcd->driver->shutdown) |
2939 | hcd->driver->shutdown(hcd); |
2940 | } |
2941 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
2942 | index 8fddb94f1874..3941df076cca 100644 |
2943 | --- a/drivers/usb/core/hub.c |
2944 | +++ b/drivers/usb/core/hub.c |
2945 | @@ -5703,7 +5703,10 @@ int usb_reset_device(struct usb_device *udev) |
2946 | cintf->needs_binding = 1; |
2947 | } |
2948 | } |
2949 | - usb_unbind_and_rebind_marked_interfaces(udev); |
2950 | + |
2951 | + /* If the reset failed, hub_wq will unbind drivers later */ |
2952 | + if (ret == 0) |
2953 | + usb_unbind_and_rebind_marked_interfaces(udev); |
2954 | } |
2955 | |
2956 | usb_autosuspend_device(udev); |
2957 | diff --git a/drivers/video/fbdev/core/fbcmap.c b/drivers/video/fbdev/core/fbcmap.c |
2958 | index 68a113594808..2811c4afde01 100644 |
2959 | --- a/drivers/video/fbdev/core/fbcmap.c |
2960 | +++ b/drivers/video/fbdev/core/fbcmap.c |
2961 | @@ -94,6 +94,8 @@ int fb_alloc_cmap_gfp(struct fb_cmap *cmap, int len, int transp, gfp_t flags) |
2962 | int size = len * sizeof(u16); |
2963 | int ret = -ENOMEM; |
2964 | |
2965 | + flags |= __GFP_NOWARN; |
2966 | + |
2967 | if (cmap->len != len) { |
2968 | fb_dealloc_cmap(cmap); |
2969 | if (!len) |
2970 | diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c |
2971 | index de119f11b78f..455a15f70172 100644 |
2972 | --- a/drivers/video/fbdev/core/modedb.c |
2973 | +++ b/drivers/video/fbdev/core/modedb.c |
2974 | @@ -933,6 +933,9 @@ void fb_var_to_videomode(struct fb_videomode *mode, |
2975 | if (var->vmode & FB_VMODE_DOUBLE) |
2976 | vtotal *= 2; |
2977 | |
2978 | + if (!htotal || !vtotal) |
2979 | + return; |
2980 | + |
2981 | hfreq = pixclock/htotal; |
2982 | mode->refresh = hfreq/vtotal; |
2983 | } |
2984 | diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c |
2985 | index f4bc8c100a01..a3ac582420ec 100644 |
2986 | --- a/drivers/w1/w1_io.c |
2987 | +++ b/drivers/w1/w1_io.c |
2988 | @@ -437,8 +437,7 @@ int w1_reset_resume_command(struct w1_master *dev) |
2989 | if (w1_reset_bus(dev)) |
2990 | return -1; |
2991 | |
2992 | - /* This will make only the last matched slave perform a skip ROM. */ |
2993 | - w1_write_8(dev, W1_RESUME_CMD); |
2994 | + w1_write_8(dev, dev->slave_count > 1 ? W1_RESUME_CMD : W1_SKIP_ROM); |
2995 | return 0; |
2996 | } |
2997 | EXPORT_SYMBOL_GPL(w1_reset_resume_command); |
2998 | diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
2999 | index 6b29165f766f..7938c48c72ff 100644 |
3000 | --- a/fs/btrfs/extent-tree.c |
3001 | +++ b/fs/btrfs/extent-tree.c |
3002 | @@ -11150,9 +11150,9 @@ int btrfs_error_unpin_extent_range(struct btrfs_root *root, u64 start, u64 end) |
3003 | * transaction. |
3004 | */ |
3005 | static int btrfs_trim_free_extents(struct btrfs_device *device, |
3006 | - struct fstrim_range *range, u64 *trimmed) |
3007 | + u64 minlen, u64 *trimmed) |
3008 | { |
3009 | - u64 start = range->start, len = 0; |
3010 | + u64 start = 0, len = 0; |
3011 | int ret; |
3012 | |
3013 | *trimmed = 0; |
3014 | @@ -11188,8 +11188,8 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, |
3015 | atomic_inc(&trans->use_count); |
3016 | spin_unlock(&fs_info->trans_lock); |
3017 | |
3018 | - ret = find_free_dev_extent_start(trans, device, range->minlen, |
3019 | - start, &start, &len); |
3020 | + ret = find_free_dev_extent_start(trans, device, minlen, start, |
3021 | + &start, &len); |
3022 | if (trans) |
3023 | btrfs_put_transaction(trans); |
3024 | |
3025 | @@ -11201,16 +11201,6 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, |
3026 | break; |
3027 | } |
3028 | |
3029 | - /* If we are out of the passed range break */ |
3030 | - if (start > range->start + range->len - 1) { |
3031 | - mutex_unlock(&fs_info->chunk_mutex); |
3032 | - ret = 0; |
3033 | - break; |
3034 | - } |
3035 | - |
3036 | - start = max(range->start, start); |
3037 | - len = min(range->len, len); |
3038 | - |
3039 | ret = btrfs_issue_discard(device->bdev, start, len, &bytes); |
3040 | up_read(&fs_info->commit_root_sem); |
3041 | mutex_unlock(&fs_info->chunk_mutex); |
3042 | @@ -11221,10 +11211,6 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, |
3043 | start += len; |
3044 | *trimmed += bytes; |
3045 | |
3046 | - /* We've trimmed enough */ |
3047 | - if (*trimmed >= range->len) |
3048 | - break; |
3049 | - |
3050 | if (fatal_signal_pending(current)) { |
3051 | ret = -ERESTARTSYS; |
3052 | break; |
3053 | @@ -11309,7 +11295,8 @@ int btrfs_trim_fs(struct btrfs_root *root, struct fstrim_range *range) |
3054 | mutex_lock(&fs_info->fs_devices->device_list_mutex); |
3055 | devices = &fs_info->fs_devices->devices; |
3056 | list_for_each_entry(device, devices, dev_list) { |
3057 | - ret = btrfs_trim_free_extents(device, range, &group_trimmed); |
3058 | + ret = btrfs_trim_free_extents(device, range->minlen, |
3059 | + &group_trimmed); |
3060 | if (ret) { |
3061 | dev_failed++; |
3062 | dev_ret = ret; |
3063 | diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
3064 | index 437544846e4e..c77114ce884b 100644 |
3065 | --- a/fs/btrfs/file.c |
3066 | +++ b/fs/btrfs/file.c |
3067 | @@ -1951,6 +1951,18 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
3068 | bool full_sync = 0; |
3069 | u64 len; |
3070 | |
3071 | + /* |
3072 | + * If the inode needs a full sync, make sure we use a full range to |
3073 | + * avoid log tree corruption, due to hole detection racing with ordered |
3074 | + * extent completion for adjacent ranges, and assertion failures during |
3075 | + * hole detection. |
3076 | + */ |
3077 | + if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, |
3078 | + &BTRFS_I(inode)->runtime_flags)) { |
3079 | + start = 0; |
3080 | + end = LLONG_MAX; |
3081 | + } |
3082 | + |
3083 | /* |
3084 | * The range length can be represented by u64, we have to do the typecasts |
3085 | * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync() |
3086 | diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c |
3087 | index edae751e870c..307b8baaf0e9 100644 |
3088 | --- a/fs/btrfs/root-tree.c |
3089 | +++ b/fs/btrfs/root-tree.c |
3090 | @@ -144,10 +144,8 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root |
3091 | return -ENOMEM; |
3092 | |
3093 | ret = btrfs_search_slot(trans, root, key, path, 0, 1); |
3094 | - if (ret < 0) { |
3095 | - btrfs_abort_transaction(trans, ret); |
3096 | + if (ret < 0) |
3097 | goto out; |
3098 | - } |
3099 | |
3100 | if (ret != 0) { |
3101 | btrfs_print_leaf(root, path->nodes[0]); |
3102 | diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c |
3103 | index 1f157fba8940..510cad48e519 100644 |
3104 | --- a/fs/btrfs/sysfs.c |
3105 | +++ b/fs/btrfs/sysfs.c |
3106 | @@ -751,7 +751,12 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs, |
3107 | fs_devs->fsid_kobj.kset = btrfs_kset; |
3108 | error = kobject_init_and_add(&fs_devs->fsid_kobj, |
3109 | &btrfs_ktype, parent, "%pU", fs_devs->fsid); |
3110 | - return error; |
3111 | + if (error) { |
3112 | + kobject_put(&fs_devs->fsid_kobj); |
3113 | + return error; |
3114 | + } |
3115 | + |
3116 | + return 0; |
3117 | } |
3118 | |
3119 | int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info) |
3120 | diff --git a/fs/char_dev.c b/fs/char_dev.c |
3121 | index 44a240c4bb65..a112a4745d8b 100644 |
3122 | --- a/fs/char_dev.c |
3123 | +++ b/fs/char_dev.c |
3124 | @@ -134,6 +134,12 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor, |
3125 | ret = -EBUSY; |
3126 | goto out; |
3127 | } |
3128 | + |
3129 | + if (new_min < old_min && new_max > old_max) { |
3130 | + ret = -EBUSY; |
3131 | + goto out; |
3132 | + } |
3133 | + |
3134 | } |
3135 | |
3136 | cd->next = *cp; |
3137 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
3138 | index 4815be26b15f..b8046182efb0 100644 |
3139 | --- a/fs/ext4/inode.c |
3140 | +++ b/fs/ext4/inode.c |
3141 | @@ -5223,7 +5223,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) |
3142 | up_write(&EXT4_I(inode)->i_data_sem); |
3143 | ext4_journal_stop(handle); |
3144 | if (error) { |
3145 | - if (orphan) |
3146 | + if (orphan && inode->i_nlink) |
3147 | ext4_orphan_del(NULL, inode); |
3148 | goto err_out; |
3149 | } |
3150 | diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c |
3151 | index 7a8b1d72e3d9..efd44d5645d8 100644 |
3152 | --- a/fs/gfs2/glock.c |
3153 | +++ b/fs/gfs2/glock.c |
3154 | @@ -136,22 +136,26 @@ static int demote_ok(const struct gfs2_glock *gl) |
3155 | |
3156 | void gfs2_glock_add_to_lru(struct gfs2_glock *gl) |
3157 | { |
3158 | + if (!(gl->gl_ops->go_flags & GLOF_LRU)) |
3159 | + return; |
3160 | + |
3161 | spin_lock(&lru_lock); |
3162 | |
3163 | - if (!list_empty(&gl->gl_lru)) |
3164 | - list_del_init(&gl->gl_lru); |
3165 | - else |
3166 | + list_del(&gl->gl_lru); |
3167 | + list_add_tail(&gl->gl_lru, &lru_list); |
3168 | + |
3169 | + if (!test_bit(GLF_LRU, &gl->gl_flags)) { |
3170 | + set_bit(GLF_LRU, &gl->gl_flags); |
3171 | atomic_inc(&lru_count); |
3172 | + } |
3173 | |
3174 | - list_add_tail(&gl->gl_lru, &lru_list); |
3175 | - set_bit(GLF_LRU, &gl->gl_flags); |
3176 | spin_unlock(&lru_lock); |
3177 | } |
3178 | |
3179 | static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl) |
3180 | { |
3181 | spin_lock(&lru_lock); |
3182 | - if (!list_empty(&gl->gl_lru)) { |
3183 | + if (test_bit(GLF_LRU, &gl->gl_flags)) { |
3184 | list_del_init(&gl->gl_lru); |
3185 | atomic_dec(&lru_count); |
3186 | clear_bit(GLF_LRU, &gl->gl_flags); |
3187 | @@ -1048,8 +1052,7 @@ void gfs2_glock_dq(struct gfs2_holder *gh) |
3188 | !test_bit(GLF_DEMOTE, &gl->gl_flags)) |
3189 | fast_path = 1; |
3190 | } |
3191 | - if (!test_bit(GLF_LFLUSH, &gl->gl_flags) && demote_ok(gl) && |
3192 | - (glops->go_flags & GLOF_LRU)) |
3193 | + if (!test_bit(GLF_LFLUSH, &gl->gl_flags) && demote_ok(gl)) |
3194 | gfs2_glock_add_to_lru(gl); |
3195 | |
3196 | trace_gfs2_glock_queue(gh, 0); |
3197 | @@ -1349,6 +1352,7 @@ __acquires(&lru_lock) |
3198 | if (!spin_trylock(&gl->gl_lockref.lock)) { |
3199 | add_back_to_lru: |
3200 | list_add(&gl->gl_lru, &lru_list); |
3201 | + set_bit(GLF_LRU, &gl->gl_flags); |
3202 | atomic_inc(&lru_count); |
3203 | continue; |
3204 | } |
3205 | @@ -1356,7 +1360,6 @@ add_back_to_lru: |
3206 | spin_unlock(&gl->gl_lockref.lock); |
3207 | goto add_back_to_lru; |
3208 | } |
3209 | - clear_bit(GLF_LRU, &gl->gl_flags); |
3210 | gl->gl_lockref.count++; |
3211 | if (demote_ok(gl)) |
3212 | handle_callback(gl, LM_ST_UNLOCKED, 0, false); |
3213 | @@ -1392,6 +1395,7 @@ static long gfs2_scan_glock_lru(int nr) |
3214 | if (!test_bit(GLF_LOCK, &gl->gl_flags)) { |
3215 | list_move(&gl->gl_lru, &dispose); |
3216 | atomic_dec(&lru_count); |
3217 | + clear_bit(GLF_LRU, &gl->gl_flags); |
3218 | freed++; |
3219 | continue; |
3220 | } |
3221 | diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c |
3222 | index 8b907c5cc913..3c3d037df824 100644 |
3223 | --- a/fs/gfs2/lock_dlm.c |
3224 | +++ b/fs/gfs2/lock_dlm.c |
3225 | @@ -32,9 +32,10 @@ extern struct workqueue_struct *gfs2_control_wq; |
3226 | * @delta is the difference between the current rtt sample and the |
3227 | * running average srtt. We add 1/8 of that to the srtt in order to |
3228 | * update the current srtt estimate. The variance estimate is a bit |
3229 | - * more complicated. We subtract the abs value of the @delta from |
3230 | - * the current variance estimate and add 1/4 of that to the running |
3231 | - * total. |
3232 | + * more complicated. We subtract the current variance estimate from |
3233 | + * the abs value of the @delta and add 1/4 of that to the running |
3234 | + * total. That's equivalent to 3/4 of the current variance |
3235 | + * estimate plus 1/4 of the abs of @delta. |
3236 | * |
3237 | * Note that the index points at the array entry containing the smoothed |
3238 | * mean value, and the variance is always in the following entry |
3239 | @@ -50,7 +51,7 @@ static inline void gfs2_update_stats(struct gfs2_lkstats *s, unsigned index, |
3240 | s64 delta = sample - s->stats[index]; |
3241 | s->stats[index] += (delta >> 3); |
3242 | index++; |
3243 | - s->stats[index] += ((abs(delta) - s->stats[index]) >> 2); |
3244 | + s->stats[index] += (s64)(abs(delta) - s->stats[index]) >> 2; |
3245 | } |
3246 | |
3247 | /** |
3248 | diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c |
3249 | index 4acc677ac8fb..253b03451b72 100644 |
3250 | --- a/fs/hugetlbfs/inode.c |
3251 | +++ b/fs/hugetlbfs/inode.c |
3252 | @@ -451,9 +451,7 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart, |
3253 | if (next >= end) |
3254 | break; |
3255 | |
3256 | - hash = hugetlb_fault_mutex_hash(h, current->mm, |
3257 | - &pseudo_vma, |
3258 | - mapping, next, 0); |
3259 | + hash = hugetlb_fault_mutex_hash(h, mapping, next, 0); |
3260 | mutex_lock(&hugetlb_fault_mutex_table[hash]); |
3261 | |
3262 | /* |
3263 | @@ -573,7 +571,6 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, |
3264 | struct address_space *mapping = inode->i_mapping; |
3265 | struct hstate *h = hstate_inode(inode); |
3266 | struct vm_area_struct pseudo_vma; |
3267 | - struct mm_struct *mm = current->mm; |
3268 | loff_t hpage_size = huge_page_size(h); |
3269 | unsigned long hpage_shift = huge_page_shift(h); |
3270 | pgoff_t start, index, end; |
3271 | @@ -637,8 +634,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, |
3272 | addr = index * hpage_size; |
3273 | |
3274 | /* mutex taken here, fault path and hole punch */ |
3275 | - hash = hugetlb_fault_mutex_hash(h, mm, &pseudo_vma, mapping, |
3276 | - index, addr); |
3277 | + hash = hugetlb_fault_mutex_hash(h, mapping, index, addr); |
3278 | mutex_lock(&hugetlb_fault_mutex_table[hash]); |
3279 | |
3280 | /* See if already present in mapping to avoid alloc/free */ |
3281 | diff --git a/include/linux/bio.h b/include/linux/bio.h |
3282 | index 97cb48f03dc7..a5ca6f199b88 100644 |
3283 | --- a/include/linux/bio.h |
3284 | +++ b/include/linux/bio.h |
3285 | @@ -237,7 +237,7 @@ static inline void bio_cnt_set(struct bio *bio, unsigned int count) |
3286 | { |
3287 | if (count != 1) { |
3288 | bio->bi_flags |= (1 << BIO_REFFED); |
3289 | - smp_mb__before_atomic(); |
3290 | + smp_mb(); |
3291 | } |
3292 | atomic_set(&bio->__bi_cnt, count); |
3293 | } |
3294 | diff --git a/include/linux/hid.h b/include/linux/hid.h |
3295 | index fab65b61d6d4..04bdf5477ec5 100644 |
3296 | --- a/include/linux/hid.h |
3297 | +++ b/include/linux/hid.h |
3298 | @@ -374,6 +374,7 @@ struct hid_global { |
3299 | |
3300 | struct hid_local { |
3301 | unsigned usage[HID_MAX_USAGES]; /* usage array */ |
3302 | + u8 usage_size[HID_MAX_USAGES]; /* usage size array */ |
3303 | unsigned collection_index[HID_MAX_USAGES]; /* collection index array */ |
3304 | unsigned usage_index; |
3305 | unsigned usage_minimum; |
3306 | diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h |
3307 | index b699d59d0f4f..6b8a7b654771 100644 |
3308 | --- a/include/linux/hugetlb.h |
3309 | +++ b/include/linux/hugetlb.h |
3310 | @@ -92,9 +92,7 @@ void putback_active_hugepage(struct page *page); |
3311 | void free_huge_page(struct page *page); |
3312 | void hugetlb_fix_reserve_counts(struct inode *inode); |
3313 | extern struct mutex *hugetlb_fault_mutex_table; |
3314 | -u32 hugetlb_fault_mutex_hash(struct hstate *h, struct mm_struct *mm, |
3315 | - struct vm_area_struct *vma, |
3316 | - struct address_space *mapping, |
3317 | +u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, |
3318 | pgoff_t idx, unsigned long address); |
3319 | |
3320 | pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); |
3321 | diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h |
3322 | index 6cc48ac55fd2..40b14736c73d 100644 |
3323 | --- a/include/linux/iio/adc/ad_sigma_delta.h |
3324 | +++ b/include/linux/iio/adc/ad_sigma_delta.h |
3325 | @@ -66,6 +66,7 @@ struct ad_sigma_delta { |
3326 | bool irq_dis; |
3327 | |
3328 | bool bus_locked; |
3329 | + bool keep_cs_asserted; |
3330 | |
3331 | uint8_t comm; |
3332 | |
3333 | diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h |
3334 | index 12910cf19869..12a4b09f4d08 100644 |
3335 | --- a/include/linux/smpboot.h |
3336 | +++ b/include/linux/smpboot.h |
3337 | @@ -30,7 +30,7 @@ struct smpboot_thread_data; |
3338 | * @thread_comm: The base name of the thread |
3339 | */ |
3340 | struct smp_hotplug_thread { |
3341 | - struct task_struct __percpu **store; |
3342 | + struct task_struct * __percpu *store; |
3343 | struct list_head list; |
3344 | int (*thread_should_run)(unsigned int cpu); |
3345 | void (*thread_fn)(unsigned int cpu); |
3346 | diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c |
3347 | index cd4f41397c7e..42b7251c597f 100644 |
3348 | --- a/kernel/auditfilter.c |
3349 | +++ b/kernel/auditfilter.c |
3350 | @@ -1095,22 +1095,24 @@ int audit_rule_change(int type, __u32 portid, int seq, void *data, |
3351 | int err = 0; |
3352 | struct audit_entry *entry; |
3353 | |
3354 | - entry = audit_data_to_entry(data, datasz); |
3355 | - if (IS_ERR(entry)) |
3356 | - return PTR_ERR(entry); |
3357 | - |
3358 | switch (type) { |
3359 | case AUDIT_ADD_RULE: |
3360 | + entry = audit_data_to_entry(data, datasz); |
3361 | + if (IS_ERR(entry)) |
3362 | + return PTR_ERR(entry); |
3363 | err = audit_add_rule(entry); |
3364 | audit_log_rule_change("add_rule", &entry->rule, !err); |
3365 | break; |
3366 | case AUDIT_DEL_RULE: |
3367 | + entry = audit_data_to_entry(data, datasz); |
3368 | + if (IS_ERR(entry)) |
3369 | + return PTR_ERR(entry); |
3370 | err = audit_del_rule(entry); |
3371 | audit_log_rule_change("remove_rule", &entry->rule, !err); |
3372 | break; |
3373 | default: |
3374 | - err = -EINVAL; |
3375 | WARN_ON(1); |
3376 | + return -EINVAL; |
3377 | } |
3378 | |
3379 | if (err || type == AUDIT_DEL_RULE) { |
3380 | diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c |
3381 | index 123ccbd22449..2b8579d5a544 100644 |
3382 | --- a/kernel/rcu/rcuperf.c |
3383 | +++ b/kernel/rcu/rcuperf.c |
3384 | @@ -453,6 +453,10 @@ rcu_perf_cleanup(void) |
3385 | |
3386 | if (torture_cleanup_begin()) |
3387 | return; |
3388 | + if (!cur_ops) { |
3389 | + torture_cleanup_end(); |
3390 | + return; |
3391 | + } |
3392 | |
3393 | if (reader_tasks) { |
3394 | for (i = 0; i < nrealreaders; i++) |
3395 | @@ -574,6 +578,7 @@ rcu_perf_init(void) |
3396 | pr_alert(" %s", perf_ops[i]->name); |
3397 | pr_alert("\n"); |
3398 | firsterr = -EINVAL; |
3399 | + cur_ops = NULL; |
3400 | goto unwind; |
3401 | } |
3402 | if (cur_ops->init) |
3403 | diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c |
3404 | index bf08fee53dc7..5393bbcf3c1a 100644 |
3405 | --- a/kernel/rcu/rcutorture.c |
3406 | +++ b/kernel/rcu/rcutorture.c |
3407 | @@ -1595,6 +1595,10 @@ rcu_torture_cleanup(void) |
3408 | cur_ops->cb_barrier(); |
3409 | return; |
3410 | } |
3411 | + if (!cur_ops) { |
3412 | + torture_cleanup_end(); |
3413 | + return; |
3414 | + } |
3415 | |
3416 | rcu_torture_barrier_cleanup(); |
3417 | torture_stop_kthread(rcu_torture_stall, stall_task); |
3418 | @@ -1730,6 +1734,7 @@ rcu_torture_init(void) |
3419 | pr_alert(" %s", torture_ops[i]->name); |
3420 | pr_alert("\n"); |
3421 | firsterr = -EINVAL; |
3422 | + cur_ops = NULL; |
3423 | goto unwind; |
3424 | } |
3425 | if (cur_ops->fqs == NULL && fqs_duration != 0) { |
3426 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
3427 | index 50e80b1be2c8..3861dd6da91e 100644 |
3428 | --- a/kernel/sched/core.c |
3429 | +++ b/kernel/sched/core.c |
3430 | @@ -8512,6 +8512,8 @@ static void cpu_cgroup_attach(struct cgroup_taskset *tset) |
3431 | static int cpu_shares_write_u64(struct cgroup_subsys_state *css, |
3432 | struct cftype *cftype, u64 shareval) |
3433 | { |
3434 | + if (shareval > scale_load_down(ULONG_MAX)) |
3435 | + shareval = MAX_SHARES; |
3436 | return sched_group_set_shares(css_tg(css), scale_load(shareval)); |
3437 | } |
3438 | |
3439 | @@ -8611,8 +8613,10 @@ int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us) |
3440 | period = ktime_to_ns(tg->cfs_bandwidth.period); |
3441 | if (cfs_quota_us < 0) |
3442 | quota = RUNTIME_INF; |
3443 | - else |
3444 | + else if ((u64)cfs_quota_us <= U64_MAX / NSEC_PER_USEC) |
3445 | quota = (u64)cfs_quota_us * NSEC_PER_USEC; |
3446 | + else |
3447 | + return -EINVAL; |
3448 | |
3449 | return tg_set_cfs_bandwidth(tg, period, quota); |
3450 | } |
3451 | @@ -8634,6 +8638,9 @@ int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) |
3452 | { |
3453 | u64 quota, period; |
3454 | |
3455 | + if ((u64)cfs_period_us > U64_MAX / NSEC_PER_USEC) |
3456 | + return -EINVAL; |
3457 | + |
3458 | period = (u64)cfs_period_us * NSEC_PER_USEC; |
3459 | quota = tg->cfs_bandwidth.quota; |
3460 | |
3461 | diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c |
3462 | index 7e35fc450c5b..5a07f19059c3 100644 |
3463 | --- a/lib/strncpy_from_user.c |
3464 | +++ b/lib/strncpy_from_user.c |
3465 | @@ -22,10 +22,11 @@ |
3466 | * hit it), 'max' is the address space maximum (and we return |
3467 | * -EFAULT if we hit it). |
3468 | */ |
3469 | -static inline long do_strncpy_from_user(char *dst, const char __user *src, long count, unsigned long max) |
3470 | +static inline long do_strncpy_from_user(char *dst, const char __user *src, |
3471 | + unsigned long count, unsigned long max) |
3472 | { |
3473 | const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; |
3474 | - long res = 0; |
3475 | + unsigned long res = 0; |
3476 | |
3477 | /* |
3478 | * Truncate 'max' to the user-specified limit, so that |
3479 | diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c |
3480 | index 8e105ed4df12..9ff4f3bbb1aa 100644 |
3481 | --- a/lib/strnlen_user.c |
3482 | +++ b/lib/strnlen_user.c |
3483 | @@ -27,7 +27,7 @@ |
3484 | static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max) |
3485 | { |
3486 | const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; |
3487 | - long align, res = 0; |
3488 | + unsigned long align, res = 0; |
3489 | unsigned long c; |
3490 | |
3491 | /* |
3492 | @@ -41,7 +41,7 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count, |
3493 | * Do everything aligned. But that means that we |
3494 | * need to also expand the maximum.. |
3495 | */ |
3496 | - align = (sizeof(long) - 1) & (unsigned long)src; |
3497 | + align = (sizeof(unsigned long) - 1) & (unsigned long)src; |
3498 | src -= align; |
3499 | max += align; |
3500 | |
3501 | diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
3502 | index 8b682da98d95..75d8bd7e8798 100644 |
3503 | --- a/mm/hugetlb.c |
3504 | +++ b/mm/hugetlb.c |
3505 | @@ -3812,21 +3812,14 @@ backout_unlocked: |
3506 | } |
3507 | |
3508 | #ifdef CONFIG_SMP |
3509 | -u32 hugetlb_fault_mutex_hash(struct hstate *h, struct mm_struct *mm, |
3510 | - struct vm_area_struct *vma, |
3511 | - struct address_space *mapping, |
3512 | +u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, |
3513 | pgoff_t idx, unsigned long address) |
3514 | { |
3515 | unsigned long key[2]; |
3516 | u32 hash; |
3517 | |
3518 | - if (vma->vm_flags & VM_SHARED) { |
3519 | - key[0] = (unsigned long) mapping; |
3520 | - key[1] = idx; |
3521 | - } else { |
3522 | - key[0] = (unsigned long) mm; |
3523 | - key[1] = address >> huge_page_shift(h); |
3524 | - } |
3525 | + key[0] = (unsigned long) mapping; |
3526 | + key[1] = idx; |
3527 | |
3528 | hash = jhash2((u32 *)&key, sizeof(key)/sizeof(u32), 0); |
3529 | |
3530 | @@ -3837,9 +3830,7 @@ u32 hugetlb_fault_mutex_hash(struct hstate *h, struct mm_struct *mm, |
3531 | * For uniprocesor systems we always use a single mutex, so just |
3532 | * return 0 and avoid the hashing overhead. |
3533 | */ |
3534 | -u32 hugetlb_fault_mutex_hash(struct hstate *h, struct mm_struct *mm, |
3535 | - struct vm_area_struct *vma, |
3536 | - struct address_space *mapping, |
3537 | +u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, |
3538 | pgoff_t idx, unsigned long address) |
3539 | { |
3540 | return 0; |
3541 | @@ -3885,7 +3876,7 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
3542 | * get spurious allocation failures if two CPUs race to instantiate |
3543 | * the same page in the page cache. |
3544 | */ |
3545 | - hash = hugetlb_fault_mutex_hash(h, mm, vma, mapping, idx, address); |
3546 | + hash = hugetlb_fault_mutex_hash(h, mapping, idx, address); |
3547 | mutex_lock(&hugetlb_fault_mutex_table[hash]); |
3548 | |
3549 | entry = huge_ptep_get(ptep); |
3550 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
3551 | index 6e0aa296f134..d787717140e5 100644 |
3552 | --- a/net/mac80211/mlme.c |
3553 | +++ b/net/mac80211/mlme.c |
3554 | @@ -1072,9 +1072,6 @@ static void ieee80211_chswitch_work(struct work_struct *work) |
3555 | goto out; |
3556 | } |
3557 | |
3558 | - /* XXX: shouldn't really modify cfg80211-owned data! */ |
3559 | - ifmgd->associated->channel = sdata->csa_chandef.chan; |
3560 | - |
3561 | ifmgd->csa_waiting_bcn = true; |
3562 | |
3563 | ieee80211_sta_reset_beacon_monitor(sdata); |
3564 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
3565 | index 09a353c6373a..d6e629315771 100644 |
3566 | --- a/net/wireless/nl80211.c |
3567 | +++ b/net/wireless/nl80211.c |
3568 | @@ -14014,6 +14014,11 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
3569 | |
3570 | wdev->chandef = *chandef; |
3571 | wdev->preset_chandef = *chandef; |
3572 | + |
3573 | + if (wdev->iftype == NL80211_IFTYPE_STATION && |
3574 | + !WARN_ON(!wdev->current_bss)) |
3575 | + wdev->current_bss->pub.channel = chandef->chan; |
3576 | + |
3577 | nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL, |
3578 | NL80211_CMD_CH_SWITCH_NOTIFY, 0); |
3579 | } |
3580 | diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c |
3581 | index 90b5948e0ff3..cba5b5a29da0 100644 |
3582 | --- a/sound/soc/codecs/hdmi-codec.c |
3583 | +++ b/sound/soc/codecs/hdmi-codec.c |
3584 | @@ -137,8 +137,12 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, |
3585 | if (!ret) { |
3586 | ret = snd_pcm_hw_constraint_eld(substream->runtime, |
3587 | hcp->eld); |
3588 | - if (ret) |
3589 | + if (ret) { |
3590 | + mutex_lock(&hcp->current_stream_lock); |
3591 | + hcp->current_stream = NULL; |
3592 | + mutex_unlock(&hcp->current_stream_lock); |
3593 | return ret; |
3594 | + } |
3595 | } |
3596 | } |
3597 | return 0; |
3598 | diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c |
3599 | index 3c5a9804d3f5..5a0b17ebfc02 100644 |
3600 | --- a/sound/soc/davinci/davinci-mcasp.c |
3601 | +++ b/sound/soc/davinci/davinci-mcasp.c |
3602 | @@ -43,6 +43,7 @@ |
3603 | |
3604 | #define MCASP_MAX_AFIFO_DEPTH 64 |
3605 | |
3606 | +#ifdef CONFIG_PM |
3607 | static u32 context_regs[] = { |
3608 | DAVINCI_MCASP_TXFMCTL_REG, |
3609 | DAVINCI_MCASP_RXFMCTL_REG, |
3610 | @@ -65,6 +66,7 @@ struct davinci_mcasp_context { |
3611 | u32 *xrsr_regs; /* for serializer configuration */ |
3612 | bool pm_state; |
3613 | }; |
3614 | +#endif |
3615 | |
3616 | struct davinci_mcasp_ruledata { |
3617 | struct davinci_mcasp *mcasp; |
3618 | diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig |
3619 | index a732b3a065c9..8a2873a7899a 100644 |
3620 | --- a/sound/soc/fsl/Kconfig |
3621 | +++ b/sound/soc/fsl/Kconfig |
3622 | @@ -172,16 +172,17 @@ config SND_MPC52xx_SOC_EFIKA |
3623 | |
3624 | endif # SND_POWERPC_SOC |
3625 | |
3626 | +config SND_SOC_IMX_PCM_FIQ |
3627 | + tristate |
3628 | + default y if SND_SOC_IMX_SSI=y && (SND_SOC_FSL_SSI=m || SND_SOC_FSL_SPDIF=m) && (MXC_TZIC || MXC_AVIC) |
3629 | + select FIQ |
3630 | + |
3631 | if SND_IMX_SOC |
3632 | |
3633 | config SND_SOC_IMX_SSI |
3634 | tristate |
3635 | select SND_SOC_FSL_UTILS |
3636 | |
3637 | -config SND_SOC_IMX_PCM_FIQ |
3638 | - tristate |
3639 | - select FIQ |
3640 | - |
3641 | comment "SoC Audio support for Freescale i.MX boards:" |
3642 | |
3643 | config SND_MXC_SOC_WM1133_EV1 |
3644 | diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c |
3645 | index 883087f2b092..38132143b7d5 100644 |
3646 | --- a/sound/soc/fsl/eukrea-tlv320.c |
3647 | +++ b/sound/soc/fsl/eukrea-tlv320.c |
3648 | @@ -119,13 +119,13 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) |
3649 | if (ret) { |
3650 | dev_err(&pdev->dev, |
3651 | "fsl,mux-int-port node missing or invalid.\n"); |
3652 | - return ret; |
3653 | + goto err; |
3654 | } |
3655 | ret = of_property_read_u32(np, "fsl,mux-ext-port", &ext_port); |
3656 | if (ret) { |
3657 | dev_err(&pdev->dev, |
3658 | "fsl,mux-ext-port node missing or invalid.\n"); |
3659 | - return ret; |
3660 | + goto err; |
3661 | } |
3662 | |
3663 | /* |
3664 | diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c |
3665 | index 9fadf7e31c5f..cb43f57f978b 100644 |
3666 | --- a/sound/soc/fsl/fsl_sai.c |
3667 | +++ b/sound/soc/fsl/fsl_sai.c |
3668 | @@ -274,12 +274,14 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai, |
3669 | case SND_SOC_DAIFMT_CBS_CFS: |
3670 | val_cr2 |= FSL_SAI_CR2_BCD_MSTR; |
3671 | val_cr4 |= FSL_SAI_CR4_FSD_MSTR; |
3672 | + sai->is_slave_mode = false; |
3673 | break; |
3674 | case SND_SOC_DAIFMT_CBM_CFM: |
3675 | sai->is_slave_mode = true; |
3676 | break; |
3677 | case SND_SOC_DAIFMT_CBS_CFM: |
3678 | val_cr2 |= FSL_SAI_CR2_BCD_MSTR; |
3679 | + sai->is_slave_mode = false; |
3680 | break; |
3681 | case SND_SOC_DAIFMT_CBM_CFS: |
3682 | val_cr4 |= FSL_SAI_CR4_FSD_MSTR; |
3683 | diff --git a/sound/soc/fsl/fsl_utils.c b/sound/soc/fsl/fsl_utils.c |
3684 | index b9e42b503a37..4f8bdb7650e8 100644 |
3685 | --- a/sound/soc/fsl/fsl_utils.c |
3686 | +++ b/sound/soc/fsl/fsl_utils.c |
3687 | @@ -75,6 +75,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, |
3688 | iprop = of_get_property(dma_np, "cell-index", NULL); |
3689 | if (!iprop) { |
3690 | of_node_put(dma_np); |
3691 | + of_node_put(dma_channel_np); |
3692 | return -EINVAL; |
3693 | } |
3694 | *dma_id = be32_to_cpup(iprop); |
3695 | diff --git a/tools/include/linux/bitops.h b/tools/include/linux/bitops.h |
3696 | index fc446343ff41..7e3b87a77334 100644 |
3697 | --- a/tools/include/linux/bitops.h |
3698 | +++ b/tools/include/linux/bitops.h |
3699 | @@ -3,8 +3,6 @@ |
3700 | |
3701 | #include <asm/types.h> |
3702 | #include <linux/kernel.h> |
3703 | -#include <linux/compiler.h> |
3704 | - |
3705 | #ifndef __WORDSIZE |
3706 | #define __WORDSIZE (__SIZEOF_LONG__ * 8) |
3707 | #endif |
3708 | @@ -12,10 +10,9 @@ |
3709 | #ifndef BITS_PER_LONG |
3710 | # define BITS_PER_LONG __WORDSIZE |
3711 | #endif |
3712 | +#include <linux/bits.h> |
3713 | +#include <linux/compiler.h> |
3714 | |
3715 | -#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) |
3716 | -#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) |
3717 | -#define BITS_PER_BYTE 8 |
3718 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) |
3719 | #define BITS_TO_U64(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u64)) |
3720 | #define BITS_TO_U32(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32)) |
3721 | diff --git a/tools/include/linux/bits.h b/tools/include/linux/bits.h |
3722 | new file mode 100644 |
3723 | index 000000000000..2b7b532c1d51 |
3724 | --- /dev/null |
3725 | +++ b/tools/include/linux/bits.h |
3726 | @@ -0,0 +1,26 @@ |
3727 | +/* SPDX-License-Identifier: GPL-2.0 */ |
3728 | +#ifndef __LINUX_BITS_H |
3729 | +#define __LINUX_BITS_H |
3730 | +#include <asm/bitsperlong.h> |
3731 | + |
3732 | +#define BIT(nr) (1UL << (nr)) |
3733 | +#define BIT_ULL(nr) (1ULL << (nr)) |
3734 | +#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) |
3735 | +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) |
3736 | +#define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) |
3737 | +#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) |
3738 | +#define BITS_PER_BYTE 8 |
3739 | + |
3740 | +/* |
3741 | + * Create a contiguous bitmask starting at bit position @l and ending at |
3742 | + * position @h. For example |
3743 | + * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. |
3744 | + */ |
3745 | +#define GENMASK(h, l) \ |
3746 | + (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) |
3747 | + |
3748 | +#define GENMASK_ULL(h, l) \ |
3749 | + (((~0ULL) - (1ULL << (l)) + 1) & \ |
3750 | + (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) |
3751 | + |
3752 | +#endif /* __LINUX_BITS_H */ |
3753 | diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh |
3754 | index 83fe2202382e..ff38fc63bceb 100755 |
3755 | --- a/tools/perf/check-headers.sh |
3756 | +++ b/tools/perf/check-headers.sh |
3757 | @@ -4,6 +4,7 @@ HEADERS=' |
3758 | include/uapi/linux/fcntl.h |
3759 | include/uapi/linux/perf_event.h |
3760 | include/uapi/linux/stat.h |
3761 | +include/linux/bits.h |
3762 | include/linux/hash.h |
3763 | include/uapi/linux/hw_breakpoint.h |
3764 | arch/x86/include/asm/disabled-features.h |
3765 | diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h |
3766 | index e72d370889f8..8b39e8086c2d 100644 |
3767 | --- a/tools/perf/util/util.h |
3768 | +++ b/tools/perf/util/util.h |
3769 | @@ -74,7 +74,6 @@ |
3770 | #include <sys/ttydefaults.h> |
3771 | #include <api/fs/tracing_path.h> |
3772 | #include <termios.h> |
3773 | -#include <linux/bitops.h> |
3774 | #include <termios.h> |
3775 | #include "strlist.h" |
3776 |