Contents of /trunk/kernel-alx-legacy/patches-4.9/0412-4.9.313-all-fixes.patch
Parent Directory | Revision Log
Revision 3714 -
(show annotations)
(download)
Mon Oct 24 14:08:26 2022 UTC (23 months ago) by niro
File size: 66861 byte(s)
Mon Oct 24 14:08:26 2022 UTC (23 months ago) by niro
File size: 66861 byte(s)
-linux-4.9.313
1 | diff --git a/Makefile b/Makefile |
2 | index a9f16c9c9614f..0c13bf09d17dc 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 9 |
8 | -SUBLEVEL = 312 |
9 | +SUBLEVEL = 313 |
10 | EXTRAVERSION = |
11 | NAME = Roaring Lionus |
12 | |
13 | diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi b/arch/arm/boot/dts/imx6qdl-apalis.dtsi |
14 | index 99e323b57261c..cbe7b0dcb6eb2 100644 |
15 | --- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi |
16 | +++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi |
17 | @@ -324,6 +324,8 @@ |
18 | codec: sgtl5000@0a { |
19 | compatible = "fsl,sgtl5000"; |
20 | reg = <0x0a>; |
21 | + pinctrl-names = "default"; |
22 | + pinctrl-0 = <&pinctrl_sgtl5000>; |
23 | clocks = <&clks IMX6QDL_CLK_CKO>; |
24 | VDDA-supply = <®_2p5v>; |
25 | VDDIO-supply = <®_3p3v>; |
26 | @@ -550,8 +552,6 @@ |
27 | MX6QDL_PAD_DISP0_DAT21__AUD4_TXD 0x130b0 |
28 | MX6QDL_PAD_DISP0_DAT22__AUD4_TXFS 0x130b0 |
29 | MX6QDL_PAD_DISP0_DAT23__AUD4_RXD 0x130b0 |
30 | - /* SGTL5000 sys_mclk */ |
31 | - MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0 |
32 | >; |
33 | }; |
34 | |
35 | @@ -812,6 +812,12 @@ |
36 | >; |
37 | }; |
38 | |
39 | + pinctrl_sgtl5000: sgtl5000grp { |
40 | + fsl,pins = < |
41 | + MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0 |
42 | + >; |
43 | + }; |
44 | + |
45 | pinctrl_spdif: spdifgrp { |
46 | fsl,pins = < |
47 | MX6QDL_PAD_GPIO_16__SPDIF_IN 0x1b0b0 |
48 | diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi |
49 | index 338ee6bd0e0c0..ced298d073382 100644 |
50 | --- a/arch/arm/boot/dts/omap3-gta04.dtsi |
51 | +++ b/arch/arm/boot/dts/omap3-gta04.dtsi |
52 | @@ -29,6 +29,8 @@ |
53 | aliases { |
54 | display0 = &lcd; |
55 | display1 = &tv0; |
56 | + /delete-property/ mmc2; |
57 | + /delete-property/ mmc3; |
58 | }; |
59 | |
60 | gpio-keys { |
61 | diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c |
62 | index e5dcbda20129d..7fff67ea7bcd3 100644 |
63 | --- a/arch/arm/mach-omap2/omap4-common.c |
64 | +++ b/arch/arm/mach-omap2/omap4-common.c |
65 | @@ -342,10 +342,12 @@ void __init omap_gic_of_init(void) |
66 | |
67 | np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-gic"); |
68 | gic_dist_base_addr = of_iomap(np, 0); |
69 | + of_node_put(np); |
70 | WARN_ON(!gic_dist_base_addr); |
71 | |
72 | np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-twd-timer"); |
73 | twd_base = of_iomap(np, 0); |
74 | + of_node_put(np); |
75 | WARN_ON(!twd_base); |
76 | |
77 | skip_errata_init: |
78 | diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h |
79 | index b05bb70a2e46f..8026baf46e729 100644 |
80 | --- a/arch/mips/include/asm/timex.h |
81 | +++ b/arch/mips/include/asm/timex.h |
82 | @@ -40,9 +40,9 @@ |
83 | typedef unsigned int cycles_t; |
84 | |
85 | /* |
86 | - * On R4000/R4400 before version 5.0 an erratum exists such that if the |
87 | - * cycle counter is read in the exact moment that it is matching the |
88 | - * compare register, no interrupt will be generated. |
89 | + * On R4000/R4400 an erratum exists such that if the cycle counter is |
90 | + * read in the exact moment that it is matching the compare register, |
91 | + * no interrupt will be generated. |
92 | * |
93 | * There is a suggested workaround and also the erratum can't strike if |
94 | * the compare interrupt isn't being used as the clock source device. |
95 | @@ -63,7 +63,7 @@ static inline int can_use_mips_counter(unsigned int prid) |
96 | if (!__builtin_constant_p(cpu_has_counter)) |
97 | asm volatile("" : "=m" (cpu_data[0].options)); |
98 | if (likely(cpu_has_counter && |
99 | - prid >= (PRID_IMP_R4000 | PRID_REV_ENCODE_44(5, 0)))) |
100 | + prid > (PRID_IMP_R4000 | PRID_REV_ENCODE_44(15, 15)))) |
101 | return 1; |
102 | else |
103 | return 0; |
104 | diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c |
105 | index b15ee12586688..1d69989337889 100644 |
106 | --- a/arch/mips/kernel/time.c |
107 | +++ b/arch/mips/kernel/time.c |
108 | @@ -168,15 +168,10 @@ static __init int cpu_has_mfc0_count_bug(void) |
109 | case CPU_R4400MC: |
110 | /* |
111 | * The published errata for the R4400 up to 3.0 say the CPU |
112 | - * has the mfc0 from count bug. |
113 | + * has the mfc0 from count bug. This seems the last version |
114 | + * produced. |
115 | */ |
116 | - if ((current_cpu_data.processor_id & 0xff) <= 0x30) |
117 | - return 1; |
118 | - |
119 | - /* |
120 | - * we assume newer revisions are ok |
121 | - */ |
122 | - return 0; |
123 | + return 1; |
124 | } |
125 | |
126 | return 0; |
127 | diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c |
128 | index 0c2a94a0f7518..e31633dcb0f35 100644 |
129 | --- a/arch/parisc/kernel/processor.c |
130 | +++ b/arch/parisc/kernel/processor.c |
131 | @@ -390,8 +390,7 @@ show_cpuinfo (struct seq_file *m, void *v) |
132 | } |
133 | seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities); |
134 | |
135 | - seq_printf(m, "model\t\t: %s\n" |
136 | - "model name\t: %s\n", |
137 | + seq_printf(m, "model\t\t: %s - %s\n", |
138 | boot_cpu_data.pdc.sys_model_name, |
139 | cpuinfo->dev ? |
140 | cpuinfo->dev->name : "Unknown"); |
141 | diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h |
142 | index da0d81fa0b546..0e50b668184ad 100644 |
143 | --- a/arch/x86/include/asm/microcode.h |
144 | +++ b/arch/x86/include/asm/microcode.h |
145 | @@ -135,10 +135,12 @@ extern void __init load_ucode_bsp(void); |
146 | extern void load_ucode_ap(void); |
147 | void reload_early_microcode(void); |
148 | extern bool get_builtin_firmware(struct cpio_data *cd, const char *name); |
149 | +void microcode_bsp_resume(void); |
150 | #else |
151 | static inline void __init load_ucode_bsp(void) { } |
152 | static inline void load_ucode_ap(void) { } |
153 | static inline void reload_early_microcode(void) { } |
154 | +static inline void microcode_bsp_resume(void) { } |
155 | static inline bool |
156 | get_builtin_firmware(struct cpio_data *cd, const char *name) { return false; } |
157 | #endif |
158 | diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c |
159 | index b53a6579767d1..499bc79fc82a7 100644 |
160 | --- a/arch/x86/kernel/cpu/microcode/core.c |
161 | +++ b/arch/x86/kernel/cpu/microcode/core.c |
162 | @@ -586,9 +586,9 @@ static struct subsys_interface mc_cpu_interface = { |
163 | }; |
164 | |
165 | /** |
166 | - * mc_bp_resume - Update boot CPU microcode during resume. |
167 | + * microcode_bsp_resume - Update boot CPU microcode during resume. |
168 | */ |
169 | -static void mc_bp_resume(void) |
170 | +void microcode_bsp_resume(void) |
171 | { |
172 | int cpu = smp_processor_id(); |
173 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
174 | @@ -600,7 +600,7 @@ static void mc_bp_resume(void) |
175 | } |
176 | |
177 | static struct syscore_ops mc_syscore_ops = { |
178 | - .resume = mc_bp_resume, |
179 | + .resume = microcode_bsp_resume, |
180 | }; |
181 | |
182 | static int mc_cpu_online(unsigned int cpu) |
183 | diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c |
184 | index a6f8600672d75..c068027ac55f2 100644 |
185 | --- a/arch/x86/kvm/cpuid.c |
186 | +++ b/arch/x86/kvm/cpuid.c |
187 | @@ -502,6 +502,11 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, |
188 | union cpuid10_eax eax; |
189 | union cpuid10_edx edx; |
190 | |
191 | + if (!static_cpu_has(X86_FEATURE_ARCH_PERFMON)) { |
192 | + entry->eax = entry->ebx = entry->ecx = entry->edx = 0; |
193 | + break; |
194 | + } |
195 | + |
196 | perf_get_x86_pmu_capability(&cap); |
197 | |
198 | /* |
199 | diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c |
200 | index 357b3e6a2f7b1..a1fbf18eed5a8 100644 |
201 | --- a/arch/x86/power/cpu.c |
202 | +++ b/arch/x86/power/cpu.c |
203 | @@ -26,6 +26,7 @@ |
204 | #include <asm/cpu.h> |
205 | #include <asm/mmu_context.h> |
206 | #include <asm/cpu_device_id.h> |
207 | +#include <asm/microcode.h> |
208 | |
209 | #ifdef CONFIG_X86_32 |
210 | __visible unsigned long saved_context_ebx; |
211 | @@ -261,6 +262,13 @@ static void notrace __restore_processor_state(struct saved_context *ctxt) |
212 | x86_platform.restore_sched_clock_state(); |
213 | mtrr_bp_restore(); |
214 | perf_restore_debug_store(); |
215 | + |
216 | + microcode_bsp_resume(); |
217 | + |
218 | + /* |
219 | + * This needs to happen after the microcode has been updated upon resume |
220 | + * because some of the MSRs are "emulated" in microcode. |
221 | + */ |
222 | msr_restore_context(ctxt); |
223 | } |
224 | |
225 | diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig |
226 | index b701c79f07e53..3d5cf588c0786 100644 |
227 | --- a/drivers/block/Kconfig |
228 | +++ b/drivers/block/Kconfig |
229 | @@ -33,6 +33,22 @@ config BLK_DEV_FD |
230 | To compile this driver as a module, choose M here: the |
231 | module will be called floppy. |
232 | |
233 | +config BLK_DEV_FD_RAWCMD |
234 | + bool "Support for raw floppy disk commands (DEPRECATED)" |
235 | + depends on BLK_DEV_FD |
236 | + help |
237 | + If you want to use actual physical floppies and expect to do |
238 | + special low-level hardware accesses to them (access and use |
239 | + non-standard formats, for example), then enable this. |
240 | + |
241 | + Note that the code enabled by this option is rarely used and |
242 | + might be unstable or insecure, and distros should not enable it. |
243 | + |
244 | + Note: FDRAWCMD is deprecated and will be removed from the kernel |
245 | + in the near future. |
246 | + |
247 | + If unsure, say N. |
248 | + |
249 | config AMIGA_FLOPPY |
250 | tristate "Amiga floppy support" |
251 | depends on AMIGA |
252 | diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c |
253 | index 7164be9710e51..cfe1bfb3c20e9 100644 |
254 | --- a/drivers/block/floppy.c |
255 | +++ b/drivers/block/floppy.c |
256 | @@ -3016,6 +3016,8 @@ static const char *drive_name(int type, int drive) |
257 | return "(null)"; |
258 | } |
259 | |
260 | +#ifdef CONFIG_BLK_DEV_FD_RAWCMD |
261 | + |
262 | /* raw commands */ |
263 | static void raw_cmd_done(int flag) |
264 | { |
265 | @@ -3227,6 +3229,35 @@ static int raw_cmd_ioctl(int cmd, void __user *param) |
266 | return ret; |
267 | } |
268 | |
269 | +static int floppy_raw_cmd_ioctl(int type, int drive, int cmd, |
270 | + void __user *param) |
271 | +{ |
272 | + int ret; |
273 | + |
274 | + pr_warn_once("Note: FDRAWCMD is deprecated and will be removed from the kernel in the near future.\n"); |
275 | + |
276 | + if (type) |
277 | + return -EINVAL; |
278 | + if (lock_fdc(drive)) |
279 | + return -EINTR; |
280 | + set_floppy(drive); |
281 | + ret = raw_cmd_ioctl(cmd, param); |
282 | + if (ret == -EINTR) |
283 | + return -EINTR; |
284 | + process_fd_request(); |
285 | + return ret; |
286 | +} |
287 | + |
288 | +#else /* CONFIG_BLK_DEV_FD_RAWCMD */ |
289 | + |
290 | +static int floppy_raw_cmd_ioctl(int type, int drive, int cmd, |
291 | + void __user *param) |
292 | +{ |
293 | + return -EOPNOTSUPP; |
294 | +} |
295 | + |
296 | +#endif |
297 | + |
298 | static int invalidate_drive(struct block_device *bdev) |
299 | { |
300 | /* invalidate the buffer track to force a reread */ |
301 | @@ -3414,7 +3445,6 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int |
302 | { |
303 | int drive = (long)bdev->bd_disk->private_data; |
304 | int type = ITYPE(UDRS->fd_device); |
305 | - int i; |
306 | int ret; |
307 | int size; |
308 | union inparam { |
309 | @@ -3565,16 +3595,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int |
310 | outparam = UDRWE; |
311 | break; |
312 | case FDRAWCMD: |
313 | - if (type) |
314 | - return -EINVAL; |
315 | - if (lock_fdc(drive)) |
316 | - return -EINTR; |
317 | - set_floppy(drive); |
318 | - i = raw_cmd_ioctl(cmd, (void __user *)param); |
319 | - if (i == -EINTR) |
320 | - return -EINTR; |
321 | - process_fd_request(); |
322 | - return i; |
323 | + return floppy_raw_cmd_ioctl(type, drive, cmd, (void __user *)param); |
324 | case FDTWADDLE: |
325 | if (lock_fdc(drive)) |
326 | return -EINTR; |
327 | diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c |
328 | index 4f3d988210b0a..ce5b976a88568 100644 |
329 | --- a/drivers/bus/sunxi-rsb.c |
330 | +++ b/drivers/bus/sunxi-rsb.c |
331 | @@ -224,6 +224,8 @@ static struct sunxi_rsb_device *sunxi_rsb_device_create(struct sunxi_rsb *rsb, |
332 | |
333 | dev_dbg(&rdev->dev, "device %s registered\n", dev_name(&rdev->dev)); |
334 | |
335 | + return rdev; |
336 | + |
337 | err_device_add: |
338 | put_device(&rdev->dev); |
339 | |
340 | diff --git a/drivers/clk/sunxi/clk-sun9i-mmc.c b/drivers/clk/sunxi/clk-sun9i-mmc.c |
341 | index f69f9e8c6f380..7e9d1624032fe 100644 |
342 | --- a/drivers/clk/sunxi/clk-sun9i-mmc.c |
343 | +++ b/drivers/clk/sunxi/clk-sun9i-mmc.c |
344 | @@ -117,6 +117,8 @@ static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev) |
345 | spin_lock_init(&data->lock); |
346 | |
347 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
348 | + if (!r) |
349 | + return -EINVAL; |
350 | /* one clock/reset pair per word */ |
351 | count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH); |
352 | data->membase = devm_ioremap_resource(&pdev->dev, r); |
353 | diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c |
354 | index 57ea7f4641787..11c634125c7df 100644 |
355 | --- a/drivers/firewire/core-card.c |
356 | +++ b/drivers/firewire/core-card.c |
357 | @@ -681,6 +681,7 @@ EXPORT_SYMBOL_GPL(fw_card_release); |
358 | void fw_core_remove_card(struct fw_card *card) |
359 | { |
360 | struct fw_card_driver dummy_driver = dummy_driver_template; |
361 | + unsigned long flags; |
362 | |
363 | card->driver->update_phy_reg(card, 4, |
364 | PHY_LINK_ACTIVE | PHY_CONTENDER, 0); |
365 | @@ -695,7 +696,9 @@ void fw_core_remove_card(struct fw_card *card) |
366 | dummy_driver.stop_iso = card->driver->stop_iso; |
367 | card->driver = &dummy_driver; |
368 | |
369 | + spin_lock_irqsave(&card->lock, flags); |
370 | fw_destroy_nodes(card); |
371 | + spin_unlock_irqrestore(&card->lock, flags); |
372 | |
373 | /* Wait for all users, especially device workqueue jobs, to finish. */ |
374 | fw_card_put(card); |
375 | diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c |
376 | index aee149bdf4c03..59b49ff1f4be7 100644 |
377 | --- a/drivers/firewire/core-cdev.c |
378 | +++ b/drivers/firewire/core-cdev.c |
379 | @@ -1496,6 +1496,7 @@ static void outbound_phy_packet_callback(struct fw_packet *packet, |
380 | { |
381 | struct outbound_phy_packet_event *e = |
382 | container_of(packet, struct outbound_phy_packet_event, p); |
383 | + struct client *e_client; |
384 | |
385 | switch (status) { |
386 | /* expected: */ |
387 | @@ -1512,9 +1513,10 @@ static void outbound_phy_packet_callback(struct fw_packet *packet, |
388 | } |
389 | e->phy_packet.data[0] = packet->timestamp; |
390 | |
391 | + e_client = e->client; |
392 | queue_event(e->client, &e->event, &e->phy_packet, |
393 | sizeof(e->phy_packet) + e->phy_packet.length, NULL, 0); |
394 | - client_put(e->client); |
395 | + client_put(e_client); |
396 | } |
397 | |
398 | static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg) |
399 | diff --git a/drivers/firewire/core-topology.c b/drivers/firewire/core-topology.c |
400 | index 0de83508f321c..2337b0f3dae2c 100644 |
401 | --- a/drivers/firewire/core-topology.c |
402 | +++ b/drivers/firewire/core-topology.c |
403 | @@ -387,16 +387,13 @@ static void report_found_node(struct fw_card *card, |
404 | card->bm_retries = 0; |
405 | } |
406 | |
407 | +/* Must be called with card->lock held */ |
408 | void fw_destroy_nodes(struct fw_card *card) |
409 | { |
410 | - unsigned long flags; |
411 | - |
412 | - spin_lock_irqsave(&card->lock, flags); |
413 | card->color++; |
414 | if (card->local_node != NULL) |
415 | for_each_fw_node(card, card->local_node, report_lost_node); |
416 | card->local_node = NULL; |
417 | - spin_unlock_irqrestore(&card->lock, flags); |
418 | } |
419 | |
420 | static void move_tree(struct fw_node *node0, struct fw_node *node1, int port) |
421 | @@ -522,6 +519,8 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation, |
422 | struct fw_node *local_node; |
423 | unsigned long flags; |
424 | |
425 | + spin_lock_irqsave(&card->lock, flags); |
426 | + |
427 | /* |
428 | * If the selfID buffer is not the immediate successor of the |
429 | * previously processed one, we cannot reliably compare the |
430 | @@ -533,8 +532,6 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation, |
431 | card->bm_retries = 0; |
432 | } |
433 | |
434 | - spin_lock_irqsave(&card->lock, flags); |
435 | - |
436 | card->broadcast_channel_allocated = card->broadcast_channel_auto_allocated; |
437 | card->node_id = node_id; |
438 | /* |
439 | diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c |
440 | index d6a09b9cd8cca..0446221d7d2e3 100644 |
441 | --- a/drivers/firewire/core-transaction.c |
442 | +++ b/drivers/firewire/core-transaction.c |
443 | @@ -86,24 +86,25 @@ static int try_cancel_split_timeout(struct fw_transaction *t) |
444 | static int close_transaction(struct fw_transaction *transaction, |
445 | struct fw_card *card, int rcode) |
446 | { |
447 | - struct fw_transaction *t; |
448 | + struct fw_transaction *t = NULL, *iter; |
449 | unsigned long flags; |
450 | |
451 | spin_lock_irqsave(&card->lock, flags); |
452 | - list_for_each_entry(t, &card->transaction_list, link) { |
453 | - if (t == transaction) { |
454 | - if (!try_cancel_split_timeout(t)) { |
455 | + list_for_each_entry(iter, &card->transaction_list, link) { |
456 | + if (iter == transaction) { |
457 | + if (!try_cancel_split_timeout(iter)) { |
458 | spin_unlock_irqrestore(&card->lock, flags); |
459 | goto timed_out; |
460 | } |
461 | - list_del_init(&t->link); |
462 | - card->tlabel_mask &= ~(1ULL << t->tlabel); |
463 | + list_del_init(&iter->link); |
464 | + card->tlabel_mask &= ~(1ULL << iter->tlabel); |
465 | + t = iter; |
466 | break; |
467 | } |
468 | } |
469 | spin_unlock_irqrestore(&card->lock, flags); |
470 | |
471 | - if (&t->link != &card->transaction_list) { |
472 | + if (t) { |
473 | t->callback(card, rcode, NULL, 0, t->callback_data); |
474 | return 0; |
475 | } |
476 | @@ -938,7 +939,7 @@ EXPORT_SYMBOL(fw_core_handle_request); |
477 | |
478 | void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) |
479 | { |
480 | - struct fw_transaction *t; |
481 | + struct fw_transaction *t = NULL, *iter; |
482 | unsigned long flags; |
483 | u32 *data; |
484 | size_t data_length; |
485 | @@ -950,20 +951,21 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) |
486 | rcode = HEADER_GET_RCODE(p->header[1]); |
487 | |
488 | spin_lock_irqsave(&card->lock, flags); |
489 | - list_for_each_entry(t, &card->transaction_list, link) { |
490 | - if (t->node_id == source && t->tlabel == tlabel) { |
491 | - if (!try_cancel_split_timeout(t)) { |
492 | + list_for_each_entry(iter, &card->transaction_list, link) { |
493 | + if (iter->node_id == source && iter->tlabel == tlabel) { |
494 | + if (!try_cancel_split_timeout(iter)) { |
495 | spin_unlock_irqrestore(&card->lock, flags); |
496 | goto timed_out; |
497 | } |
498 | - list_del_init(&t->link); |
499 | - card->tlabel_mask &= ~(1ULL << t->tlabel); |
500 | + list_del_init(&iter->link); |
501 | + card->tlabel_mask &= ~(1ULL << iter->tlabel); |
502 | + t = iter; |
503 | break; |
504 | } |
505 | } |
506 | spin_unlock_irqrestore(&card->lock, flags); |
507 | |
508 | - if (&t->link == &card->transaction_list) { |
509 | + if (!t) { |
510 | timed_out: |
511 | fw_notice(card, "unsolicited response (source %x, tlabel %x)\n", |
512 | source, tlabel); |
513 | diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c |
514 | index 6bac03999fd49..d418a71faf0b1 100644 |
515 | --- a/drivers/firewire/sbp2.c |
516 | +++ b/drivers/firewire/sbp2.c |
517 | @@ -421,7 +421,7 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request, |
518 | void *payload, size_t length, void *callback_data) |
519 | { |
520 | struct sbp2_logical_unit *lu = callback_data; |
521 | - struct sbp2_orb *orb; |
522 | + struct sbp2_orb *orb = NULL, *iter; |
523 | struct sbp2_status status; |
524 | unsigned long flags; |
525 | |
526 | @@ -446,17 +446,18 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request, |
527 | |
528 | /* Lookup the orb corresponding to this status write. */ |
529 | spin_lock_irqsave(&lu->tgt->lock, flags); |
530 | - list_for_each_entry(orb, &lu->orb_list, link) { |
531 | + list_for_each_entry(iter, &lu->orb_list, link) { |
532 | if (STATUS_GET_ORB_HIGH(status) == 0 && |
533 | - STATUS_GET_ORB_LOW(status) == orb->request_bus) { |
534 | - orb->rcode = RCODE_COMPLETE; |
535 | - list_del(&orb->link); |
536 | + STATUS_GET_ORB_LOW(status) == iter->request_bus) { |
537 | + iter->rcode = RCODE_COMPLETE; |
538 | + list_del(&iter->link); |
539 | + orb = iter; |
540 | break; |
541 | } |
542 | } |
543 | spin_unlock_irqrestore(&lu->tgt->lock, flags); |
544 | |
545 | - if (&orb->link != &lu->orb_list) { |
546 | + if (orb) { |
547 | orb->callback(orb, &status); |
548 | kref_put(&orb->kref, free_orb); /* orb callback reference */ |
549 | } else { |
550 | diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c |
551 | index 6e60ca53406e7..474f226e0891b 100644 |
552 | --- a/drivers/hwmon/adt7470.c |
553 | +++ b/drivers/hwmon/adt7470.c |
554 | @@ -33,6 +33,7 @@ |
555 | #include <linux/kthread.h> |
556 | #include <linux/slab.h> |
557 | #include <linux/util_macros.h> |
558 | +#include <linux/sched.h> |
559 | |
560 | /* Addresses to scan */ |
561 | static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END }; |
562 | @@ -273,11 +274,10 @@ static int adt7470_update_thread(void *p) |
563 | adt7470_read_temperatures(client, data); |
564 | mutex_unlock(&data->lock); |
565 | |
566 | - set_current_state(TASK_INTERRUPTIBLE); |
567 | if (kthread_should_stop()) |
568 | break; |
569 | |
570 | - schedule_timeout(msecs_to_jiffies(data->auto_update_interval)); |
571 | + schedule_timeout_interruptible(msecs_to_jiffies(data->auto_update_interval)); |
572 | } |
573 | |
574 | return 0; |
575 | diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c |
576 | index d3a3d62869d83..86de972f41b11 100644 |
577 | --- a/drivers/iio/dac/ad5446.c |
578 | +++ b/drivers/iio/dac/ad5446.c |
579 | @@ -171,7 +171,7 @@ static int ad5446_read_raw(struct iio_dev *indio_dev, |
580 | |
581 | switch (m) { |
582 | case IIO_CHAN_INFO_RAW: |
583 | - *val = st->cached_val; |
584 | + *val = st->cached_val >> chan->scan_type.shift; |
585 | return IIO_VAL_INT; |
586 | case IIO_CHAN_INFO_SCALE: |
587 | *val = st->vref_mv; |
588 | diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c |
589 | index 5c998ac8c840b..126bb8349363c 100644 |
590 | --- a/drivers/iio/dac/ad5592r-base.c |
591 | +++ b/drivers/iio/dac/ad5592r-base.c |
592 | @@ -532,7 +532,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st) |
593 | if (!ret) |
594 | st->channel_modes[reg] = tmp; |
595 | |
596 | - fwnode_property_read_u32(child, "adi,off-state", &tmp); |
597 | + ret = fwnode_property_read_u32(child, "adi,off-state", &tmp); |
598 | if (!ret) |
599 | st->channel_offstate[reg] = tmp; |
600 | } |
601 | diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c |
602 | index 2a4e23e20ebc6..a0787b1835e55 100644 |
603 | --- a/drivers/iio/magnetometer/ak8975.c |
604 | +++ b/drivers/iio/magnetometer/ak8975.c |
605 | @@ -404,6 +404,7 @@ static int ak8975_power_on(const struct ak8975_data *data) |
606 | if (ret) { |
607 | dev_warn(&data->client->dev, |
608 | "Failed to enable specified Vid supply\n"); |
609 | + regulator_disable(data->vdd); |
610 | return ret; |
611 | } |
612 | /* |
613 | diff --git a/drivers/lightnvm/Kconfig b/drivers/lightnvm/Kconfig |
614 | index 2f5d5f4a4c75b..c2823d84cfa6a 100644 |
615 | --- a/drivers/lightnvm/Kconfig |
616 | +++ b/drivers/lightnvm/Kconfig |
617 | @@ -4,7 +4,7 @@ |
618 | |
619 | menuconfig NVM |
620 | bool "Open-Channel SSD target support" |
621 | - depends on BLOCK && HAS_DMA |
622 | + depends on BLOCK && HAS_DMA && BROKEN |
623 | help |
624 | Say Y here to get to enable Open-channel SSDs. |
625 | |
626 | diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
627 | index dd154027adc9d..ec6c2b566621c 100644 |
628 | --- a/drivers/md/dm.c |
629 | +++ b/drivers/md/dm.c |
630 | @@ -524,20 +524,19 @@ static void start_io_acct(struct dm_io *io) |
631 | false, 0, &io->stats_aux); |
632 | } |
633 | |
634 | -static void end_io_acct(struct dm_io *io) |
635 | +static void end_io_acct(struct mapped_device *md, struct bio *bio, |
636 | + unsigned long start_time, struct dm_stats_aux *stats_aux) |
637 | { |
638 | - struct mapped_device *md = io->md; |
639 | - struct bio *bio = io->bio; |
640 | - unsigned long duration = jiffies - io->start_time; |
641 | + unsigned long duration = jiffies - start_time; |
642 | int pending; |
643 | int rw = bio_data_dir(bio); |
644 | |
645 | - generic_end_io_acct(rw, &dm_disk(md)->part0, io->start_time); |
646 | + generic_end_io_acct(rw, &dm_disk(md)->part0, start_time); |
647 | |
648 | if (unlikely(dm_stats_used(&md->stats))) |
649 | dm_stats_account_io(&md->stats, bio_data_dir(bio), |
650 | bio->bi_iter.bi_sector, bio_sectors(bio), |
651 | - true, duration, &io->stats_aux); |
652 | + true, duration, stats_aux); |
653 | |
654 | /* |
655 | * After this is decremented the bio must not be touched if it is |
656 | @@ -768,6 +767,8 @@ static void dec_pending(struct dm_io *io, int error) |
657 | int io_error; |
658 | struct bio *bio; |
659 | struct mapped_device *md = io->md; |
660 | + unsigned long start_time = 0; |
661 | + struct dm_stats_aux stats_aux; |
662 | |
663 | /* Push-back supersedes any I/O errors */ |
664 | if (unlikely(error)) { |
665 | @@ -793,8 +794,10 @@ static void dec_pending(struct dm_io *io, int error) |
666 | |
667 | io_error = io->error; |
668 | bio = io->bio; |
669 | - end_io_acct(io); |
670 | + start_time = io->start_time; |
671 | + stats_aux = io->stats_aux; |
672 | free_io(md, io); |
673 | + end_io_acct(md, bio, start_time, &stats_aux); |
674 | |
675 | if (io_error == DM_ENDIO_REQUEUE) |
676 | return; |
677 | @@ -2024,6 +2027,8 @@ static int dm_wait_for_completion(struct mapped_device *md, long task_state) |
678 | } |
679 | finish_wait(&md->wait, &wait); |
680 | |
681 | + smp_rmb(); /* paired with atomic_dec_return in end_io_acct */ |
682 | + |
683 | return r; |
684 | } |
685 | |
686 | diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c |
687 | index 31f98acdba073..17e15bd054421 100644 |
688 | --- a/drivers/mtd/nand/sh_flctl.c |
689 | +++ b/drivers/mtd/nand/sh_flctl.c |
690 | @@ -399,7 +399,8 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf, |
691 | dma_addr_t dma_addr; |
692 | dma_cookie_t cookie; |
693 | uint32_t reg; |
694 | - int ret; |
695 | + int ret = 0; |
696 | + unsigned long time_left; |
697 | |
698 | if (dir == DMA_FROM_DEVICE) { |
699 | chan = flctl->chan_fifo0_rx; |
700 | @@ -440,13 +441,14 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf, |
701 | goto out; |
702 | } |
703 | |
704 | - ret = |
705 | + time_left = |
706 | wait_for_completion_timeout(&flctl->dma_complete, |
707 | msecs_to_jiffies(3000)); |
708 | |
709 | - if (ret <= 0) { |
710 | + if (time_left == 0) { |
711 | dmaengine_terminate_all(chan); |
712 | dev_err(&flctl->pdev->dev, "wait_for_completion_timeout\n"); |
713 | + ret = -ETIMEDOUT; |
714 | } |
715 | |
716 | out: |
717 | @@ -456,7 +458,7 @@ out: |
718 | |
719 | dma_unmap_single(chan->device->dev, dma_addr, len, dir); |
720 | |
721 | - /* ret > 0 is success */ |
722 | + /* ret == 0 is success */ |
723 | return ret; |
724 | } |
725 | |
726 | @@ -480,7 +482,7 @@ static void read_fiforeg(struct sh_flctl *flctl, int rlen, int offset) |
727 | |
728 | /* initiate DMA transfer */ |
729 | if (flctl->chan_fifo0_rx && rlen >= 32 && |
730 | - flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE) > 0) |
731 | + !flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE)) |
732 | goto convert; /* DMA success */ |
733 | |
734 | /* do polling transfer */ |
735 | @@ -539,7 +541,7 @@ static void write_ec_fiforeg(struct sh_flctl *flctl, int rlen, |
736 | |
737 | /* initiate DMA transfer */ |
738 | if (flctl->chan_fifo0_tx && rlen >= 32 && |
739 | - flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE) > 0) |
740 | + !flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE)) |
741 | return; /* DMA success */ |
742 | |
743 | /* do polling transfer */ |
744 | diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c |
745 | index db9538d4b3586..a2dbd7ae9db24 100644 |
746 | --- a/drivers/net/can/grcan.c |
747 | +++ b/drivers/net/can/grcan.c |
748 | @@ -252,6 +252,7 @@ struct grcan_device_config { |
749 | struct grcan_priv { |
750 | struct can_priv can; /* must be the first member */ |
751 | struct net_device *dev; |
752 | + struct device *ofdev_dev; |
753 | struct napi_struct napi; |
754 | |
755 | struct grcan_registers __iomem *regs; /* ioremap'ed registers */ |
756 | @@ -928,7 +929,7 @@ static void grcan_free_dma_buffers(struct net_device *dev) |
757 | struct grcan_priv *priv = netdev_priv(dev); |
758 | struct grcan_dma *dma = &priv->dma; |
759 | |
760 | - dma_free_coherent(&dev->dev, dma->base_size, dma->base_buf, |
761 | + dma_free_coherent(priv->ofdev_dev, dma->base_size, dma->base_buf, |
762 | dma->base_handle); |
763 | memset(dma, 0, sizeof(*dma)); |
764 | } |
765 | @@ -953,7 +954,7 @@ static int grcan_allocate_dma_buffers(struct net_device *dev, |
766 | |
767 | /* Extra GRCAN_BUFFER_ALIGNMENT to allow for alignment */ |
768 | dma->base_size = lsize + ssize + GRCAN_BUFFER_ALIGNMENT; |
769 | - dma->base_buf = dma_alloc_coherent(&dev->dev, |
770 | + dma->base_buf = dma_alloc_coherent(priv->ofdev_dev, |
771 | dma->base_size, |
772 | &dma->base_handle, |
773 | GFP_KERNEL); |
774 | @@ -1117,8 +1118,10 @@ static int grcan_close(struct net_device *dev) |
775 | |
776 | priv->closing = true; |
777 | if (priv->need_txbug_workaround) { |
778 | + spin_unlock_irqrestore(&priv->lock, flags); |
779 | del_timer_sync(&priv->hang_timer); |
780 | del_timer_sync(&priv->rr_timer); |
781 | + spin_lock_irqsave(&priv->lock, flags); |
782 | } |
783 | netif_stop_queue(dev); |
784 | grcan_stop_hardware(dev); |
785 | @@ -1604,6 +1607,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev, |
786 | memcpy(&priv->config, &grcan_module_config, |
787 | sizeof(struct grcan_device_config)); |
788 | priv->dev = dev; |
789 | + priv->ofdev_dev = &ofdev->dev; |
790 | priv->regs = base; |
791 | priv->can.bittiming_const = &grcan_bittiming_const; |
792 | priv->can.do_set_bittiming = grcan_set_bittiming; |
793 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
794 | index 8d17d464c0677..398928642a97a 100644 |
795 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
796 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
797 | @@ -14314,10 +14314,6 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp) |
798 | |
799 | /* Stop Tx */ |
800 | bnx2x_tx_disable(bp); |
801 | - /* Delete all NAPI objects */ |
802 | - bnx2x_del_all_napi(bp); |
803 | - if (CNIC_LOADED(bp)) |
804 | - bnx2x_del_all_napi_cnic(bp); |
805 | netdev_reset_tc(bp->dev); |
806 | |
807 | del_timer_sync(&bp->timer); |
808 | @@ -14422,6 +14418,11 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev) |
809 | bnx2x_drain_tx_queues(bp); |
810 | bnx2x_send_unload_req(bp, UNLOAD_RECOVERY); |
811 | bnx2x_netif_stop(bp, 1); |
812 | + bnx2x_del_all_napi(bp); |
813 | + |
814 | + if (CNIC_LOADED(bp)) |
815 | + bnx2x_del_all_napi_cnic(bp); |
816 | + |
817 | bnx2x_free_irq(bp); |
818 | |
819 | /* Report UNLOAD_DONE to MCP */ |
820 | diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c |
821 | index 264136dba6741..5eaee7a3ac177 100644 |
822 | --- a/drivers/net/ethernet/smsc/smsc911x.c |
823 | +++ b/drivers/net/ethernet/smsc/smsc911x.c |
824 | @@ -2441,7 +2441,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev) |
825 | if (irq == -EPROBE_DEFER) { |
826 | retval = -EPROBE_DEFER; |
827 | goto out_0; |
828 | - } else if (irq <= 0) { |
829 | + } else if (irq < 0) { |
830 | pr_warn("Could not allocate irq resource\n"); |
831 | retval = -ENODEV; |
832 | goto out_0; |
833 | diff --git a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c |
834 | index 6ca428a702f16..6a9c954492f22 100644 |
835 | --- a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c |
836 | +++ b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c |
837 | @@ -68,6 +68,10 @@ |
838 | #define TSE_PCS_USE_SGMII_ENA BIT(0) |
839 | #define TSE_PCS_IF_USE_SGMII 0x03 |
840 | |
841 | +#define SGMII_ADAPTER_CTRL_REG 0x00 |
842 | +#define SGMII_ADAPTER_DISABLE 0x0001 |
843 | +#define SGMII_ADAPTER_ENABLE 0x0000 |
844 | + |
845 | #define AUTONEGO_LINK_TIMER 20 |
846 | |
847 | static int tse_pcs_reset(void __iomem *base, struct tse_pcs *pcs) |
848 | @@ -211,8 +215,12 @@ void tse_pcs_fix_mac_speed(struct tse_pcs *pcs, struct phy_device *phy_dev, |
849 | unsigned int speed) |
850 | { |
851 | void __iomem *tse_pcs_base = pcs->tse_pcs_base; |
852 | + void __iomem *sgmii_adapter_base = pcs->sgmii_adapter_base; |
853 | u32 val; |
854 | |
855 | + writew(SGMII_ADAPTER_ENABLE, |
856 | + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); |
857 | + |
858 | pcs->autoneg = phy_dev->autoneg; |
859 | |
860 | if (phy_dev->autoneg == AUTONEG_ENABLE) { |
861 | diff --git a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h |
862 | index 254199f2efdbf..2f5882450b06a 100644 |
863 | --- a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h |
864 | +++ b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h |
865 | @@ -21,10 +21,6 @@ |
866 | #include <linux/phy.h> |
867 | #include <linux/timer.h> |
868 | |
869 | -#define SGMII_ADAPTER_CTRL_REG 0x00 |
870 | -#define SGMII_ADAPTER_ENABLE 0x0000 |
871 | -#define SGMII_ADAPTER_DISABLE 0x0001 |
872 | - |
873 | struct tse_pcs { |
874 | struct device *dev; |
875 | void __iomem *tse_pcs_base; |
876 | diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c |
877 | index b138968b8672a..c3a78c1134240 100644 |
878 | --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c |
879 | +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c |
880 | @@ -29,6 +29,9 @@ |
881 | |
882 | #include "altr_tse_pcs.h" |
883 | |
884 | +#define SGMII_ADAPTER_CTRL_REG 0x00 |
885 | +#define SGMII_ADAPTER_DISABLE 0x0001 |
886 | + |
887 | #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII 0x0 |
888 | #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII 0x1 |
889 | #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII 0x2 |
890 | @@ -62,14 +65,16 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed) |
891 | { |
892 | struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)priv; |
893 | void __iomem *splitter_base = dwmac->splitter_base; |
894 | + void __iomem *tse_pcs_base = dwmac->pcs.tse_pcs_base; |
895 | void __iomem *sgmii_adapter_base = dwmac->pcs.sgmii_adapter_base; |
896 | struct device *dev = dwmac->dev; |
897 | struct net_device *ndev = dev_get_drvdata(dev); |
898 | struct phy_device *phy_dev = ndev->phydev; |
899 | u32 val; |
900 | |
901 | - writew(SGMII_ADAPTER_DISABLE, |
902 | - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); |
903 | + if ((tse_pcs_base) && (sgmii_adapter_base)) |
904 | + writew(SGMII_ADAPTER_DISABLE, |
905 | + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); |
906 | |
907 | if (splitter_base) { |
908 | val = readl(splitter_base + EMAC_SPLITTER_CTRL_REG); |
909 | @@ -91,9 +96,7 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed) |
910 | writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG); |
911 | } |
912 | |
913 | - writew(SGMII_ADAPTER_ENABLE, |
914 | - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); |
915 | - if (phy_dev) |
916 | + if (tse_pcs_base && sgmii_adapter_base) |
917 | tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed); |
918 | } |
919 | |
920 | diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c |
921 | index 1f9a6ea356b02..cdcc860607492 100644 |
922 | --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c |
923 | +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c |
924 | @@ -817,10 +817,10 @@ static int xemaclite_mdio_write(struct mii_bus *bus, int phy_id, int reg, |
925 | static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) |
926 | { |
927 | struct mii_bus *bus; |
928 | - int rc; |
929 | struct resource res; |
930 | struct device_node *np = of_get_parent(lp->phy_node); |
931 | struct device_node *npp; |
932 | + int rc, ret; |
933 | |
934 | /* Don't register the MDIO bus if the phy_node or its parent node |
935 | * can't be found. |
936 | @@ -830,8 +830,14 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) |
937 | return -ENODEV; |
938 | } |
939 | npp = of_get_parent(np); |
940 | - |
941 | - of_address_to_resource(npp, 0, &res); |
942 | + ret = of_address_to_resource(npp, 0, &res); |
943 | + of_node_put(npp); |
944 | + if (ret) { |
945 | + dev_err(dev, "%s resource error!\n", |
946 | + dev->of_node->full_name); |
947 | + of_node_put(np); |
948 | + return ret; |
949 | + } |
950 | if (lp->ndev->mem_start != res.start) { |
951 | struct phy_device *phydev; |
952 | phydev = of_phy_find_device(lp->phy_node); |
953 | @@ -840,6 +846,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) |
954 | "MDIO of the phy is not registered yet\n"); |
955 | else |
956 | put_device(&phydev->mdio.dev); |
957 | + of_node_put(np); |
958 | return 0; |
959 | } |
960 | |
961 | @@ -852,6 +859,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) |
962 | bus = mdiobus_alloc(); |
963 | if (!bus) { |
964 | dev_err(dev, "Failed to allocate mdiobus\n"); |
965 | + of_node_put(np); |
966 | return -ENOMEM; |
967 | } |
968 | |
969 | @@ -866,6 +874,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) |
970 | lp->mii_bus = bus; |
971 | |
972 | rc = of_mdiobus_register(bus, np); |
973 | + of_node_put(np); |
974 | if (rc) { |
975 | dev_err(dev, "Failed to register mdio bus.\n"); |
976 | goto err_register; |
977 | diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c |
978 | index 6f3519123eb66..0e1a422d9567e 100644 |
979 | --- a/drivers/net/hippi/rrunner.c |
980 | +++ b/drivers/net/hippi/rrunner.c |
981 | @@ -1354,7 +1354,9 @@ static int rr_close(struct net_device *dev) |
982 | |
983 | rrpriv->fw_running = 0; |
984 | |
985 | + spin_unlock_irqrestore(&rrpriv->lock, flags); |
986 | del_timer_sync(&rrpriv->timer); |
987 | + spin_lock_irqsave(&rrpriv->lock, flags); |
988 | |
989 | writel(0, ®s->TxPi); |
990 | writel(0, ®s->IpRxPi); |
991 | diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c |
992 | index a446590a71caf..cd44c1d27b12f 100644 |
993 | --- a/drivers/nfc/nfcmrvl/main.c |
994 | +++ b/drivers/nfc/nfcmrvl/main.c |
995 | @@ -194,6 +194,7 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv) |
996 | { |
997 | struct nci_dev *ndev = priv->ndev; |
998 | |
999 | + nci_unregister_device(ndev); |
1000 | if (priv->ndev->nfc_dev->fw_download_in_progress) |
1001 | nfcmrvl_fw_dnld_abort(priv); |
1002 | |
1003 | @@ -202,7 +203,6 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv) |
1004 | if (priv->config.reset_n_io) |
1005 | gpio_free(priv->config.reset_n_io); |
1006 | |
1007 | - nci_unregister_device(ndev); |
1008 | nci_free_device(ndev); |
1009 | kfree(priv); |
1010 | } |
1011 | diff --git a/drivers/phy/phy-exynos5250-sata.c b/drivers/phy/phy-exynos5250-sata.c |
1012 | index 60e13afcd9b84..2c39d2fd3cd80 100644 |
1013 | --- a/drivers/phy/phy-exynos5250-sata.c |
1014 | +++ b/drivers/phy/phy-exynos5250-sata.c |
1015 | @@ -193,6 +193,7 @@ static int exynos_sata_phy_probe(struct platform_device *pdev) |
1016 | return -EINVAL; |
1017 | |
1018 | sata_phy->client = of_find_i2c_device_by_node(node); |
1019 | + of_node_put(node); |
1020 | if (!sata_phy->client) |
1021 | return -EPROBE_DEFER; |
1022 | |
1023 | @@ -201,20 +202,21 @@ static int exynos_sata_phy_probe(struct platform_device *pdev) |
1024 | sata_phy->phyclk = devm_clk_get(dev, "sata_phyctrl"); |
1025 | if (IS_ERR(sata_phy->phyclk)) { |
1026 | dev_err(dev, "failed to get clk for PHY\n"); |
1027 | - return PTR_ERR(sata_phy->phyclk); |
1028 | + ret = PTR_ERR(sata_phy->phyclk); |
1029 | + goto put_dev; |
1030 | } |
1031 | |
1032 | ret = clk_prepare_enable(sata_phy->phyclk); |
1033 | if (ret < 0) { |
1034 | dev_err(dev, "failed to enable source clk\n"); |
1035 | - return ret; |
1036 | + goto put_dev; |
1037 | } |
1038 | |
1039 | sata_phy->phy = devm_phy_create(dev, NULL, &exynos_sata_phy_ops); |
1040 | if (IS_ERR(sata_phy->phy)) { |
1041 | - clk_disable_unprepare(sata_phy->phyclk); |
1042 | dev_err(dev, "failed to create PHY\n"); |
1043 | - return PTR_ERR(sata_phy->phy); |
1044 | + ret = PTR_ERR(sata_phy->phy); |
1045 | + goto clk_disable; |
1046 | } |
1047 | |
1048 | phy_set_drvdata(sata_phy->phy, sata_phy); |
1049 | @@ -222,11 +224,18 @@ static int exynos_sata_phy_probe(struct platform_device *pdev) |
1050 | phy_provider = devm_of_phy_provider_register(dev, |
1051 | of_phy_simple_xlate); |
1052 | if (IS_ERR(phy_provider)) { |
1053 | - clk_disable_unprepare(sata_phy->phyclk); |
1054 | - return PTR_ERR(phy_provider); |
1055 | + ret = PTR_ERR(phy_provider); |
1056 | + goto clk_disable; |
1057 | } |
1058 | |
1059 | return 0; |
1060 | + |
1061 | +clk_disable: |
1062 | + clk_disable_unprepare(sata_phy->phyclk); |
1063 | +put_dev: |
1064 | + put_device(&sata_phy->client->dev); |
1065 | + |
1066 | + return ret; |
1067 | } |
1068 | |
1069 | static const struct of_device_id exynos_sata_phy_of_match[] = { |
1070 | diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c |
1071 | index b2b7e238bda97..fc8c57527fb78 100644 |
1072 | --- a/drivers/pinctrl/pinctrl-pistachio.c |
1073 | +++ b/drivers/pinctrl/pinctrl-pistachio.c |
1074 | @@ -1374,10 +1374,10 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) |
1075 | } |
1076 | |
1077 | irq = irq_of_parse_and_map(child, 0); |
1078 | - if (irq < 0) { |
1079 | - dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq); |
1080 | + if (!irq) { |
1081 | + dev_err(pctl->dev, "No IRQ for bank %u\n", i); |
1082 | of_node_put(child); |
1083 | - ret = irq; |
1084 | + ret = -EINVAL; |
1085 | goto err; |
1086 | } |
1087 | |
1088 | diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c |
1089 | index 2311f8a635a6f..3badb10229ef5 100644 |
1090 | --- a/drivers/tty/n_gsm.c |
1091 | +++ b/drivers/tty/n_gsm.c |
1092 | @@ -84,6 +84,8 @@ module_param(debug, int, 0600); |
1093 | */ |
1094 | #define MAX_MRU 1500 |
1095 | #define MAX_MTU 1500 |
1096 | +/* SOF, ADDR, CTRL, LEN1, LEN2, ..., FCS, EOF */ |
1097 | +#define PROT_OVERHEAD 7 |
1098 | #define GSM_NET_TX_TIMEOUT (HZ*10) |
1099 | |
1100 | /** |
1101 | @@ -839,7 +841,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) |
1102 | break; |
1103 | case 2: /* Unstructed with modem bits. |
1104 | Always one byte as we never send inline break data */ |
1105 | - *dp++ = gsm_encode_modem(dlci); |
1106 | + *dp++ = (gsm_encode_modem(dlci) << 1) | EA; |
1107 | break; |
1108 | } |
1109 | WARN_ON(kfifo_out_locked(dlci->fifo, dp , len, &dlci->lock) != len); |
1110 | @@ -1316,11 +1318,12 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command, |
1111 | |
1112 | static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl) |
1113 | { |
1114 | - struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, gsm->ftype); |
1115 | + struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 2, gsm->ftype); |
1116 | if (msg == NULL) |
1117 | return; |
1118 | - msg->data[0] = (ctrl->cmd << 1) | 2 | EA; /* command */ |
1119 | - memcpy(msg->data + 1, ctrl->data, ctrl->len); |
1120 | + msg->data[0] = (ctrl->cmd << 1) | CR | EA; /* command */ |
1121 | + msg->data[1] = (ctrl->len << 1) | EA; |
1122 | + memcpy(msg->data + 2, ctrl->data, ctrl->len); |
1123 | gsm_data_queue(gsm->dlci[0], msg); |
1124 | } |
1125 | |
1126 | @@ -1343,7 +1346,6 @@ static void gsm_control_retransmit(unsigned long data) |
1127 | spin_lock_irqsave(&gsm->control_lock, flags); |
1128 | ctrl = gsm->pending_cmd; |
1129 | if (ctrl) { |
1130 | - gsm->cretries--; |
1131 | if (gsm->cretries == 0) { |
1132 | gsm->pending_cmd = NULL; |
1133 | ctrl->error = -ETIMEDOUT; |
1134 | @@ -1352,6 +1354,7 @@ static void gsm_control_retransmit(unsigned long data) |
1135 | wake_up(&gsm->event); |
1136 | return; |
1137 | } |
1138 | + gsm->cretries--; |
1139 | gsm_control_transmit(gsm, ctrl); |
1140 | mod_timer(&gsm->t2_timer, jiffies + gsm->t2 * HZ / 100); |
1141 | } |
1142 | @@ -1392,7 +1395,7 @@ retry: |
1143 | |
1144 | /* If DLCI0 is in ADM mode skip retries, it won't respond */ |
1145 | if (gsm->dlci[0]->mode == DLCI_MODE_ADM) |
1146 | - gsm->cretries = 1; |
1147 | + gsm->cretries = 0; |
1148 | else |
1149 | gsm->cretries = gsm->n2; |
1150 | |
1151 | @@ -1826,7 +1829,6 @@ static void gsm_queue(struct gsm_mux *gsm) |
1152 | gsm_response(gsm, address, UA); |
1153 | gsm_dlci_close(dlci); |
1154 | break; |
1155 | - case UA: |
1156 | case UA|PF: |
1157 | if (cr == 0 || dlci == NULL) |
1158 | break; |
1159 | @@ -1977,7 +1979,8 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c) |
1160 | } |
1161 | /* Any partial frame was a runt so go back to start */ |
1162 | if (gsm->state != GSM_START) { |
1163 | - gsm->malformed++; |
1164 | + if (gsm->state != GSM_SEARCH) |
1165 | + gsm->malformed++; |
1166 | gsm->state = GSM_START; |
1167 | } |
1168 | /* A SOF in GSM_START means we are still reading idling or |
1169 | @@ -2098,6 +2101,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm) |
1170 | gsm_dlci_release(gsm->dlci[i]); |
1171 | mutex_unlock(&gsm->mutex); |
1172 | /* Now wipe the queues */ |
1173 | + tty_ldisc_flush(gsm->tty); |
1174 | list_for_each_entry_safe(txq, ntxq, &gsm->tx_list, list) |
1175 | kfree(txq); |
1176 | INIT_LIST_HEAD(&gsm->tx_list); |
1177 | @@ -2198,7 +2202,7 @@ static struct gsm_mux *gsm_alloc_mux(void) |
1178 | kfree(gsm); |
1179 | return NULL; |
1180 | } |
1181 | - gsm->txframe = kmalloc(2 * MAX_MRU + 2, GFP_KERNEL); |
1182 | + gsm->txframe = kmalloc(2 * (MAX_MTU + PROT_OVERHEAD - 1), GFP_KERNEL); |
1183 | if (gsm->txframe == NULL) { |
1184 | kfree(gsm->buf); |
1185 | kfree(gsm); |
1186 | @@ -2515,7 +2519,7 @@ static int gsmld_config(struct tty_struct *tty, struct gsm_mux *gsm, |
1187 | /* Check the MRU/MTU range looks sane */ |
1188 | if (c->mru > MAX_MRU || c->mtu > MAX_MTU || c->mru < 8 || c->mtu < 8) |
1189 | return -EINVAL; |
1190 | - if (c->n2 < 3) |
1191 | + if (c->n2 > 255) |
1192 | return -EINVAL; |
1193 | if (c->encapsulation > 1) /* Basic, advanced, no I */ |
1194 | return -EINVAL; |
1195 | @@ -2860,19 +2864,17 @@ static struct tty_ldisc_ops tty_ldisc_packet = { |
1196 | |
1197 | static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk) |
1198 | { |
1199 | - u8 modembits[5]; |
1200 | + u8 modembits[3]; |
1201 | struct gsm_control *ctrl; |
1202 | int len = 2; |
1203 | |
1204 | - if (brk) |
1205 | + modembits[0] = (dlci->addr << 2) | 2 | EA; /* DLCI, Valid, EA */ |
1206 | + modembits[1] = (gsm_encode_modem(dlci) << 1) | EA; |
1207 | + if (brk) { |
1208 | + modembits[2] = (brk << 4) | 2 | EA; /* Length, Break, EA */ |
1209 | len++; |
1210 | - |
1211 | - modembits[0] = len << 1 | EA; /* Data bytes */ |
1212 | - modembits[1] = dlci->addr << 2 | 3; /* DLCI, EA, 1 */ |
1213 | - modembits[2] = gsm_encode_modem(dlci) << 1 | EA; |
1214 | - if (brk) |
1215 | - modembits[3] = brk << 4 | 2 | EA; /* Valid, EA */ |
1216 | - ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len + 1); |
1217 | + } |
1218 | + ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len); |
1219 | if (ctrl == NULL) |
1220 | return -ENOMEM; |
1221 | return gsm_control_wait(dlci->gsm, ctrl); |
1222 | diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c |
1223 | index 3973bbd5ee553..a54dc0375ac68 100644 |
1224 | --- a/drivers/tty/serial/8250/8250_pci.c |
1225 | +++ b/drivers/tty/serial/8250/8250_pci.c |
1226 | @@ -2915,7 +2915,7 @@ enum pci_board_num_t { |
1227 | pbn_panacom2, |
1228 | pbn_panacom4, |
1229 | pbn_plx_romulus, |
1230 | - pbn_endrun_2_4000000, |
1231 | + pbn_endrun_2_3906250, |
1232 | pbn_oxsemi, |
1233 | pbn_oxsemi_1_4000000, |
1234 | pbn_oxsemi_2_4000000, |
1235 | @@ -3479,10 +3479,10 @@ static struct pciserial_board pci_boards[] = { |
1236 | * signal now many ports are available |
1237 | * 2 port 952 Uart support |
1238 | */ |
1239 | - [pbn_endrun_2_4000000] = { |
1240 | + [pbn_endrun_2_3906250] = { |
1241 | .flags = FL_BASE0, |
1242 | .num_ports = 2, |
1243 | - .base_baud = 4000000, |
1244 | + .base_baud = 3906250, |
1245 | .uart_offset = 0x200, |
1246 | .first_offset = 0x1000, |
1247 | }, |
1248 | @@ -4430,7 +4430,7 @@ static struct pci_device_id serial_pci_tbl[] = { |
1249 | */ |
1250 | { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588, |
1251 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
1252 | - pbn_endrun_2_4000000 }, |
1253 | + pbn_endrun_2_3906250 }, |
1254 | /* |
1255 | * Quatech cards. These actually have configurable clocks but for |
1256 | * now we just use the default. |
1257 | diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
1258 | index 460c35b2b54d9..2d83f1dfb4d69 100644 |
1259 | --- a/drivers/tty/serial/8250/8250_port.c |
1260 | +++ b/drivers/tty/serial/8250/8250_port.c |
1261 | @@ -3150,7 +3150,7 @@ static void serial8250_console_restore(struct uart_8250_port *up) |
1262 | |
1263 | serial8250_set_divisor(port, baud, quot, frac); |
1264 | serial_port_out(port, UART_LCR, up->lcr); |
1265 | - serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS); |
1266 | + serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS); |
1267 | } |
1268 | |
1269 | /* |
1270 | diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
1271 | index 2ca6ed207e26e..bba74e9b7da0f 100644 |
1272 | --- a/drivers/usb/core/quirks.c |
1273 | +++ b/drivers/usb/core/quirks.c |
1274 | @@ -243,6 +243,9 @@ static const struct usb_device_id usb_quirk_list[] = { |
1275 | { USB_DEVICE(0x0b05, 0x17e0), .driver_info = |
1276 | USB_QUIRK_IGNORE_REMOTE_WAKEUP }, |
1277 | |
1278 | + /* Realtek Semiconductor Corp. Mass Storage Device (Multicard Reader)*/ |
1279 | + { USB_DEVICE(0x0bda, 0x0151), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, |
1280 | + |
1281 | /* Realtek hub in Dell WD19 (Type-C) */ |
1282 | { USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM }, |
1283 | { USB_DEVICE(0x0bda, 0x5487), .driver_info = USB_QUIRK_RESET_RESUME }, |
1284 | @@ -325,6 +328,9 @@ static const struct usb_device_id usb_quirk_list[] = { |
1285 | /* DJI CineSSD */ |
1286 | { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, |
1287 | |
1288 | + /* VCOM device */ |
1289 | + { USB_DEVICE(0x4296, 0x7570), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, |
1290 | + |
1291 | /* INTEL VALUE SSD */ |
1292 | { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, |
1293 | |
1294 | diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c |
1295 | index fe1b54a8fb0c8..4653eeb10e0e4 100644 |
1296 | --- a/drivers/usb/gadget/configfs.c |
1297 | +++ b/drivers/usb/gadget/configfs.c |
1298 | @@ -1409,6 +1409,8 @@ static void configfs_composite_unbind(struct usb_gadget *gadget) |
1299 | usb_ep_autoconfig_reset(cdev->gadget); |
1300 | spin_lock_irqsave(&gi->spinlock, flags); |
1301 | cdev->gadget = NULL; |
1302 | + cdev->deactivations = 0; |
1303 | + gadget->deactivated = false; |
1304 | set_gadget_data(gadget, NULL); |
1305 | spin_unlock_irqrestore(&gi->spinlock, flags); |
1306 | } |
1307 | diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c |
1308 | index 6377e9fee6e59..dadf6e5073801 100644 |
1309 | --- a/drivers/usb/gadget/function/uvc_queue.c |
1310 | +++ b/drivers/usb/gadget/function/uvc_queue.c |
1311 | @@ -246,6 +246,8 @@ void uvcg_queue_cancel(struct uvc_video_queue *queue, int disconnect) |
1312 | buf->state = UVC_BUF_STATE_ERROR; |
1313 | vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_ERROR); |
1314 | } |
1315 | + queue->buf_used = 0; |
1316 | + |
1317 | /* This must be protected by the irqlock spinlock to avoid race |
1318 | * conditions between uvc_queue_buffer and the disconnection event that |
1319 | * could result in an interruptible wait in uvc_dequeue_buffer. Do not |
1320 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
1321 | index a08369cb3462f..ebf09503be394 100644 |
1322 | --- a/drivers/usb/host/xhci.c |
1323 | +++ b/drivers/usb/host/xhci.c |
1324 | @@ -746,6 +746,17 @@ void xhci_shutdown(struct usb_hcd *hcd) |
1325 | if (xhci->quirks & XHCI_SPURIOUS_REBOOT) |
1326 | usb_disable_xhci_ports(to_pci_dev(hcd->self.controller)); |
1327 | |
1328 | + /* Don't poll the roothubs after shutdown. */ |
1329 | + xhci_dbg(xhci, "%s: stopping usb%d port polling.\n", |
1330 | + __func__, hcd->self.busnum); |
1331 | + clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); |
1332 | + del_timer_sync(&hcd->rh_timer); |
1333 | + |
1334 | + if (xhci->shared_hcd) { |
1335 | + clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); |
1336 | + del_timer_sync(&xhci->shared_hcd->rh_timer); |
1337 | + } |
1338 | + |
1339 | spin_lock_irq(&xhci->lock); |
1340 | xhci_halt(xhci); |
1341 | /* Workaround for spurious wakeups at shutdown with HSW */ |
1342 | diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c |
1343 | index 0ec6d76d1563b..08517d475d463 100644 |
1344 | --- a/drivers/usb/misc/uss720.c |
1345 | +++ b/drivers/usb/misc/uss720.c |
1346 | @@ -87,6 +87,7 @@ static void destroy_priv(struct kref *kref) |
1347 | |
1348 | dev_dbg(&priv->usbdev->dev, "destroying priv datastructure\n"); |
1349 | usb_put_dev(priv->usbdev); |
1350 | + priv->usbdev = NULL; |
1351 | kfree(priv); |
1352 | } |
1353 | |
1354 | @@ -750,7 +751,6 @@ static int uss720_probe(struct usb_interface *intf, |
1355 | parport_announce_port(pp); |
1356 | |
1357 | usb_set_intfdata(intf, pp); |
1358 | - usb_put_dev(usbdev); |
1359 | return 0; |
1360 | |
1361 | probe_abort: |
1362 | @@ -770,7 +770,6 @@ static void uss720_disconnect(struct usb_interface *intf) |
1363 | if (pp) { |
1364 | priv = pp->private_data; |
1365 | usbdev = priv->usbdev; |
1366 | - priv->usbdev = NULL; |
1367 | priv->pp = NULL; |
1368 | dev_dbg(&intf->dev, "parport_remove_port\n"); |
1369 | parport_remove_port(pp); |
1370 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
1371 | index ddee42e44a33b..b0c98c61c53af 100644 |
1372 | --- a/drivers/usb/serial/cp210x.c |
1373 | +++ b/drivers/usb/serial/cp210x.c |
1374 | @@ -192,6 +192,8 @@ static const struct usb_device_id id_table[] = { |
1375 | { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */ |
1376 | { USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */ |
1377 | { USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D */ |
1378 | + { USB_DEVICE(0x17A8, 0x0101) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Int Ant) */ |
1379 | + { USB_DEVICE(0x17A8, 0x0102) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Ext Ant) */ |
1380 | { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ |
1381 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ |
1382 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ |
1383 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
1384 | index c5d0d9e2bff2d..3fcf53e85adbb 100644 |
1385 | --- a/drivers/usb/serial/option.c |
1386 | +++ b/drivers/usb/serial/option.c |
1387 | @@ -430,6 +430,8 @@ static void option_instat_callback(struct urb *urb); |
1388 | #define CINTERION_PRODUCT_CLS8 0x00b0 |
1389 | #define CINTERION_PRODUCT_MV31_MBIM 0x00b3 |
1390 | #define CINTERION_PRODUCT_MV31_RMNET 0x00b7 |
1391 | +#define CINTERION_PRODUCT_MV32_WA 0x00f1 |
1392 | +#define CINTERION_PRODUCT_MV32_WB 0x00f2 |
1393 | |
1394 | /* Olivetti products */ |
1395 | #define OLIVETTI_VENDOR_ID 0x0b3c |
1396 | @@ -1193,6 +1195,10 @@ static const struct usb_device_id option_ids[] = { |
1397 | .driver_info = NCTRL(0) | RSVD(1) }, |
1398 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */ |
1399 | .driver_info = NCTRL(2) | RSVD(3) }, |
1400 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1057, 0xff), /* Telit FN980 */ |
1401 | + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
1402 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1058, 0xff), /* Telit FN980 (PCIe) */ |
1403 | + .driver_info = NCTRL(0) | RSVD(1) }, |
1404 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1060, 0xff), /* Telit LN920 (rmnet) */ |
1405 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
1406 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1061, 0xff), /* Telit LN920 (MBIM) */ |
1407 | @@ -1209,6 +1215,8 @@ static const struct usb_device_id option_ids[] = { |
1408 | .driver_info = NCTRL(2) | RSVD(3) }, |
1409 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */ |
1410 | .driver_info = NCTRL(0) | RSVD(1) }, |
1411 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990 (PCIe) */ |
1412 | + .driver_info = RSVD(0) }, |
1413 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), |
1414 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, |
1415 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), |
1416 | @@ -1945,6 +1953,10 @@ static const struct usb_device_id option_ids[] = { |
1417 | .driver_info = RSVD(3)}, |
1418 | { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_RMNET, 0xff), |
1419 | .driver_info = RSVD(0)}, |
1420 | + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff), |
1421 | + .driver_info = RSVD(3)}, |
1422 | + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff), |
1423 | + .driver_info = RSVD(3)}, |
1424 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100), |
1425 | .driver_info = RSVD(4) }, |
1426 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120), |
1427 | diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c |
1428 | index 345211f1a4915..1dd65019eea14 100644 |
1429 | --- a/drivers/usb/serial/whiteheat.c |
1430 | +++ b/drivers/usb/serial/whiteheat.c |
1431 | @@ -644,9 +644,8 @@ static int firm_send_command(struct usb_serial_port *port, __u8 command, |
1432 | switch (command) { |
1433 | case WHITEHEAT_GET_DTR_RTS: |
1434 | info = usb_get_serial_port_data(port); |
1435 | - memcpy(&info->mcr, command_info->result_buffer, |
1436 | - sizeof(struct whiteheat_dr_info)); |
1437 | - break; |
1438 | + info->mcr = command_info->result_buffer[0]; |
1439 | + break; |
1440 | } |
1441 | } |
1442 | exit: |
1443 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
1444 | index cc91b0c564a38..312c050d0dbde 100644 |
1445 | --- a/fs/btrfs/tree-log.c |
1446 | +++ b/fs/btrfs/tree-log.c |
1447 | @@ -4696,6 +4696,18 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, |
1448 | mutex_lock(&BTRFS_I(inode)->log_mutex); |
1449 | } |
1450 | |
1451 | + /* |
1452 | + * For symlinks, we must always log their content, which is stored in an |
1453 | + * inline extent, otherwise we could end up with an empty symlink after |
1454 | + * log replay, which is invalid on linux (symlink(2) returns -ENOENT if |
1455 | + * one attempts to create an empty symlink). |
1456 | + * We don't need to worry about flushing delalloc, because when we create |
1457 | + * the inline extent when the symlink is created (we never have delalloc |
1458 | + * for symlinks). |
1459 | + */ |
1460 | + if (S_ISLNK(inode->i_mode)) |
1461 | + inode_only = LOG_INODE_ALL; |
1462 | + |
1463 | /* |
1464 | * a brute force approach to making sure we get the most uptodate |
1465 | * copies of everything. |
1466 | @@ -5271,7 +5283,7 @@ process_leaf: |
1467 | } |
1468 | |
1469 | ctx->log_new_dentries = false; |
1470 | - if (type == BTRFS_FT_DIR || type == BTRFS_FT_SYMLINK) |
1471 | + if (type == BTRFS_FT_DIR) |
1472 | log_mode = LOG_INODE_ALL; |
1473 | ret = btrfs_log_inode(trans, root, di_inode, |
1474 | log_mode, 0, LLONG_MAX, ctx); |
1475 | diff --git a/include/linux/kernel.h b/include/linux/kernel.h |
1476 | index d83fc669eeac7..e779833096347 100644 |
1477 | --- a/include/linux/kernel.h |
1478 | +++ b/include/linux/kernel.h |
1479 | @@ -530,7 +530,7 @@ static inline char *hex_byte_pack_upper(char *buf, u8 byte) |
1480 | return buf; |
1481 | } |
1482 | |
1483 | -extern int hex_to_bin(char ch); |
1484 | +extern int hex_to_bin(unsigned char ch); |
1485 | extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); |
1486 | extern char *bin2hex(char *dst, const void *src, size_t count); |
1487 | |
1488 | diff --git a/include/net/tcp.h b/include/net/tcp.h |
1489 | index f26f075250b48..97df2f6fcbd79 100644 |
1490 | --- a/include/net/tcp.h |
1491 | +++ b/include/net/tcp.h |
1492 | @@ -579,6 +579,7 @@ void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req); |
1493 | void tcp_reset(struct sock *sk); |
1494 | void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb); |
1495 | void tcp_fin(struct sock *sk); |
1496 | +void tcp_check_space(struct sock *sk); |
1497 | |
1498 | /* tcp_timer.c */ |
1499 | void tcp_init_xmit_timers(struct sock *); |
1500 | diff --git a/lib/hexdump.c b/lib/hexdump.c |
1501 | index 992457b1284c1..570b232757047 100644 |
1502 | --- a/lib/hexdump.c |
1503 | +++ b/lib/hexdump.c |
1504 | @@ -24,15 +24,33 @@ EXPORT_SYMBOL(hex_asc_upper); |
1505 | * |
1506 | * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad |
1507 | * input. |
1508 | + * |
1509 | + * This function is used to load cryptographic keys, so it is coded in such a |
1510 | + * way that there are no conditions or memory accesses that depend on data. |
1511 | + * |
1512 | + * Explanation of the logic: |
1513 | + * (ch - '9' - 1) is negative if ch <= '9' |
1514 | + * ('0' - 1 - ch) is negative if ch >= '0' |
1515 | + * we "and" these two values, so the result is negative if ch is in the range |
1516 | + * '0' ... '9' |
1517 | + * we are only interested in the sign, so we do a shift ">> 8"; note that right |
1518 | + * shift of a negative value is implementation-defined, so we cast the |
1519 | + * value to (unsigned) before the shift --- we have 0xffffff if ch is in |
1520 | + * the range '0' ... '9', 0 otherwise |
1521 | + * we "and" this value with (ch - '0' + 1) --- we have a value 1 ... 10 if ch is |
1522 | + * in the range '0' ... '9', 0 otherwise |
1523 | + * we add this value to -1 --- we have a value 0 ... 9 if ch is in the range '0' |
1524 | + * ... '9', -1 otherwise |
1525 | + * the next line is similar to the previous one, but we need to decode both |
1526 | + * uppercase and lowercase letters, so we use (ch & 0xdf), which converts |
1527 | + * lowercase to uppercase |
1528 | */ |
1529 | -int hex_to_bin(char ch) |
1530 | +int hex_to_bin(unsigned char ch) |
1531 | { |
1532 | - if ((ch >= '0') && (ch <= '9')) |
1533 | - return ch - '0'; |
1534 | - ch = tolower(ch); |
1535 | - if ((ch >= 'a') && (ch <= 'f')) |
1536 | - return ch - 'a' + 10; |
1537 | - return -1; |
1538 | + unsigned char cu = ch & 0xdf; |
1539 | + return -1 + |
1540 | + ((ch - '0' + 1) & (unsigned)((ch - '9' - 1) & ('0' - 1 - ch)) >> 8) + |
1541 | + ((cu - 'A' + 11) & (unsigned)((cu - 'F' - 1) & ('A' - 1 - cu)) >> 8); |
1542 | } |
1543 | EXPORT_SYMBOL(hex_to_bin); |
1544 | |
1545 | @@ -47,10 +65,13 @@ EXPORT_SYMBOL(hex_to_bin); |
1546 | int hex2bin(u8 *dst, const char *src, size_t count) |
1547 | { |
1548 | while (count--) { |
1549 | - int hi = hex_to_bin(*src++); |
1550 | - int lo = hex_to_bin(*src++); |
1551 | + int hi, lo; |
1552 | |
1553 | - if ((hi < 0) || (lo < 0)) |
1554 | + hi = hex_to_bin(*src++); |
1555 | + if (unlikely(hi < 0)) |
1556 | + return -1; |
1557 | + lo = hex_to_bin(*src++); |
1558 | + if (unlikely(lo < 0)) |
1559 | return -1; |
1560 | |
1561 | *dst++ = (hi << 4) | lo; |
1562 | diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c |
1563 | index 381fc854ad199..75f961425639e 100644 |
1564 | --- a/net/ipv4/igmp.c |
1565 | +++ b/net/ipv4/igmp.c |
1566 | @@ -2360,9 +2360,10 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct |
1567 | newpsl->sl_addr[i] = psl->sl_addr[i]; |
1568 | /* decrease mem now to avoid the memleak warning */ |
1569 | atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc); |
1570 | - kfree_rcu(psl, rcu); |
1571 | } |
1572 | rcu_assign_pointer(pmc->sflist, newpsl); |
1573 | + if (psl) |
1574 | + kfree_rcu(psl, rcu); |
1575 | psl = newpsl; |
1576 | } |
1577 | rv = 1; /* > 0 for insert logic below if sl_count is 0 */ |
1578 | @@ -2460,11 +2461,13 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex) |
1579 | psl->sl_count, psl->sl_addr, 0); |
1580 | /* decrease mem now to avoid the memleak warning */ |
1581 | atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc); |
1582 | - kfree_rcu(psl, rcu); |
1583 | - } else |
1584 | + } else { |
1585 | (void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode, |
1586 | 0, NULL, 0); |
1587 | + } |
1588 | rcu_assign_pointer(pmc->sflist, newpsl); |
1589 | + if (psl) |
1590 | + kfree_rcu(psl, rcu); |
1591 | pmc->sfmode = msf->imsf_fmode; |
1592 | err = 0; |
1593 | done: |
1594 | diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c |
1595 | index fe1801d9f0598..eec225c637f05 100644 |
1596 | --- a/net/ipv4/ip_gre.c |
1597 | +++ b/net/ipv4/ip_gre.c |
1598 | @@ -339,14 +339,12 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev, |
1599 | __be16 proto) |
1600 | { |
1601 | struct ip_tunnel *tunnel = netdev_priv(dev); |
1602 | - |
1603 | - if (tunnel->parms.o_flags & TUNNEL_SEQ) |
1604 | - tunnel->o_seqno++; |
1605 | + __be16 flags = tunnel->parms.o_flags; |
1606 | |
1607 | /* Push GRE header. */ |
1608 | gre_build_header(skb, tunnel->tun_hlen, |
1609 | - tunnel->parms.o_flags, proto, tunnel->parms.o_key, |
1610 | - htonl(tunnel->o_seqno)); |
1611 | + flags, proto, tunnel->parms.o_key, |
1612 | + (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0); |
1613 | |
1614 | ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol); |
1615 | } |
1616 | diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
1617 | index 01c73775ed007..7f48f85042843 100644 |
1618 | --- a/net/ipv4/tcp_input.c |
1619 | +++ b/net/ipv4/tcp_input.c |
1620 | @@ -5159,7 +5159,17 @@ static void tcp_new_space(struct sock *sk) |
1621 | sk->sk_write_space(sk); |
1622 | } |
1623 | |
1624 | -static void tcp_check_space(struct sock *sk) |
1625 | +/* Caller made space either from: |
1626 | + * 1) Freeing skbs in rtx queues (after tp->snd_una has advanced) |
1627 | + * 2) Sent skbs from output queue (and thus advancing tp->snd_nxt) |
1628 | + * |
1629 | + * We might be able to generate EPOLLOUT to the application if: |
1630 | + * 1) Space consumed in output/rtx queues is below sk->sk_sndbuf/2 |
1631 | + * 2) notsent amount (tp->write_seq - tp->snd_nxt) became |
1632 | + * small enough that tcp_stream_memory_free() decides it |
1633 | + * is time to generate EPOLLOUT. |
1634 | + */ |
1635 | +void tcp_check_space(struct sock *sk) |
1636 | { |
1637 | if (sock_flag(sk, SOCK_QUEUE_SHRUNK)) { |
1638 | sock_reset_flag(sk, SOCK_QUEUE_SHRUNK); |
1639 | diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
1640 | index aafea53c7c068..95b0f486cb105 100644 |
1641 | --- a/net/ipv4/tcp_output.c |
1642 | +++ b/net/ipv4/tcp_output.c |
1643 | @@ -83,6 +83,7 @@ static void tcp_event_new_data_sent(struct sock *sk, const struct sk_buff *skb) |
1644 | |
1645 | NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPORIGDATASENT, |
1646 | tcp_skb_pcount(skb)); |
1647 | + tcp_check_space(sk); |
1648 | } |
1649 | |
1650 | /* SND.NXT, if window was not shrunk. |
1651 | diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
1652 | index 6119ab33a56ea..30ca73c781253 100644 |
1653 | --- a/net/ipv6/addrconf.c |
1654 | +++ b/net/ipv6/addrconf.c |
1655 | @@ -3539,6 +3539,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) |
1656 | struct list_head del_list; |
1657 | int _keep_addr; |
1658 | bool keep_addr; |
1659 | + bool was_ready; |
1660 | int state, i; |
1661 | |
1662 | ASSERT_RTNL(); |
1663 | @@ -3602,7 +3603,10 @@ restart: |
1664 | |
1665 | addrconf_del_rs_timer(idev); |
1666 | |
1667 | - /* Step 2: clear flags for stateless addrconf */ |
1668 | + /* Step 2: clear flags for stateless addrconf, repeated down |
1669 | + * detection |
1670 | + */ |
1671 | + was_ready = idev->if_flags & IF_READY; |
1672 | if (!how) |
1673 | idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY); |
1674 | |
1675 | @@ -3689,7 +3693,7 @@ restart: |
1676 | if (how) { |
1677 | ipv6_ac_destroy_dev(idev); |
1678 | ipv6_mc_destroy_dev(idev); |
1679 | - } else { |
1680 | + } else if (was_ready) { |
1681 | ipv6_mc_down(idev); |
1682 | } |
1683 | |
1684 | diff --git a/net/nfc/core.c b/net/nfc/core.c |
1685 | index 32a2dfc08f480..8c38a21fb0c69 100644 |
1686 | --- a/net/nfc/core.c |
1687 | +++ b/net/nfc/core.c |
1688 | @@ -50,7 +50,7 @@ int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name) |
1689 | |
1690 | device_lock(&dev->dev); |
1691 | |
1692 | - if (!device_is_registered(&dev->dev)) { |
1693 | + if (dev->shutting_down) { |
1694 | rc = -ENODEV; |
1695 | goto error; |
1696 | } |
1697 | @@ -106,7 +106,7 @@ int nfc_dev_up(struct nfc_dev *dev) |
1698 | |
1699 | device_lock(&dev->dev); |
1700 | |
1701 | - if (!device_is_registered(&dev->dev)) { |
1702 | + if (dev->shutting_down) { |
1703 | rc = -ENODEV; |
1704 | goto error; |
1705 | } |
1706 | @@ -154,7 +154,7 @@ int nfc_dev_down(struct nfc_dev *dev) |
1707 | |
1708 | device_lock(&dev->dev); |
1709 | |
1710 | - if (!device_is_registered(&dev->dev)) { |
1711 | + if (dev->shutting_down) { |
1712 | rc = -ENODEV; |
1713 | goto error; |
1714 | } |
1715 | @@ -218,7 +218,7 @@ int nfc_start_poll(struct nfc_dev *dev, u32 im_protocols, u32 tm_protocols) |
1716 | |
1717 | device_lock(&dev->dev); |
1718 | |
1719 | - if (!device_is_registered(&dev->dev)) { |
1720 | + if (dev->shutting_down) { |
1721 | rc = -ENODEV; |
1722 | goto error; |
1723 | } |
1724 | @@ -257,7 +257,7 @@ int nfc_stop_poll(struct nfc_dev *dev) |
1725 | |
1726 | device_lock(&dev->dev); |
1727 | |
1728 | - if (!device_is_registered(&dev->dev)) { |
1729 | + if (dev->shutting_down) { |
1730 | rc = -ENODEV; |
1731 | goto error; |
1732 | } |
1733 | @@ -302,7 +302,7 @@ int nfc_dep_link_up(struct nfc_dev *dev, int target_index, u8 comm_mode) |
1734 | |
1735 | device_lock(&dev->dev); |
1736 | |
1737 | - if (!device_is_registered(&dev->dev)) { |
1738 | + if (dev->shutting_down) { |
1739 | rc = -ENODEV; |
1740 | goto error; |
1741 | } |
1742 | @@ -346,7 +346,7 @@ int nfc_dep_link_down(struct nfc_dev *dev) |
1743 | |
1744 | device_lock(&dev->dev); |
1745 | |
1746 | - if (!device_is_registered(&dev->dev)) { |
1747 | + if (dev->shutting_down) { |
1748 | rc = -ENODEV; |
1749 | goto error; |
1750 | } |
1751 | @@ -412,7 +412,7 @@ int nfc_activate_target(struct nfc_dev *dev, u32 target_idx, u32 protocol) |
1752 | |
1753 | device_lock(&dev->dev); |
1754 | |
1755 | - if (!device_is_registered(&dev->dev)) { |
1756 | + if (dev->shutting_down) { |
1757 | rc = -ENODEV; |
1758 | goto error; |
1759 | } |
1760 | @@ -458,7 +458,7 @@ int nfc_deactivate_target(struct nfc_dev *dev, u32 target_idx, u8 mode) |
1761 | |
1762 | device_lock(&dev->dev); |
1763 | |
1764 | - if (!device_is_registered(&dev->dev)) { |
1765 | + if (dev->shutting_down) { |
1766 | rc = -ENODEV; |
1767 | goto error; |
1768 | } |
1769 | @@ -505,7 +505,7 @@ int nfc_data_exchange(struct nfc_dev *dev, u32 target_idx, struct sk_buff *skb, |
1770 | |
1771 | device_lock(&dev->dev); |
1772 | |
1773 | - if (!device_is_registered(&dev->dev)) { |
1774 | + if (dev->shutting_down) { |
1775 | rc = -ENODEV; |
1776 | kfree_skb(skb); |
1777 | goto error; |
1778 | @@ -562,7 +562,7 @@ int nfc_enable_se(struct nfc_dev *dev, u32 se_idx) |
1779 | |
1780 | device_lock(&dev->dev); |
1781 | |
1782 | - if (!device_is_registered(&dev->dev)) { |
1783 | + if (dev->shutting_down) { |
1784 | rc = -ENODEV; |
1785 | goto error; |
1786 | } |
1787 | @@ -611,7 +611,7 @@ int nfc_disable_se(struct nfc_dev *dev, u32 se_idx) |
1788 | |
1789 | device_lock(&dev->dev); |
1790 | |
1791 | - if (!device_is_registered(&dev->dev)) { |
1792 | + if (dev->shutting_down) { |
1793 | rc = -ENODEV; |
1794 | goto error; |
1795 | } |
1796 | @@ -1142,6 +1142,7 @@ int nfc_register_device(struct nfc_dev *dev) |
1797 | dev->rfkill = NULL; |
1798 | } |
1799 | } |
1800 | + dev->shutting_down = false; |
1801 | device_unlock(&dev->dev); |
1802 | |
1803 | rc = nfc_genl_device_added(dev); |
1804 | @@ -1174,12 +1175,10 @@ void nfc_unregister_device(struct nfc_dev *dev) |
1805 | rfkill_unregister(dev->rfkill); |
1806 | rfkill_destroy(dev->rfkill); |
1807 | } |
1808 | + dev->shutting_down = true; |
1809 | device_unlock(&dev->dev); |
1810 | |
1811 | if (dev->ops->check_presence) { |
1812 | - device_lock(&dev->dev); |
1813 | - dev->shutting_down = true; |
1814 | - device_unlock(&dev->dev); |
1815 | del_timer_sync(&dev->check_pres_timer); |
1816 | cancel_work_sync(&dev->check_pres_work); |
1817 | } |
1818 | diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c |
1819 | index 6e771022d43e1..9750997643bba 100644 |
1820 | --- a/net/nfc/netlink.c |
1821 | +++ b/net/nfc/netlink.c |
1822 | @@ -1254,7 +1254,7 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name, |
1823 | struct sk_buff *msg; |
1824 | void *hdr; |
1825 | |
1826 | - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
1827 | + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); |
1828 | if (!msg) |
1829 | return -ENOMEM; |
1830 | |
1831 | @@ -1270,7 +1270,7 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name, |
1832 | |
1833 | genlmsg_end(msg, hdr); |
1834 | |
1835 | - genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); |
1836 | + genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); |
1837 | |
1838 | return 0; |
1839 | |
1840 | diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c |
1841 | index c1a4b5d30814a..330a2c9d19074 100644 |
1842 | --- a/net/sched/cls_api.c |
1843 | +++ b/net/sched/cls_api.c |
1844 | @@ -268,10 +268,13 @@ replay: |
1845 | err = -ENOENT; |
1846 | tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND]); |
1847 | if (tp_ops == NULL) { |
1848 | -#ifdef CONFIG_MODULES |
1849 | struct nlattr *kind = tca[TCA_KIND]; |
1850 | char name[IFNAMSIZ]; |
1851 | |
1852 | + if (cl) |
1853 | + cops->put(q, cl); |
1854 | + cl = 0; |
1855 | +#ifdef CONFIG_MODULES |
1856 | if (kind != NULL && |
1857 | nla_strlcpy(name, kind, IFNAMSIZ) < IFNAMSIZ) { |
1858 | rtnl_unlock(); |
1859 | diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c |
1860 | index bf20ea2606389..4e2c49cb692c8 100644 |
1861 | --- a/net/sunrpc/xprtsock.c |
1862 | +++ b/net/sunrpc/xprtsock.c |
1863 | @@ -2882,9 +2882,6 @@ static struct rpc_xprt *xs_setup_local(struct xprt_create *args) |
1864 | } |
1865 | xprt_set_bound(xprt); |
1866 | xs_format_peer_addresses(xprt, "local", RPCBIND_NETID_LOCAL); |
1867 | - ret = ERR_PTR(xs_local_setup_socket(transport)); |
1868 | - if (ret) |
1869 | - goto out_err; |
1870 | break; |
1871 | default: |
1872 | ret = ERR_PTR(-EAFNOSUPPORT); |
1873 | diff --git a/sound/firewire/fireworks/fireworks_hwdep.c b/sound/firewire/fireworks/fireworks_hwdep.c |
1874 | index 2e1d9a23920c0..09ba61f60699b 100644 |
1875 | --- a/sound/firewire/fireworks/fireworks_hwdep.c |
1876 | +++ b/sound/firewire/fireworks/fireworks_hwdep.c |
1877 | @@ -35,6 +35,7 @@ hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, long remained, |
1878 | type = SNDRV_FIREWIRE_EVENT_EFW_RESPONSE; |
1879 | if (copy_to_user(buf, &type, sizeof(type))) |
1880 | return -EFAULT; |
1881 | + count += sizeof(type); |
1882 | remained -= sizeof(type); |
1883 | buf += sizeof(type); |
1884 | |
1885 | diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c |
1886 | index 4f9a1eb281204..abe5e77ba171b 100644 |
1887 | --- a/sound/soc/codecs/wm8731.c |
1888 | +++ b/sound/soc/codecs/wm8731.c |
1889 | @@ -604,7 +604,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731) |
1890 | ret = wm8731_reset(wm8731->regmap); |
1891 | if (ret < 0) { |
1892 | dev_err(dev, "Failed to issue reset: %d\n", ret); |
1893 | - goto err_regulator_enable; |
1894 | + goto err; |
1895 | } |
1896 | |
1897 | /* Clear POWEROFF, keep everything else disabled */ |
1898 | @@ -621,10 +621,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731) |
1899 | |
1900 | regcache_mark_dirty(wm8731->regmap); |
1901 | |
1902 | -err_regulator_enable: |
1903 | - /* Regulators will be enabled by bias management */ |
1904 | - regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); |
1905 | - |
1906 | +err: |
1907 | return ret; |
1908 | } |
1909 | |
1910 | @@ -768,21 +765,27 @@ static int wm8731_i2c_probe(struct i2c_client *i2c, |
1911 | ret = PTR_ERR(wm8731->regmap); |
1912 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
1913 | ret); |
1914 | - return ret; |
1915 | + goto err_regulator_enable; |
1916 | } |
1917 | |
1918 | ret = wm8731_hw_init(&i2c->dev, wm8731); |
1919 | if (ret != 0) |
1920 | - return ret; |
1921 | + goto err_regulator_enable; |
1922 | |
1923 | ret = snd_soc_register_codec(&i2c->dev, |
1924 | &soc_codec_dev_wm8731, &wm8731_dai, 1); |
1925 | if (ret != 0) { |
1926 | dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); |
1927 | - return ret; |
1928 | + goto err_regulator_enable; |
1929 | } |
1930 | |
1931 | return 0; |
1932 | + |
1933 | +err_regulator_enable: |
1934 | + /* Regulators will be enabled by bias management */ |
1935 | + regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); |
1936 | + |
1937 | + return ret; |
1938 | } |
1939 | |
1940 | static int wm8731_i2c_remove(struct i2c_client *client) |
1941 | diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c |
1942 | index 6b864c0fc2b67..fa803cef23245 100644 |
1943 | --- a/sound/soc/codecs/wm8958-dsp2.c |
1944 | +++ b/sound/soc/codecs/wm8958-dsp2.c |
1945 | @@ -533,7 +533,7 @@ static int wm8958_mbc_put(struct snd_kcontrol *kcontrol, |
1946 | |
1947 | wm8958_dsp_apply(codec, mbc, wm8994->mbc_ena[mbc]); |
1948 | |
1949 | - return 0; |
1950 | + return 1; |
1951 | } |
1952 | |
1953 | #define WM8958_MBC_SWITCH(xname, xval) {\ |
1954 | @@ -659,7 +659,7 @@ static int wm8958_vss_put(struct snd_kcontrol *kcontrol, |
1955 | |
1956 | wm8958_dsp_apply(codec, vss, wm8994->vss_ena[vss]); |
1957 | |
1958 | - return 0; |
1959 | + return 1; |
1960 | } |
1961 | |
1962 | |
1963 | @@ -733,7 +733,7 @@ static int wm8958_hpf_put(struct snd_kcontrol *kcontrol, |
1964 | |
1965 | wm8958_dsp_apply(codec, hpf % 3, ucontrol->value.integer.value[0]); |
1966 | |
1967 | - return 0; |
1968 | + return 1; |
1969 | } |
1970 | |
1971 | #define WM8958_HPF_SWITCH(xname, xval) {\ |
1972 | @@ -827,7 +827,7 @@ static int wm8958_enh_eq_put(struct snd_kcontrol *kcontrol, |
1973 | |
1974 | wm8958_dsp_apply(codec, eq, ucontrol->value.integer.value[0]); |
1975 | |
1976 | - return 0; |
1977 | + return 1; |
1978 | } |
1979 | |
1980 | #define WM8958_ENH_EQ_SWITCH(xname, xval) {\ |
1981 | diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c |
1982 | index 61f0c9d6f6dce..67d22b4baeb05 100644 |
1983 | --- a/sound/soc/soc-generic-dmaengine-pcm.c |
1984 | +++ b/sound/soc/soc-generic-dmaengine-pcm.c |
1985 | @@ -98,10 +98,10 @@ static int dmaengine_pcm_hw_params(struct snd_pcm_substream *substream, |
1986 | |
1987 | memset(&slave_config, 0, sizeof(slave_config)); |
1988 | |
1989 | - if (pcm->config && pcm->config->prepare_slave_config) |
1990 | - prepare_slave_config = pcm->config->prepare_slave_config; |
1991 | - else |
1992 | + if (!pcm->config) |
1993 | prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; |
1994 | + else |
1995 | + prepare_slave_config = pcm->config->prepare_slave_config; |
1996 | |
1997 | if (prepare_slave_config) { |
1998 | ret = prepare_slave_config(substream, params, &slave_config); |