Magellan Linux

Annotation of /trunk/kernel-alx/patches-5.4/0221-5.4.122-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3637 - (hide annotations) (download)
Mon Oct 24 12:40:44 2022 UTC (19 months, 3 weeks ago) by niro
File size: 76465 byte(s)
-add missing
1 niro 3637 diff --git a/Makefile b/Makefile
2     index 18b4cebe55642..9b64ebcf45312 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,7 +1,7 @@
6     # SPDX-License-Identifier: GPL-2.0
7     VERSION = 5
8     PATCHLEVEL = 4
9     -SUBLEVEL = 121
10     +SUBLEVEL = 122
11     EXTRAVERSION =
12     NAME = Kleptomaniac Octopus
13    
14     diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
15     index d668f5be3a995..ae104eb4becc7 100644
16     --- a/arch/openrisc/kernel/setup.c
17     +++ b/arch/openrisc/kernel/setup.c
18     @@ -274,6 +274,8 @@ void calibrate_delay(void)
19     pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n",
20     loops_per_jiffy / (500000 / HZ),
21     (loops_per_jiffy / (5000 / HZ)) % 100, loops_per_jiffy);
22     +
23     + of_node_put(cpu);
24     }
25    
26     void __init setup_arch(char **cmdline_p)
27     diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
28     index 6626c84f66d16..1c3b77e17e4b0 100644
29     --- a/drivers/cdrom/gdrom.c
30     +++ b/drivers/cdrom/gdrom.c
31     @@ -740,6 +740,13 @@ static const struct blk_mq_ops gdrom_mq_ops = {
32     static int probe_gdrom(struct platform_device *devptr)
33     {
34     int err;
35     +
36     + /*
37     + * Ensure our "one" device is initialized properly in case of previous
38     + * usages of it
39     + */
40     + memset(&gd, 0, sizeof(gd));
41     +
42     /* Start the device */
43     if (gdrom_execute_diagnostic() != 1) {
44     pr_warning("ATA Probe for GDROM failed\n");
45     @@ -828,6 +835,8 @@ static int remove_gdrom(struct platform_device *devptr)
46     if (gdrom_major)
47     unregister_blkdev(gdrom_major, GDROM_DEV_NAME);
48     unregister_cdrom(gd.cd_info);
49     + kfree(gd.cd_info);
50     + kfree(gd.toc);
51    
52     return 0;
53     }
54     @@ -843,7 +852,7 @@ static struct platform_driver gdrom_driver = {
55     static int __init init_gdrom(void)
56     {
57     int rc;
58     - gd.toc = NULL;
59     +
60     rc = platform_driver_register(&gdrom_driver);
61     if (rc)
62     return rc;
63     @@ -859,8 +868,6 @@ static void __exit exit_gdrom(void)
64     {
65     platform_device_unregister(pd);
66     platform_driver_unregister(&gdrom_driver);
67     - kfree(gd.toc);
68     - kfree(gd.cd_info);
69     }
70    
71     module_init(init_gdrom);
72     diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
73     index a80c331c3a6e5..e2995ec144010 100644
74     --- a/drivers/firmware/arm_scpi.c
75     +++ b/drivers/firmware/arm_scpi.c
76     @@ -552,8 +552,10 @@ static unsigned long scpi_clk_get_val(u16 clk_id)
77    
78     ret = scpi_send_message(CMD_GET_CLOCK_VALUE, &le_clk_id,
79     sizeof(le_clk_id), &rate, sizeof(rate));
80     + if (ret)
81     + return 0;
82    
83     - return ret ? ret : le32_to_cpu(rate);
84     + return le32_to_cpu(rate);
85     }
86    
87     static int scpi_clk_set_val(u16 clk_id, unsigned long rate)
88     diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
89     index d17edc850427a..1d8739a4fbcad 100644
90     --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
91     +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
92     @@ -190,9 +190,10 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_2[] =
93     SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG, 0xffffffff, 0x20000000),
94     SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG2, 0xffffffff, 0x00000420),
95     SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG3, 0xffffffff, 0x00000200),
96     - SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG4, 0xffffffff, 0x04800000),
97     + SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG4, 0xffffffff, 0x04900000),
98     SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DFSM_TILES_IN_FLIGHT, 0x0000ffff, 0x0000003f),
99     SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_LAST_OF_BURST_CONFIG, 0xffffffff, 0x03860204),
100     + SOC15_REG_GOLDEN_VALUE(GC, 0, mmGB_ADDR_CONFIG, 0x0c1800ff, 0x00000044),
101     SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL, 0x1ff0ffff, 0x00000500),
102     SOC15_REG_GOLDEN_VALUE(GC, 0, mmGE_PRIV_CONTROL, 0x00007fff, 0x000001fe),
103     SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL1_PIPE_STEER, 0xffffffff, 0xe4e4e4e4),
104     @@ -210,12 +211,13 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_2[] =
105     SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_ENHANCE_2, 0x00000820, 0x00000820),
106     SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_LINE_STIPPLE_STATE, 0x0000ff0f, 0x00000000),
107     SOC15_REG_GOLDEN_VALUE(GC, 0, mmRMI_SPARE, 0xffffffff, 0xffff3101),
108     + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSPI_CONFIG_CNTL_1, 0x001f0000, 0x00070104),
109     SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_ALU_CLK_CTRL, 0xffffffff, 0xffffffff),
110     SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_ARB_CONFIG, 0x00000133, 0x00000130),
111     SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_LDS_CLK_CTRL, 0xffffffff, 0xffffffff),
112     SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000),
113     SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CNTL, 0xffdf80ff, 0x479c0010),
114     - SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00800000)
115     + SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00c00000)
116     };
117    
118     static const struct soc15_reg_golden golden_settings_gc_10_1_nv14[] =
119     diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
120     index 90dcc7afc9c43..06cdc22b5501d 100644
121     --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
122     +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
123     @@ -4661,7 +4661,7 @@ static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,
124     amdgpu_gfx_rlc_enter_safe_mode(adev);
125    
126     /* Enable 3D CGCG/CGLS */
127     - if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGCG)) {
128     + if (enable) {
129     /* write cmd to clear cgcg/cgls ov */
130     def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE);
131     /* unset CGCG override */
132     @@ -4673,8 +4673,12 @@ static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,
133     /* enable 3Dcgcg FSM(0x0000363f) */
134     def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL_3D);
135    
136     - data = (0x36 << RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |
137     - RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK;
138     + if (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGCG)
139     + data = (0x36 << RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |
140     + RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK;
141     + else
142     + data = 0x0 << RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT;
143     +
144     if (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGLS)
145     data |= (0x000F << RLC_CGCG_CGLS_CTRL_3D__CGLS_REP_COMPANSAT_DELAY__SHIFT) |
146     RLC_CGCG_CGLS_CTRL_3D__CGLS_EN_MASK;
147     diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
148     index 465351184bc3e..60180eca84a60 100644
149     --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
150     +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
151     @@ -100,6 +100,10 @@ static const struct soc15_reg_golden golden_settings_sdma_nv14[] = {
152    
153     static const struct soc15_reg_golden golden_settings_sdma_nv12[] = {
154     SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_RLC3_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
155     + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_GB_ADDR_CONFIG, 0x001877ff, 0x00000044),
156     + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x001877ff, 0x00000044),
157     + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_GB_ADDR_CONFIG, 0x001877ff, 0x00000044),
158     + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x001877ff, 0x00000044),
159     SOC15_REG_GOLDEN_VALUE(GC, 0, mmSDMA1_RLC3_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
160     };
161    
162     diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
163     index 41631271d64ca..6ff1d308623a7 100644
164     --- a/drivers/gpu/drm/amd/amdgpu/soc15.c
165     +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
166     @@ -1132,7 +1132,6 @@ static int soc15_common_early_init(void *handle)
167     adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
168     AMD_CG_SUPPORT_GFX_MGLS |
169     AMD_CG_SUPPORT_GFX_CP_LS |
170     - AMD_CG_SUPPORT_GFX_3D_CGCG |
171     AMD_CG_SUPPORT_GFX_3D_CGLS |
172     AMD_CG_SUPPORT_GFX_CGCG |
173     AMD_CG_SUPPORT_GFX_CGLS |
174     @@ -1152,7 +1151,6 @@ static int soc15_common_early_init(void *handle)
175     AMD_CG_SUPPORT_GFX_MGLS |
176     AMD_CG_SUPPORT_GFX_RLC_LS |
177     AMD_CG_SUPPORT_GFX_CP_LS |
178     - AMD_CG_SUPPORT_GFX_3D_CGCG |
179     AMD_CG_SUPPORT_GFX_3D_CGLS |
180     AMD_CG_SUPPORT_GFX_CGCG |
181     AMD_CG_SUPPORT_GFX_CGLS |
182     diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
183     index 80520cef76173..e34cdc42575d8 100644
184     --- a/drivers/hwmon/lm80.c
185     +++ b/drivers/hwmon/lm80.c
186     @@ -597,7 +597,6 @@ static int lm80_probe(struct i2c_client *client,
187     struct device *dev = &client->dev;
188     struct device *hwmon_dev;
189     struct lm80_data *data;
190     - int rv;
191    
192     data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL);
193     if (!data)
194     @@ -610,14 +609,8 @@ static int lm80_probe(struct i2c_client *client,
195     lm80_init_client(client);
196    
197     /* A few vars need to be filled upon startup */
198     - rv = lm80_read_value(client, LM80_REG_FAN_MIN(1));
199     - if (rv < 0)
200     - return rv;
201     - data->fan[f_min][0] = rv;
202     - rv = lm80_read_value(client, LM80_REG_FAN_MIN(2));
203     - if (rv < 0)
204     - return rv;
205     - data->fan[f_min][1] = rv;
206     + data->fan[f_min][0] = lm80_read_value(client, LM80_REG_FAN_MIN(1));
207     + data->fan[f_min][1] = lm80_read_value(client, LM80_REG_FAN_MIN(2));
208    
209     hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
210     data, lm80_groups);
211     diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
212     index ecac62a7b59e8..92428990f0ccc 100644
213     --- a/drivers/infiniband/core/cma.c
214     +++ b/drivers/infiniband/core/cma.c
215     @@ -530,6 +530,7 @@ static void cma_release_dev(struct rdma_id_private *id_priv)
216     list_del(&id_priv->list);
217     cma_deref_dev(id_priv->cma_dev);
218     id_priv->cma_dev = NULL;
219     + id_priv->id.device = NULL;
220     if (id_priv->id.route.addr.dev_addr.sgid_attr) {
221     rdma_put_gid_attr(id_priv->id.route.addr.dev_addr.sgid_attr);
222     id_priv->id.route.addr.dev_addr.sgid_attr = NULL;
223     @@ -1871,6 +1872,7 @@ void rdma_destroy_id(struct rdma_cm_id *id)
224     iw_destroy_cm_id(id_priv->cm_id.iw);
225     }
226     cma_leave_mc_groups(id_priv);
227     + rdma_restrack_del(&id_priv->res);
228     cma_release_dev(id_priv);
229     }
230    
231     @@ -3580,7 +3582,7 @@ int rdma_listen(struct rdma_cm_id *id, int backlog)
232     }
233    
234     id_priv->backlog = backlog;
235     - if (id->device) {
236     + if (id_priv->cma_dev) {
237     if (rdma_cap_ib_cm(id->device, 1)) {
238     ret = cma_ib_listen(id_priv);
239     if (ret)
240     diff --git a/drivers/infiniband/core/uverbs_std_types_device.c b/drivers/infiniband/core/uverbs_std_types_device.c
241     index 2a3f2f01028d3..fd351bdec3f64 100644
242     --- a/drivers/infiniband/core/uverbs_std_types_device.c
243     +++ b/drivers/infiniband/core/uverbs_std_types_device.c
244     @@ -110,8 +110,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_INFO_HANDLES)(
245     return ret;
246    
247     uapi_object = uapi_get_object(attrs->ufile->device->uapi, object_id);
248     - if (!uapi_object)
249     - return -EINVAL;
250     + if (IS_ERR(uapi_object))
251     + return PTR_ERR(uapi_object);
252    
253     handles = gather_objects_handle(attrs->ufile, uapi_object, attrs,
254     out_len, &total);
255     diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
256     index e2656b68ec222..a173737cb0222 100644
257     --- a/drivers/infiniband/hw/mlx5/main.c
258     +++ b/drivers/infiniband/hw/mlx5/main.c
259     @@ -6879,6 +6879,7 @@ static void *mlx5_ib_add_slave_port(struct mlx5_core_dev *mdev)
260    
261     if (bound) {
262     rdma_roce_rescan_device(&dev->ib_dev);
263     + mpi->ibdev->ib_active = true;
264     break;
265     }
266     }
267     diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
268     index f85273883794b..d427a343c09f6 100644
269     --- a/drivers/infiniband/sw/rxe/rxe_qp.c
270     +++ b/drivers/infiniband/sw/rxe/rxe_qp.c
271     @@ -260,6 +260,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
272     if (err) {
273     vfree(qp->sq.queue->buf);
274     kfree(qp->sq.queue);
275     + qp->sq.queue = NULL;
276     return err;
277     }
278    
279     @@ -313,6 +314,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp,
280     if (err) {
281     vfree(qp->rq.queue->buf);
282     kfree(qp->rq.queue);
283     + qp->rq.queue = NULL;
284     return err;
285     }
286     }
287     @@ -373,6 +375,11 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd,
288     err2:
289     rxe_queue_cleanup(qp->sq.queue);
290     err1:
291     + qp->pd = NULL;
292     + qp->rcq = NULL;
293     + qp->scq = NULL;
294     + qp->srq = NULL;
295     +
296     if (srq)
297     rxe_drop_ref(srq);
298     rxe_drop_ref(scq);
299     diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
300     index 2c3704f0f10fa..b9ca54e372b47 100644
301     --- a/drivers/infiniband/sw/siw/siw_verbs.c
302     +++ b/drivers/infiniband/sw/siw/siw_verbs.c
303     @@ -314,7 +314,6 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
304     struct siw_ucontext *uctx =
305     rdma_udata_to_drv_context(udata, struct siw_ucontext,
306     base_ucontext);
307     - struct siw_cq *scq = NULL, *rcq = NULL;
308     unsigned long flags;
309     int num_sqe, num_rqe, rv = 0;
310    
311     @@ -353,10 +352,8 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
312     rv = -EINVAL;
313     goto err_out;
314     }
315     - scq = to_siw_cq(attrs->send_cq);
316     - rcq = to_siw_cq(attrs->recv_cq);
317    
318     - if (!scq || (!rcq && !attrs->srq)) {
319     + if (!attrs->send_cq || (!attrs->recv_cq && !attrs->srq)) {
320     siw_dbg(base_dev, "send CQ or receive CQ invalid\n");
321     rv = -EINVAL;
322     goto err_out;
323     @@ -400,7 +397,7 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
324     else {
325     /* Zero sized SQ is not supported */
326     rv = -EINVAL;
327     - goto err_out;
328     + goto err_out_xa;
329     }
330     if (num_rqe)
331     num_rqe = roundup_pow_of_two(num_rqe);
332     @@ -423,8 +420,8 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
333     }
334     }
335     qp->pd = pd;
336     - qp->scq = scq;
337     - qp->rcq = rcq;
338     + qp->scq = to_siw_cq(attrs->send_cq);
339     + qp->rcq = to_siw_cq(attrs->recv_cq);
340    
341     if (attrs->srq) {
342     /*
343     diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
344     index d0b931a136b96..82e781abde293 100644
345     --- a/drivers/leds/leds-lp5523.c
346     +++ b/drivers/leds/leds-lp5523.c
347     @@ -307,7 +307,7 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip)
348     usleep_range(3000, 6000);
349     ret = lp55xx_read(chip, LP5523_REG_STATUS, &status);
350     if (ret)
351     - return ret;
352     + goto out;
353     status &= LP5523_ENG_STATUS_MASK;
354    
355     if (status != LP5523_ENG_STATUS_MASK) {
356     diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
357     index 0164c9ca984ba..add7d4ce41802 100644
358     --- a/drivers/md/dm-snap.c
359     +++ b/drivers/md/dm-snap.c
360     @@ -1408,6 +1408,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
361    
362     if (!s->store->chunk_size) {
363     ti->error = "Chunk size not set";
364     + r = -EINVAL;
365     goto bad_read_metadata;
366     }
367    
368     diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c
369     index af3c8d405509e..ae9a5f3e1beca 100644
370     --- a/drivers/media/platform/rcar_drif.c
371     +++ b/drivers/media/platform/rcar_drif.c
372     @@ -911,7 +911,6 @@ static int rcar_drif_g_fmt_sdr_cap(struct file *file, void *priv,
373     {
374     struct rcar_drif_sdr *sdr = video_drvdata(file);
375    
376     - memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved));
377     f->fmt.sdr.pixelformat = sdr->fmt->pixelformat;
378     f->fmt.sdr.buffersize = sdr->fmt->buffersize;
379    
380     diff --git a/drivers/misc/ics932s401.c b/drivers/misc/ics932s401.c
381     index 2bdf560ee681b..0f9ea75b0b189 100644
382     --- a/drivers/misc/ics932s401.c
383     +++ b/drivers/misc/ics932s401.c
384     @@ -134,7 +134,7 @@ static struct ics932s401_data *ics932s401_update_device(struct device *dev)
385     for (i = 0; i < NUM_MIRRORED_REGS; i++) {
386     temp = i2c_smbus_read_word_data(client, regs_to_copy[i]);
387     if (temp < 0)
388     - data->regs[regs_to_copy[i]] = 0;
389     + temp = 0;
390     data->regs[regs_to_copy[i]] = temp >> 8;
391     }
392    
393     diff --git a/drivers/mmc/host/sdhci-pci-gli.c b/drivers/mmc/host/sdhci-pci-gli.c
394     index fd76aa672e020..4437ea4ec8596 100644
395     --- a/drivers/mmc/host/sdhci-pci-gli.c
396     +++ b/drivers/mmc/host/sdhci-pci-gli.c
397     @@ -318,8 +318,13 @@ static void sdhci_gli_voltage_switch(struct sdhci_host *host)
398     *
399     * Wait 5ms after set 1.8V signal enable in Host Control 2 register
400     * to ensure 1.8V signal enable bit is set by GL9750/GL9755.
401     + *
402     + * ...however, the controller in the NUC10i3FNK4 (a 9755) requires
403     + * slightly longer than 5ms before the control register reports that
404     + * 1.8V is ready, and far longer still before the card will actually
405     + * work reliably.
406     */
407     - usleep_range(5000, 5500);
408     + usleep_range(100000, 110000);
409     }
410    
411     static void sdhci_gl9750_reset(struct sdhci_host *host, u8 mask)
412     diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
413     index a4cd6f2cfb862..4fb3dcb038196 100644
414     --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
415     +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
416     @@ -1049,7 +1049,7 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
417     for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) {
418     skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE);
419     if (!skb)
420     - break;
421     + goto error;
422     qlcnic_create_loopback_buff(skb->data, adapter->mac_addr);
423     skb_put(skb, QLCNIC_ILB_PKT_SIZE);
424     adapter->ahw->diag_cnt = 0;
425     @@ -1073,6 +1073,7 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
426     cnt++;
427     }
428     if (cnt != i) {
429     +error:
430     dev_err(&adapter->pdev->dev,
431     "LB Test: failed, TX[%d], RX[%d]\n", i, cnt);
432     if (mode != QLCNIC_ILB_MODE)
433     diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
434     index 65a3e3b5facef..f87cab39fa0e8 100644
435     --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
436     +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
437     @@ -30,7 +30,7 @@ struct sunxi_priv_data {
438     static int sun7i_gmac_init(struct platform_device *pdev, void *priv)
439     {
440     struct sunxi_priv_data *gmac = priv;
441     - int ret;
442     + int ret = 0;
443    
444     if (gmac->regulator) {
445     ret = regulator_enable(gmac->regulator);
446     @@ -51,11 +51,11 @@ static int sun7i_gmac_init(struct platform_device *pdev, void *priv)
447     } else {
448     clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE);
449     ret = clk_prepare(gmac->tx_clk);
450     - if (ret)
451     - return ret;
452     + if (ret && gmac->regulator)
453     + regulator_disable(gmac->regulator);
454     }
455    
456     - return 0;
457     + return ret;
458     }
459    
460     static void sun7i_gmac_exit(struct platform_device *pdev, void *priv)
461     diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
462     index 2911740af7061..595f560937a71 100644
463     --- a/drivers/net/ethernet/sun/niu.c
464     +++ b/drivers/net/ethernet/sun/niu.c
465     @@ -8144,10 +8144,10 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end)
466     "VPD_SCAN: Reading in property [%s] len[%d]\n",
467     namebuf, prop_len);
468     for (i = 0; i < prop_len; i++) {
469     - err = niu_pci_eeprom_read(np, off + i);
470     - if (err >= 0)
471     - *prop_buf = err;
472     - ++prop_buf;
473     + err = niu_pci_eeprom_read(np, off + i);
474     + if (err < 0)
475     + return err;
476     + *prop_buf++ = err;
477     }
478     }
479    
480     @@ -8158,14 +8158,14 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end)
481     }
482    
483     /* ESPC_PIO_EN_ENABLE must be set */
484     -static void niu_pci_vpd_fetch(struct niu *np, u32 start)
485     +static int niu_pci_vpd_fetch(struct niu *np, u32 start)
486     {
487     u32 offset;
488     int err;
489    
490     err = niu_pci_eeprom_read16_swp(np, start + 1);
491     if (err < 0)
492     - return;
493     + return err;
494    
495     offset = err + 3;
496    
497     @@ -8174,12 +8174,14 @@ static void niu_pci_vpd_fetch(struct niu *np, u32 start)
498     u32 end;
499    
500     err = niu_pci_eeprom_read(np, here);
501     + if (err < 0)
502     + return err;
503     if (err != 0x90)
504     - return;
505     + return -EINVAL;
506    
507     err = niu_pci_eeprom_read16_swp(np, here + 1);
508     if (err < 0)
509     - return;
510     + return err;
511    
512     here = start + offset + 3;
513     end = start + offset + err;
514     @@ -8187,9 +8189,12 @@ static void niu_pci_vpd_fetch(struct niu *np, u32 start)
515     offset += err;
516    
517     err = niu_pci_vpd_scan_props(np, here, end);
518     - if (err < 0 || err == 1)
519     - return;
520     + if (err < 0)
521     + return err;
522     + if (err == 1)
523     + return -EINVAL;
524     }
525     + return 0;
526     }
527    
528     /* ESPC_PIO_EN_ENABLE must be set */
529     @@ -9280,8 +9285,11 @@ static int niu_get_invariants(struct niu *np)
530     offset = niu_pci_vpd_offset(np);
531     netif_printk(np, probe, KERN_DEBUG, np->dev,
532     "%s() VPD offset [%08x]\n", __func__, offset);
533     - if (offset)
534     - niu_pci_vpd_fetch(np, offset);
535     + if (offset) {
536     + err = niu_pci_vpd_fetch(np, offset);
537     + if (err < 0)
538     + return err;
539     + }
540     nw64(ESPC_PIO_EN, 0);
541    
542     if (np->flags & NIU_FLAGS_VPD_VALID) {
543     diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
544     index ac746c322554b..c9ad6761032ae 100644
545     --- a/drivers/net/wireless/realtek/rtlwifi/base.c
546     +++ b/drivers/net/wireless/realtek/rtlwifi/base.c
547     @@ -436,9 +436,14 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
548     }
549     }
550    
551     -static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
552     +static int _rtl_init_deferred_work(struct ieee80211_hw *hw)
553     {
554     struct rtl_priv *rtlpriv = rtl_priv(hw);
555     + struct workqueue_struct *wq;
556     +
557     + wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name);
558     + if (!wq)
559     + return -ENOMEM;
560    
561     /* <1> timer */
562     timer_setup(&rtlpriv->works.watchdog_timer,
563     @@ -447,11 +452,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
564     rtl_easy_concurrent_retrytimer_callback, 0);
565     /* <2> work queue */
566     rtlpriv->works.hw = hw;
567     - rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name);
568     - if (unlikely(!rtlpriv->works.rtl_wq)) {
569     - pr_err("Failed to allocate work queue\n");
570     - return;
571     - }
572     + rtlpriv->works.rtl_wq = wq;
573    
574     INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq,
575     (void *)rtl_watchdog_wq_callback);
576     @@ -465,6 +466,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
577     (void *)rtl_fwevt_wq_callback);
578     INIT_DELAYED_WORK(&rtlpriv->works.c2hcmd_wq,
579     (void *)rtl_c2hcmd_wq_callback);
580     + return 0;
581     }
582    
583     void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq)
584     @@ -564,9 +566,7 @@ int rtl_init_core(struct ieee80211_hw *hw)
585     rtlmac->link_state = MAC80211_NOLINK;
586    
587     /* <6> init deferred work */
588     - _rtl_init_deferred_work(hw);
589     -
590     - return 0;
591     + return _rtl_init_deferred_work(hw);
592     }
593     EXPORT_SYMBOL_GPL(rtl_init_core);
594    
595     diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
596     index 6041511b8b76d..710ab45eb679d 100644
597     --- a/drivers/nvme/host/core.c
598     +++ b/drivers/nvme/host/core.c
599     @@ -2904,7 +2904,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
600     ctrl->hmmaxd = le16_to_cpu(id->hmmaxd);
601     }
602    
603     - ret = nvme_mpath_init(ctrl, id);
604     + ret = nvme_mpath_init_identify(ctrl, id);
605     kfree(id);
606    
607     if (ret < 0)
608     @@ -4145,6 +4145,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
609     min(default_ps_max_latency_us, (unsigned long)S32_MAX));
610    
611     nvme_fault_inject_init(&ctrl->fault_inject, dev_name(ctrl->device));
612     + nvme_mpath_init_ctrl(ctrl);
613    
614     return 0;
615     out_free_name:
616     diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
617     index 855edc4e12440..590b040e90a34 100644
618     --- a/drivers/nvme/host/multipath.c
619     +++ b/drivers/nvme/host/multipath.c
620     @@ -718,9 +718,18 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head)
621     put_disk(head->disk);
622     }
623    
624     -int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
625     +void nvme_mpath_init_ctrl(struct nvme_ctrl *ctrl)
626     {
627     - int error;
628     + mutex_init(&ctrl->ana_lock);
629     + timer_setup(&ctrl->anatt_timer, nvme_anatt_timeout, 0);
630     + INIT_WORK(&ctrl->ana_work, nvme_ana_work);
631     +}
632     +
633     +int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
634     +{
635     + size_t max_transfer_size = ctrl->max_hw_sectors << SECTOR_SHIFT;
636     + size_t ana_log_size;
637     + int error = 0;
638    
639     /* check if multipath is enabled and we have the capability */
640     if (!multipath || !ctrl->subsys || !(ctrl->subsys->cmic & (1 << 3)))
641     @@ -731,37 +740,31 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
642     ctrl->nanagrpid = le32_to_cpu(id->nanagrpid);
643     ctrl->anagrpmax = le32_to_cpu(id->anagrpmax);
644    
645     - mutex_init(&ctrl->ana_lock);
646     - timer_setup(&ctrl->anatt_timer, nvme_anatt_timeout, 0);
647     - ctrl->ana_log_size = sizeof(struct nvme_ana_rsp_hdr) +
648     - ctrl->nanagrpid * sizeof(struct nvme_ana_group_desc);
649     - ctrl->ana_log_size += ctrl->max_namespaces * sizeof(__le32);
650     -
651     - if (ctrl->ana_log_size > ctrl->max_hw_sectors << SECTOR_SHIFT) {
652     + ana_log_size = sizeof(struct nvme_ana_rsp_hdr) +
653     + ctrl->nanagrpid * sizeof(struct nvme_ana_group_desc) +
654     + ctrl->max_namespaces * sizeof(__le32);
655     + if (ana_log_size > max_transfer_size) {
656     dev_err(ctrl->device,
657     - "ANA log page size (%zd) larger than MDTS (%d).\n",
658     - ctrl->ana_log_size,
659     - ctrl->max_hw_sectors << SECTOR_SHIFT);
660     + "ANA log page size (%zd) larger than MDTS (%zd).\n",
661     + ana_log_size, max_transfer_size);
662     dev_err(ctrl->device, "disabling ANA support.\n");
663     - return 0;
664     + goto out_uninit;
665     }
666     -
667     - INIT_WORK(&ctrl->ana_work, nvme_ana_work);
668     - kfree(ctrl->ana_log_buf);
669     - ctrl->ana_log_buf = kmalloc(ctrl->ana_log_size, GFP_KERNEL);
670     - if (!ctrl->ana_log_buf) {
671     - error = -ENOMEM;
672     - goto out;
673     + if (ana_log_size > ctrl->ana_log_size) {
674     + nvme_mpath_stop(ctrl);
675     + kfree(ctrl->ana_log_buf);
676     + ctrl->ana_log_buf = kmalloc(ana_log_size, GFP_KERNEL);
677     + if (!ctrl->ana_log_buf)
678     + return -ENOMEM;
679     }
680     -
681     + ctrl->ana_log_size = ana_log_size;
682     error = nvme_read_ana_log(ctrl);
683     if (error)
684     - goto out_free_ana_log_buf;
685     + goto out_uninit;
686     return 0;
687     -out_free_ana_log_buf:
688     - kfree(ctrl->ana_log_buf);
689     - ctrl->ana_log_buf = NULL;
690     -out:
691     +
692     +out_uninit:
693     + nvme_mpath_uninit(ctrl);
694     return error;
695     }
696    
697     diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
698     index 62e5401865fee..2df90d4355b9a 100644
699     --- a/drivers/nvme/host/nvme.h
700     +++ b/drivers/nvme/host/nvme.h
701     @@ -549,7 +549,8 @@ void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl);
702     int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head);
703     void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id);
704     void nvme_mpath_remove_disk(struct nvme_ns_head *head);
705     -int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id);
706     +int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id);
707     +void nvme_mpath_init_ctrl(struct nvme_ctrl *ctrl);
708     void nvme_mpath_uninit(struct nvme_ctrl *ctrl);
709     void nvme_mpath_stop(struct nvme_ctrl *ctrl);
710     bool nvme_mpath_clear_current_path(struct nvme_ns *ns);
711     @@ -636,7 +637,10 @@ static inline void nvme_trace_bio_complete(struct request *req,
712     blk_status_t status)
713     {
714     }
715     -static inline int nvme_mpath_init(struct nvme_ctrl *ctrl,
716     +static inline void nvme_mpath_init_ctrl(struct nvme_ctrl *ctrl)
717     +{
718     +}
719     +static inline int nvme_mpath_init_identify(struct nvme_ctrl *ctrl,
720     struct nvme_id_ctrl *id)
721     {
722     if (ctrl->subsys->cmic & (1 << 3))
723     diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c
724     index 05453f5d14486..6ca17a0babae2 100644
725     --- a/drivers/nvme/target/io-cmd-file.c
726     +++ b/drivers/nvme/target/io-cmd-file.c
727     @@ -38,9 +38,11 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns)
728    
729     ns->file = filp_open(ns->device_path, flags, 0);
730     if (IS_ERR(ns->file)) {
731     - pr_err("failed to open file %s: (%ld)\n",
732     - ns->device_path, PTR_ERR(ns->file));
733     - return PTR_ERR(ns->file);
734     + ret = PTR_ERR(ns->file);
735     + pr_err("failed to open file %s: (%d)\n",
736     + ns->device_path, ret);
737     + ns->file = NULL;
738     + return ret;
739     }
740    
741     ret = vfs_getattr(&ns->file->f_path,
742     diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c
743     index 5739a9669b291..92bda873d44a4 100644
744     --- a/drivers/platform/mellanox/mlxbf-tmfifo.c
745     +++ b/drivers/platform/mellanox/mlxbf-tmfifo.c
746     @@ -294,6 +294,9 @@ mlxbf_tmfifo_get_next_desc(struct mlxbf_tmfifo_vring *vring)
747     if (vring->next_avail == virtio16_to_cpu(vdev, vr->avail->idx))
748     return NULL;
749    
750     + /* Make sure 'avail->idx' is visible already. */
751     + virtio_rmb(false);
752     +
753     idx = vring->next_avail % vr->num;
754     head = virtio16_to_cpu(vdev, vr->avail->ring[idx]);
755     if (WARN_ON(head >= vr->num))
756     @@ -322,7 +325,7 @@ static void mlxbf_tmfifo_release_desc(struct mlxbf_tmfifo_vring *vring,
757     * done or not. Add a memory barrier here to make sure the update above
758     * completes before updating the idx.
759     */
760     - mb();
761     + virtio_mb(false);
762     vr->used->idx = cpu_to_virtio16(vdev, vr_idx + 1);
763     }
764    
765     @@ -730,6 +733,12 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring,
766     desc = NULL;
767     fifo->vring[is_rx] = NULL;
768    
769     + /*
770     + * Make sure the load/store are in order before
771     + * returning back to virtio.
772     + */
773     + virtio_mb(false);
774     +
775     /* Notify upper layer that packet is done. */
776     spin_lock_irqsave(&fifo->spin_lock[is_rx], flags);
777     vring_interrupt(0, vring->vq);
778     diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c
779     index 27a298b7c541b..c97bd4a452422 100644
780     --- a/drivers/platform/x86/dell-smbios-wmi.c
781     +++ b/drivers/platform/x86/dell-smbios-wmi.c
782     @@ -271,7 +271,8 @@ int init_dell_smbios_wmi(void)
783    
784     void exit_dell_smbios_wmi(void)
785     {
786     - wmi_driver_unregister(&dell_smbios_wmi_driver);
787     + if (wmi_supported)
788     + wmi_driver_unregister(&dell_smbios_wmi_driver);
789     }
790    
791     MODULE_DEVICE_TABLE(wmi, dell_smbios_wmi_id_table);
792     diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c
793     index 50ec53d67a4c0..db4c265287ae6 100644
794     --- a/drivers/rapidio/rio_cm.c
795     +++ b/drivers/rapidio/rio_cm.c
796     @@ -2127,6 +2127,14 @@ static int riocm_add_mport(struct device *dev,
797     return -ENODEV;
798     }
799    
800     + cm->rx_wq = create_workqueue(DRV_NAME "/rxq");
801     + if (!cm->rx_wq) {
802     + rio_release_inb_mbox(mport, cmbox);
803     + rio_release_outb_mbox(mport, cmbox);
804     + kfree(cm);
805     + return -ENOMEM;
806     + }
807     +
808     /*
809     * Allocate and register inbound messaging buffers to be ready
810     * to receive channel and system management requests
811     @@ -2137,15 +2145,6 @@ static int riocm_add_mport(struct device *dev,
812     cm->rx_slots = RIOCM_RX_RING_SIZE;
813     mutex_init(&cm->rx_lock);
814     riocm_rx_fill(cm, RIOCM_RX_RING_SIZE);
815     - cm->rx_wq = create_workqueue(DRV_NAME "/rxq");
816     - if (!cm->rx_wq) {
817     - riocm_error("failed to allocate IBMBOX_%d on %s",
818     - cmbox, mport->name);
819     - rio_release_outb_mbox(mport, cmbox);
820     - kfree(cm);
821     - return -ENOMEM;
822     - }
823     -
824     INIT_WORK(&cm->rx_work, rio_ibmsg_handler);
825    
826     cm->tx_slot = 0;
827     diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
828     index c855d013ba8aa..de567a025133c 100644
829     --- a/drivers/scsi/qla2xxx/qla_nx.c
830     +++ b/drivers/scsi/qla2xxx/qla_nx.c
831     @@ -1113,7 +1113,8 @@ qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr,
832     return ret;
833     }
834    
835     - if (qla82xx_flash_set_write_enable(ha))
836     + ret = qla82xx_flash_set_write_enable(ha);
837     + if (ret < 0)
838     goto done_write;
839    
840     qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_WDATA, data);
841     diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c
842     index 6bbb1679bb91c..9903ce9f066cf 100644
843     --- a/drivers/scsi/ufs/ufs-hisi.c
844     +++ b/drivers/scsi/ufs/ufs-hisi.c
845     @@ -481,21 +481,24 @@ static int ufs_hisi_init_common(struct ufs_hba *hba)
846     host->hba = hba;
847     ufshcd_set_variant(hba, host);
848    
849     - host->rst = devm_reset_control_get(dev, "rst");
850     + host->rst = devm_reset_control_get(dev, "rst");
851     if (IS_ERR(host->rst)) {
852     dev_err(dev, "%s: failed to get reset control\n", __func__);
853     - return PTR_ERR(host->rst);
854     + err = PTR_ERR(host->rst);
855     + goto error;
856     }
857    
858     ufs_hisi_set_pm_lvl(hba);
859    
860     err = ufs_hisi_get_resource(host);
861     - if (err) {
862     - ufshcd_set_variant(hba, NULL);
863     - return err;
864     - }
865     + if (err)
866     + goto error;
867    
868     return 0;
869     +
870     +error:
871     + ufshcd_set_variant(hba, NULL);
872     + return err;
873     }
874    
875     static int ufs_hi3660_init(struct ufs_hba *hba)
876     diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
877     index 25112c2fe2db6..0429ba5d7d23c 100644
878     --- a/drivers/scsi/ufs/ufshcd.c
879     +++ b/drivers/scsi/ufs/ufshcd.c
880     @@ -2615,7 +2615,7 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
881     * ufshcd_exec_dev_cmd - API for sending device management requests
882     * @hba: UFS hba
883     * @cmd_type: specifies the type (NOP, Query...)
884     - * @timeout: time in seconds
885     + * @timeout: timeout in milliseconds
886     *
887     * NOTE: Since there is only one available tag for device management commands,
888     * it is expected you hold the hba->dev_cmd.lock mutex.
889     @@ -2645,6 +2645,9 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
890     }
891     tag = req->tag;
892     WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag));
893     + /* Set the timeout such that the SCSI error handler is not activated. */
894     + req->timeout = msecs_to_jiffies(2 * timeout);
895     + blk_mq_start_request(req);
896    
897     init_completion(&wait);
898     lrbp = &hba->lrb[tag];
899     diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
900     index e006f40ffdc04..5e6f661943eb1 100644
901     --- a/drivers/tty/serial/mvebu-uart.c
902     +++ b/drivers/tty/serial/mvebu-uart.c
903     @@ -818,9 +818,6 @@ static int mvebu_uart_probe(struct platform_device *pdev)
904     return -EINVAL;
905     }
906    
907     - if (!match)
908     - return -ENODEV;
909     -
910     /* Assume that all UART ports have a DT alias or none has */
911     id = of_alias_get_id(pdev->dev.of_node, "serial");
912     if (!pdev->dev.of_node || id < 0)
913     diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
914     index 564e1fa2e4c94..6f013d7f5bd0f 100644
915     --- a/drivers/tty/vt/vt.c
916     +++ b/drivers/tty/vt/vt.c
917     @@ -1166,7 +1166,7 @@ static inline int resize_screen(struct vc_data *vc, int width, int height,
918     /* Resizes the resolution of the display adapater */
919     int err = 0;
920    
921     - if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_resize)
922     + if (vc->vc_sw->con_resize)
923     err = vc->vc_sw->con_resize(vc, width, height, user);
924    
925     return err;
926     diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
927     index 4f51be17427c0..b5d2ad900ec09 100644
928     --- a/drivers/tty/vt/vt_ioctl.c
929     +++ b/drivers/tty/vt/vt_ioctl.c
930     @@ -895,17 +895,17 @@ int vt_ioctl(struct tty_struct *tty,
931     if (vcp) {
932     int ret;
933     int save_scan_lines = vcp->vc_scan_lines;
934     - int save_font_height = vcp->vc_font.height;
935     + int save_cell_height = vcp->vc_cell_height;
936    
937     if (v.v_vlin)
938     vcp->vc_scan_lines = v.v_vlin;
939     if (v.v_clin)
940     - vcp->vc_font.height = v.v_clin;
941     + vcp->vc_cell_height = v.v_clin;
942     vcp->vc_resize_user = 1;
943     ret = vc_resize(vcp, v.v_cols, v.v_rows);
944     if (ret) {
945     vcp->vc_scan_lines = save_scan_lines;
946     - vcp->vc_font.height = save_font_height;
947     + vcp->vc_cell_height = save_cell_height;
948     console_unlock();
949     return ret;
950     }
951     diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c
952     index 3c5169eb23f5c..bdf3932ee3f20 100644
953     --- a/drivers/uio/uio_hv_generic.c
954     +++ b/drivers/uio/uio_hv_generic.c
955     @@ -296,8 +296,10 @@ hv_uio_probe(struct hv_device *dev,
956    
957     ret = vmbus_establish_gpadl(channel, pdata->recv_buf,
958     RECV_BUFFER_SIZE, &pdata->recv_gpadl);
959     - if (ret)
960     + if (ret) {
961     + vfree(pdata->recv_buf);
962     goto fail_close;
963     + }
964    
965     /* put Global Physical Address Label in name */
966     snprintf(pdata->recv_name, sizeof(pdata->recv_name),
967     @@ -316,8 +318,10 @@ hv_uio_probe(struct hv_device *dev,
968    
969     ret = vmbus_establish_gpadl(channel, pdata->send_buf,
970     SEND_BUFFER_SIZE, &pdata->send_gpadl);
971     - if (ret)
972     + if (ret) {
973     + vfree(pdata->send_buf);
974     goto fail_close;
975     + }
976    
977     snprintf(pdata->send_name, sizeof(pdata->send_name),
978     "send:%u", pdata->send_gpadl);
979     diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
980     index 55507df335bdd..a992d922b3a71 100644
981     --- a/drivers/video/console/vgacon.c
982     +++ b/drivers/video/console/vgacon.c
983     @@ -384,7 +384,7 @@ static void vgacon_init(struct vc_data *c, int init)
984     vc_resize(c, vga_video_num_columns, vga_video_num_lines);
985    
986     c->vc_scan_lines = vga_scan_lines;
987     - c->vc_font.height = vga_video_font_height;
988     + c->vc_font.height = c->vc_cell_height = vga_video_font_height;
989     c->vc_complement_mask = 0x7700;
990     if (vga_512_chars)
991     c->vc_hi_font_mask = 0x0800;
992     @@ -517,32 +517,32 @@ static void vgacon_cursor(struct vc_data *c, int mode)
993     switch (c->vc_cursor_type & 0x0f) {
994     case CUR_UNDERLINE:
995     vgacon_set_cursor_size(c->vc_x,
996     - c->vc_font.height -
997     - (c->vc_font.height <
998     + c->vc_cell_height -
999     + (c->vc_cell_height <
1000     10 ? 2 : 3),
1001     - c->vc_font.height -
1002     - (c->vc_font.height <
1003     + c->vc_cell_height -
1004     + (c->vc_cell_height <
1005     10 ? 1 : 2));
1006     break;
1007     case CUR_TWO_THIRDS:
1008     vgacon_set_cursor_size(c->vc_x,
1009     - c->vc_font.height / 3,
1010     - c->vc_font.height -
1011     - (c->vc_font.height <
1012     + c->vc_cell_height / 3,
1013     + c->vc_cell_height -
1014     + (c->vc_cell_height <
1015     10 ? 1 : 2));
1016     break;
1017     case CUR_LOWER_THIRD:
1018     vgacon_set_cursor_size(c->vc_x,
1019     - (c->vc_font.height * 2) / 3,
1020     - c->vc_font.height -
1021     - (c->vc_font.height <
1022     + (c->vc_cell_height * 2) / 3,
1023     + c->vc_cell_height -
1024     + (c->vc_cell_height <
1025     10 ? 1 : 2));
1026     break;
1027     case CUR_LOWER_HALF:
1028     vgacon_set_cursor_size(c->vc_x,
1029     - c->vc_font.height / 2,
1030     - c->vc_font.height -
1031     - (c->vc_font.height <
1032     + c->vc_cell_height / 2,
1033     + c->vc_cell_height -
1034     + (c->vc_cell_height <
1035     10 ? 1 : 2));
1036     break;
1037     case CUR_NONE:
1038     @@ -553,7 +553,7 @@ static void vgacon_cursor(struct vc_data *c, int mode)
1039     break;
1040     default:
1041     vgacon_set_cursor_size(c->vc_x, 1,
1042     - c->vc_font.height);
1043     + c->vc_cell_height);
1044     break;
1045     }
1046     break;
1047     @@ -564,13 +564,13 @@ static int vgacon_doresize(struct vc_data *c,
1048     unsigned int width, unsigned int height)
1049     {
1050     unsigned long flags;
1051     - unsigned int scanlines = height * c->vc_font.height;
1052     + unsigned int scanlines = height * c->vc_cell_height;
1053     u8 scanlines_lo = 0, r7 = 0, vsync_end = 0, mode, max_scan;
1054    
1055     raw_spin_lock_irqsave(&vga_lock, flags);
1056    
1057     vgacon_xres = width * VGA_FONTWIDTH;
1058     - vgacon_yres = height * c->vc_font.height;
1059     + vgacon_yres = height * c->vc_cell_height;
1060     if (vga_video_type >= VIDEO_TYPE_VGAC) {
1061     outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg);
1062     max_scan = inb_p(vga_video_port_val);
1063     @@ -625,9 +625,9 @@ static int vgacon_doresize(struct vc_data *c,
1064     static int vgacon_switch(struct vc_data *c)
1065     {
1066     int x = c->vc_cols * VGA_FONTWIDTH;
1067     - int y = c->vc_rows * c->vc_font.height;
1068     + int y = c->vc_rows * c->vc_cell_height;
1069     int rows = screen_info.orig_video_lines * vga_default_font_height/
1070     - c->vc_font.height;
1071     + c->vc_cell_height;
1072     /*
1073     * We need to save screen size here as it's the only way
1074     * we can spot the screen has been resized and we need to
1075     @@ -1058,7 +1058,7 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight)
1076     cursor_size_lastto = 0;
1077     c->vc_sw->con_cursor(c, CM_DRAW);
1078     }
1079     - c->vc_font.height = fontheight;
1080     + c->vc_font.height = c->vc_cell_height = fontheight;
1081     vc_resize(c, 0, rows); /* Adjust console size */
1082     }
1083     }
1084     @@ -1106,12 +1106,20 @@ static int vgacon_resize(struct vc_data *c, unsigned int width,
1085     if ((width << 1) * height > vga_vram_size)
1086     return -EINVAL;
1087    
1088     + if (user) {
1089     + /*
1090     + * Ho ho! Someone (svgatextmode, eh?) may have reprogrammed
1091     + * the video mode! Set the new defaults then and go away.
1092     + */
1093     + screen_info.orig_video_cols = width;
1094     + screen_info.orig_video_lines = height;
1095     + vga_default_font_height = c->vc_cell_height;
1096     + return 0;
1097     + }
1098     if (width % 2 || width > screen_info.orig_video_cols ||
1099     height > (screen_info.orig_video_lines * vga_default_font_height)/
1100     - c->vc_font.height)
1101     - /* let svgatextmode tinker with video timings and
1102     - return success */
1103     - return (user) ? 0 : -EINVAL;
1104     + c->vc_cell_height)
1105     + return -EINVAL;
1106    
1107     if (con_is_visible(c) && !vga_is_gfx) /* who knows */
1108     vgacon_doresize(c, width, height);
1109     diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
1110     index 0a9202176ffc9..75b7705140673 100644
1111     --- a/drivers/video/fbdev/core/fbcon.c
1112     +++ b/drivers/video/fbdev/core/fbcon.c
1113     @@ -2058,7 +2058,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
1114     return -EINVAL;
1115    
1116     DPRINTK("resize now %ix%i\n", var.xres, var.yres);
1117     - if (con_is_visible(vc)) {
1118     + if (con_is_visible(vc) && vc->vc_mode == KD_TEXT) {
1119     var.activate = FB_ACTIVATE_NOW |
1120     FB_ACTIVATE_FORCE;
1121     fb_set_var(info, &var);
1122     diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c
1123     index 59e1cae579481..03c0b1b8747b9 100644
1124     --- a/drivers/video/fbdev/hgafb.c
1125     +++ b/drivers/video/fbdev/hgafb.c
1126     @@ -286,7 +286,7 @@ static int hga_card_detect(void)
1127    
1128     hga_vram = ioremap(0xb0000, hga_vram_len);
1129     if (!hga_vram)
1130     - goto error;
1131     + return -ENOMEM;
1132    
1133     if (request_region(0x3b0, 12, "hgafb"))
1134     release_io_ports = 1;
1135     @@ -346,13 +346,18 @@ static int hga_card_detect(void)
1136     hga_type_name = "Hercules";
1137     break;
1138     }
1139     - return 1;
1140     + return 0;
1141     error:
1142     if (release_io_ports)
1143     release_region(0x3b0, 12);
1144     if (release_io_port)
1145     release_region(0x3bf, 1);
1146     - return 0;
1147     +
1148     + iounmap(hga_vram);
1149     +
1150     + pr_err("hgafb: HGA card not detected.\n");
1151     +
1152     + return -EINVAL;
1153     }
1154    
1155     /**
1156     @@ -550,13 +555,11 @@ static struct fb_ops hgafb_ops = {
1157     static int hgafb_probe(struct platform_device *pdev)
1158     {
1159     struct fb_info *info;
1160     + int ret;
1161    
1162     - if (! hga_card_detect()) {
1163     - printk(KERN_INFO "hgafb: HGA card not detected.\n");
1164     - if (hga_vram)
1165     - iounmap(hga_vram);
1166     - return -EINVAL;
1167     - }
1168     + ret = hga_card_detect();
1169     + if (ret)
1170     + return ret;
1171    
1172     printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n",
1173     hga_type_name, hga_vram_len/1024);
1174     diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c
1175     index 58b01c7d90560..5f610d4929ddb 100644
1176     --- a/drivers/video/fbdev/imsttfb.c
1177     +++ b/drivers/video/fbdev/imsttfb.c
1178     @@ -1512,11 +1512,6 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1179     info->fix.smem_start = addr;
1180     info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ?
1181     0x400000 : 0x800000);
1182     - if (!info->screen_base) {
1183     - release_mem_region(addr, size);
1184     - framebuffer_release(info);
1185     - return -ENOMEM;
1186     - }
1187     info->fix.mmio_start = addr + 0x800000;
1188     par->dc_regs = ioremap(addr + 0x800000, 0x1000);
1189     par->cmap_regs_phys = addr + 0x840000;
1190     diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
1191     index 7fb65836230ac..a255b08aff4d9 100644
1192     --- a/drivers/xen/xen-pciback/xenbus.c
1193     +++ b/drivers/xen/xen-pciback/xenbus.c
1194     @@ -358,7 +358,8 @@ out:
1195     return err;
1196     }
1197    
1198     -static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
1199     +static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev,
1200     + enum xenbus_state state)
1201     {
1202     int err = 0;
1203     int num_devs;
1204     @@ -372,9 +373,7 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
1205     dev_dbg(&pdev->xdev->dev, "Reconfiguring device ...\n");
1206    
1207     mutex_lock(&pdev->dev_lock);
1208     - /* Make sure we only reconfigure once */
1209     - if (xenbus_read_driver_state(pdev->xdev->nodename) !=
1210     - XenbusStateReconfiguring)
1211     + if (xenbus_read_driver_state(pdev->xdev->nodename) != state)
1212     goto out;
1213    
1214     err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d",
1215     @@ -499,6 +498,10 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
1216     }
1217     }
1218    
1219     + if (state != XenbusStateReconfiguring)
1220     + /* Make sure we only reconfigure once. */
1221     + goto out;
1222     +
1223     err = xenbus_switch_state(pdev->xdev, XenbusStateReconfigured);
1224     if (err) {
1225     xenbus_dev_fatal(pdev->xdev, err,
1226     @@ -524,7 +527,7 @@ static void xen_pcibk_frontend_changed(struct xenbus_device *xdev,
1227     break;
1228    
1229     case XenbusStateReconfiguring:
1230     - xen_pcibk_reconfigure(pdev);
1231     + xen_pcibk_reconfigure(pdev, XenbusStateReconfiguring);
1232     break;
1233    
1234     case XenbusStateConnected:
1235     @@ -663,6 +666,15 @@ static void xen_pcibk_be_watch(struct xenbus_watch *watch,
1236     xen_pcibk_setup_backend(pdev);
1237     break;
1238    
1239     + case XenbusStateInitialised:
1240     + /*
1241     + * We typically move to Initialised when the first device was
1242     + * added. Hence subsequent devices getting added may need
1243     + * reconfiguring.
1244     + */
1245     + xen_pcibk_reconfigure(pdev, XenbusStateInitialised);
1246     + break;
1247     +
1248     default:
1249     break;
1250     }
1251     diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
1252     index b36a4d144bec0..8ea9559c1919a 100644
1253     --- a/fs/btrfs/inode.c
1254     +++ b/fs/btrfs/inode.c
1255     @@ -3571,6 +3571,7 @@ void btrfs_run_delayed_iputs(struct btrfs_fs_info *fs_info)
1256     inode = list_first_entry(&fs_info->delayed_iputs,
1257     struct btrfs_inode, delayed_iput);
1258     run_delayed_iput_locked(fs_info, inode);
1259     + cond_resched_lock(&fs_info->delayed_iput_lock);
1260     }
1261     spin_unlock(&fs_info->delayed_iput_lock);
1262     }
1263     diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
1264     index 997a106f28d37..bf6b4f71dc58f 100644
1265     --- a/fs/cifs/smb2ops.c
1266     +++ b/fs/cifs/smb2ops.c
1267     @@ -1673,6 +1673,8 @@ smb2_copychunk_range(const unsigned int xid,
1268     cpu_to_le32(min_t(u32, len, tcon->max_bytes_chunk));
1269    
1270     /* Request server copy to target from src identified by key */
1271     + kfree(retbuf);
1272     + retbuf = NULL;
1273     rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid,
1274     trgtfile->fid.volatile_fid, FSCTL_SRV_COPYCHUNK_WRITE,
1275     true /* is_fsctl */, (char *)pcchunk,
1276     diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
1277     index a064b408d8416..f91db24bbf3bc 100644
1278     --- a/fs/ecryptfs/crypto.c
1279     +++ b/fs/ecryptfs/crypto.c
1280     @@ -311,10 +311,8 @@ static int crypt_scatterlist(struct ecryptfs_crypt_stat *crypt_stat,
1281     struct extent_crypt_result ecr;
1282     int rc = 0;
1283    
1284     - if (!crypt_stat || !crypt_stat->tfm
1285     - || !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED))
1286     - return -EINVAL;
1287     -
1288     + BUG_ON(!crypt_stat || !crypt_stat->tfm
1289     + || !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED));
1290     if (unlikely(ecryptfs_verbosity > 0)) {
1291     ecryptfs_printk(KERN_DEBUG, "Key size [%zd]; key:\n",
1292     crypt_stat->key_size);
1293     diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c
1294     index d0d8a9795dd62..6a30e54c11282 100644
1295     --- a/fs/ext4/verity.c
1296     +++ b/fs/ext4/verity.c
1297     @@ -198,55 +198,76 @@ static int ext4_end_enable_verity(struct file *filp, const void *desc,
1298     struct inode *inode = file_inode(filp);
1299     const int credits = 2; /* superblock and inode for ext4_orphan_del() */
1300     handle_t *handle;
1301     + struct ext4_iloc iloc;
1302     int err = 0;
1303     - int err2;
1304    
1305     - if (desc != NULL) {
1306     - /* Succeeded; write the verity descriptor. */
1307     - err = ext4_write_verity_descriptor(inode, desc, desc_size,
1308     - merkle_tree_size);
1309     -
1310     - /* Write all pages before clearing VERITY_IN_PROGRESS. */
1311     - if (!err)
1312     - err = filemap_write_and_wait(inode->i_mapping);
1313     - }
1314     + /*
1315     + * If an error already occurred (which fs/verity/ signals by passing
1316     + * desc == NULL), then only clean-up is needed.
1317     + */
1318     + if (desc == NULL)
1319     + goto cleanup;
1320    
1321     - /* If we failed, truncate anything we wrote past i_size. */
1322     - if (desc == NULL || err)
1323     - ext4_truncate(inode);
1324     + /* Append the verity descriptor. */
1325     + err = ext4_write_verity_descriptor(inode, desc, desc_size,
1326     + merkle_tree_size);
1327     + if (err)
1328     + goto cleanup;
1329    
1330     /*
1331     - * We must always clean up by clearing EXT4_STATE_VERITY_IN_PROGRESS and
1332     - * deleting the inode from the orphan list, even if something failed.
1333     - * If everything succeeded, we'll also set the verity bit in the same
1334     - * transaction.
1335     + * Write all pages (both data and verity metadata). Note that this must
1336     + * happen before clearing EXT4_STATE_VERITY_IN_PROGRESS; otherwise pages
1337     + * beyond i_size won't be written properly. For crash consistency, this
1338     + * also must happen before the verity inode flag gets persisted.
1339     */
1340     + err = filemap_write_and_wait(inode->i_mapping);
1341     + if (err)
1342     + goto cleanup;
1343    
1344     - ext4_clear_inode_state(inode, EXT4_STATE_VERITY_IN_PROGRESS);
1345     + /*
1346     + * Finally, set the verity inode flag and remove the inode from the
1347     + * orphan list (in a single transaction).
1348     + */
1349    
1350     handle = ext4_journal_start(inode, EXT4_HT_INODE, credits);
1351     if (IS_ERR(handle)) {
1352     - ext4_orphan_del(NULL, inode);
1353     - return PTR_ERR(handle);
1354     + err = PTR_ERR(handle);
1355     + goto cleanup;
1356     }
1357    
1358     - err2 = ext4_orphan_del(handle, inode);
1359     - if (err2)
1360     - goto out_stop;
1361     + err = ext4_orphan_del(handle, inode);
1362     + if (err)
1363     + goto stop_and_cleanup;
1364    
1365     - if (desc != NULL && !err) {
1366     - struct ext4_iloc iloc;
1367     + err = ext4_reserve_inode_write(handle, inode, &iloc);
1368     + if (err)
1369     + goto stop_and_cleanup;
1370    
1371     - err = ext4_reserve_inode_write(handle, inode, &iloc);
1372     - if (err)
1373     - goto out_stop;
1374     - ext4_set_inode_flag(inode, EXT4_INODE_VERITY);
1375     - ext4_set_inode_flags(inode);
1376     - err = ext4_mark_iloc_dirty(handle, inode, &iloc);
1377     - }
1378     -out_stop:
1379     + ext4_set_inode_flag(inode, EXT4_INODE_VERITY);
1380     + ext4_set_inode_flags(inode);
1381     + err = ext4_mark_iloc_dirty(handle, inode, &iloc);
1382     + if (err)
1383     + goto stop_and_cleanup;
1384     +
1385     + ext4_journal_stop(handle);
1386     +
1387     + ext4_clear_inode_state(inode, EXT4_STATE_VERITY_IN_PROGRESS);
1388     + return 0;
1389     +
1390     +stop_and_cleanup:
1391     ext4_journal_stop(handle);
1392     - return err ?: err2;
1393     +cleanup:
1394     + /*
1395     + * Verity failed to be enabled, so clean up by truncating any verity
1396     + * metadata that was written beyond i_size (both from cache and from
1397     + * disk), removing the inode from the orphan list (if it wasn't done
1398     + * already), and clearing EXT4_STATE_VERITY_IN_PROGRESS.
1399     + */
1400     + truncate_inode_pages(inode->i_mapping, inode->i_size);
1401     + ext4_truncate(inode);
1402     + ext4_orphan_del(NULL, inode);
1403     + ext4_clear_inode_state(inode, EXT4_STATE_VERITY_IN_PROGRESS);
1404     + return err;
1405     }
1406    
1407     static int ext4_get_verity_descriptor_location(struct inode *inode,
1408     diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
1409     index 24d4c16e3ae03..717f51e1b1dfa 100644
1410     --- a/include/linux/console_struct.h
1411     +++ b/include/linux/console_struct.h
1412     @@ -62,6 +62,7 @@ struct vc_data {
1413     unsigned int vc_rows;
1414     unsigned int vc_size_row; /* Bytes per row */
1415     unsigned int vc_scan_lines; /* # of scan lines */
1416     + unsigned int vc_cell_height; /* CRTC character cell height */
1417     unsigned long vc_origin; /* [!] Start of real screen */
1418     unsigned long vc_scr_end; /* [!] End of real screen */
1419     unsigned long vc_visible_origin; /* [!] Top of visible window */
1420     diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c
1421     index 771d4ca96dda7..4fe40910f471b 100644
1422     --- a/kernel/locking/mutex-debug.c
1423     +++ b/kernel/locking/mutex-debug.c
1424     @@ -57,7 +57,7 @@ void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
1425     task->blocked_on = waiter;
1426     }
1427    
1428     -void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
1429     +void debug_mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
1430     struct task_struct *task)
1431     {
1432     DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list));
1433     @@ -65,7 +65,7 @@ void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
1434     DEBUG_LOCKS_WARN_ON(task->blocked_on != waiter);
1435     task->blocked_on = NULL;
1436    
1437     - list_del_init(&waiter->list);
1438     + INIT_LIST_HEAD(&waiter->list);
1439     waiter->task = NULL;
1440     }
1441    
1442     diff --git a/kernel/locking/mutex-debug.h b/kernel/locking/mutex-debug.h
1443     index 1edd3f45a4ecb..53e631e1d76da 100644
1444     --- a/kernel/locking/mutex-debug.h
1445     +++ b/kernel/locking/mutex-debug.h
1446     @@ -22,7 +22,7 @@ extern void debug_mutex_free_waiter(struct mutex_waiter *waiter);
1447     extern void debug_mutex_add_waiter(struct mutex *lock,
1448     struct mutex_waiter *waiter,
1449     struct task_struct *task);
1450     -extern void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
1451     +extern void debug_mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
1452     struct task_struct *task);
1453     extern void debug_mutex_unlock(struct mutex *lock);
1454     extern void debug_mutex_init(struct mutex *lock, const char *name,
1455     diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
1456     index 07a9f9f46e035..c0c7784f074b2 100644
1457     --- a/kernel/locking/mutex.c
1458     +++ b/kernel/locking/mutex.c
1459     @@ -204,7 +204,7 @@ static inline bool __mutex_waiter_is_first(struct mutex *lock, struct mutex_wait
1460     * Add @waiter to a given location in the lock wait_list and set the
1461     * FLAG_WAITERS flag if it's the first waiter.
1462     */
1463     -static void __sched
1464     +static void
1465     __mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
1466     struct list_head *list)
1467     {
1468     @@ -215,6 +215,16 @@ __mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
1469     __mutex_set_flag(lock, MUTEX_FLAG_WAITERS);
1470     }
1471    
1472     +static void
1473     +__mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter)
1474     +{
1475     + list_del(&waiter->list);
1476     + if (likely(list_empty(&lock->wait_list)))
1477     + __mutex_clear_flag(lock, MUTEX_FLAGS);
1478     +
1479     + debug_mutex_remove_waiter(lock, waiter, current);
1480     +}
1481     +
1482     /*
1483     * Give up ownership to a specific task, when @task = NULL, this is equivalent
1484     * to a regular unlock. Sets PICKUP on a handoff, clears HANDOF, preserves
1485     @@ -1071,9 +1081,7 @@ acquired:
1486     __ww_mutex_check_waiters(lock, ww_ctx);
1487     }
1488    
1489     - mutex_remove_waiter(lock, &waiter, current);
1490     - if (likely(list_empty(&lock->wait_list)))
1491     - __mutex_clear_flag(lock, MUTEX_FLAGS);
1492     + __mutex_remove_waiter(lock, &waiter);
1493    
1494     debug_mutex_free_waiter(&waiter);
1495    
1496     @@ -1090,7 +1098,7 @@ skip_wait:
1497    
1498     err:
1499     __set_current_state(TASK_RUNNING);
1500     - mutex_remove_waiter(lock, &waiter, current);
1501     + __mutex_remove_waiter(lock, &waiter);
1502     err_early_kill:
1503     spin_unlock(&lock->wait_lock);
1504     debug_mutex_free_waiter(&waiter);
1505     diff --git a/kernel/locking/mutex.h b/kernel/locking/mutex.h
1506     index 1c2287d3fa719..f0c710b1d1927 100644
1507     --- a/kernel/locking/mutex.h
1508     +++ b/kernel/locking/mutex.h
1509     @@ -10,12 +10,10 @@
1510     * !CONFIG_DEBUG_MUTEXES case. Most of them are NOPs:
1511     */
1512    
1513     -#define mutex_remove_waiter(lock, waiter, task) \
1514     - __list_del((waiter)->list.prev, (waiter)->list.next)
1515     -
1516     #define debug_mutex_wake_waiter(lock, waiter) do { } while (0)
1517     #define debug_mutex_free_waiter(waiter) do { } while (0)
1518     #define debug_mutex_add_waiter(lock, waiter, ti) do { } while (0)
1519     +#define debug_mutex_remove_waiter(lock, waiter, ti) do { } while (0)
1520     #define debug_mutex_unlock(lock) do { } while (0)
1521     #define debug_mutex_init(lock, name, key) do { } while (0)
1522    
1523     diff --git a/kernel/ptrace.c b/kernel/ptrace.c
1524     index 79de1294f8ebd..eb4d04cb3aaf5 100644
1525     --- a/kernel/ptrace.c
1526     +++ b/kernel/ptrace.c
1527     @@ -169,6 +169,21 @@ void __ptrace_unlink(struct task_struct *child)
1528     spin_unlock(&child->sighand->siglock);
1529     }
1530    
1531     +static bool looks_like_a_spurious_pid(struct task_struct *task)
1532     +{
1533     + if (task->exit_code != ((PTRACE_EVENT_EXEC << 8) | SIGTRAP))
1534     + return false;
1535     +
1536     + if (task_pid_vnr(task) == task->ptrace_message)
1537     + return false;
1538     + /*
1539     + * The tracee changed its pid but the PTRACE_EVENT_EXEC event
1540     + * was not wait()'ed, most probably debugger targets the old
1541     + * leader which was destroyed in de_thread().
1542     + */
1543     + return true;
1544     +}
1545     +
1546     /* Ensure that nothing can wake it up, even SIGKILL */
1547     static bool ptrace_freeze_traced(struct task_struct *task)
1548     {
1549     @@ -179,7 +194,8 @@ static bool ptrace_freeze_traced(struct task_struct *task)
1550     return ret;
1551    
1552     spin_lock_irq(&task->sighand->siglock);
1553     - if (task_is_traced(task) && !__fatal_signal_pending(task)) {
1554     + if (task_is_traced(task) && !looks_like_a_spurious_pid(task) &&
1555     + !__fatal_signal_pending(task)) {
1556     task->state = __TASK_TRACED;
1557     ret = true;
1558     }
1559     diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
1560     index e693fee08623c..82e76ff01267a 100644
1561     --- a/net/bluetooth/l2cap_sock.c
1562     +++ b/net/bluetooth/l2cap_sock.c
1563     @@ -426,6 +426,20 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname,
1564     break;
1565     }
1566    
1567     + /* Only BR/EDR modes are supported here */
1568     + switch (chan->mode) {
1569     + case L2CAP_MODE_BASIC:
1570     + case L2CAP_MODE_ERTM:
1571     + case L2CAP_MODE_STREAMING:
1572     + break;
1573     + default:
1574     + err = -EINVAL;
1575     + break;
1576     + }
1577     +
1578     + if (err < 0)
1579     + break;
1580     +
1581     memset(&opts, 0, sizeof(opts));
1582     opts.imtu = chan->imtu;
1583     opts.omtu = chan->omtu;
1584     @@ -685,10 +699,8 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname,
1585     break;
1586     }
1587    
1588     - chan->mode = opts.mode;
1589     - switch (chan->mode) {
1590     - case L2CAP_MODE_LE_FLOWCTL:
1591     - break;
1592     + /* Only BR/EDR modes are supported here */
1593     + switch (opts.mode) {
1594     case L2CAP_MODE_BASIC:
1595     clear_bit(CONF_STATE2_DEVICE, &chan->conf_state);
1596     break;
1597     @@ -702,6 +714,10 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname,
1598     break;
1599     }
1600    
1601     + if (err < 0)
1602     + break;
1603     +
1604     + chan->mode = opts.mode;
1605     chan->imtu = opts.imtu;
1606     chan->omtu = opts.omtu;
1607     chan->fcs = opts.fcs;
1608     diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
1609     index 26e8cfad22b8e..4d5ba9778885d 100644
1610     --- a/net/bluetooth/smp.c
1611     +++ b/net/bluetooth/smp.c
1612     @@ -2685,6 +2685,15 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb)
1613     if (skb->len < sizeof(*key))
1614     return SMP_INVALID_PARAMS;
1615    
1616     + /* Check if remote and local public keys are the same and debug key is
1617     + * not in use.
1618     + */
1619     + if (!test_bit(SMP_FLAG_DEBUG_KEY, &smp->flags) &&
1620     + !crypto_memneq(key, smp->local_pk, 64)) {
1621     + bt_dev_err(hdev, "Remote and local public keys are identical");
1622     + return SMP_UNSPECIFIED;
1623     + }
1624     +
1625     memcpy(smp->remote_pk, key, 64);
1626    
1627     if (test_bit(SMP_FLAG_REMOTE_OOB, &smp->flags)) {
1628     diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig
1629     index b0a904cdb932d..e6b4ca469b2aa 100644
1630     --- a/sound/firewire/Kconfig
1631     +++ b/sound/firewire/Kconfig
1632     @@ -38,7 +38,7 @@ config SND_OXFW
1633     * Mackie(Loud) Onyx 1640i (former model)
1634     * Mackie(Loud) Onyx Satellite
1635     * Mackie(Loud) Tapco Link.Firewire
1636     - * Mackie(Loud) d.2 pro/d.4 pro
1637     + * Mackie(Loud) d.4 pro
1638     * Mackie(Loud) U.420/U.420d
1639     * TASCAM FireOne
1640     * Stanton Controllers & Systems 1 Deck/Mixer
1641     @@ -84,7 +84,7 @@ config SND_BEBOB
1642     * PreSonus FIREBOX/FIREPOD/FP10/Inspire1394
1643     * BridgeCo RDAudio1/Audio5
1644     * Mackie Onyx 1220/1620/1640 (FireWire I/O Card)
1645     - * Mackie d.2 (FireWire Option)
1646     + * Mackie d.2 (FireWire Option) and d.2 Pro
1647     * Stanton FinalScratch 2 (ScratchAmp)
1648     * Tascam IF-FW/DM
1649     * Behringer XENIX UFX 1204/1604
1650     diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
1651     index e50e28f77e74e..07e58dcad4afc 100644
1652     --- a/sound/firewire/amdtp-stream.c
1653     +++ b/sound/firewire/amdtp-stream.c
1654     @@ -617,18 +617,24 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
1655     unsigned int *syt, unsigned int index)
1656     {
1657     const __be32 *cip_header;
1658     + unsigned int cip_header_size;
1659     int err;
1660    
1661     *payload_length = be32_to_cpu(ctx_header[0]) >> ISO_DATA_LENGTH_SHIFT;
1662     - if (*payload_length > s->ctx_data.tx.ctx_header_size +
1663     - s->ctx_data.tx.max_ctx_payload_length) {
1664     +
1665     + if (!(s->flags & CIP_NO_HEADER))
1666     + cip_header_size = 8;
1667     + else
1668     + cip_header_size = 0;
1669     +
1670     + if (*payload_length > cip_header_size + s->ctx_data.tx.max_ctx_payload_length) {
1671     dev_err(&s->unit->device,
1672     "Detect jumbo payload: %04x %04x\n",
1673     - *payload_length, s->ctx_data.tx.max_ctx_payload_length);
1674     + *payload_length, cip_header_size + s->ctx_data.tx.max_ctx_payload_length);
1675     return -EIO;
1676     }
1677    
1678     - if (!(s->flags & CIP_NO_HEADER)) {
1679     + if (cip_header_size > 0) {
1680     cip_header = ctx_header + 2;
1681     err = check_cip_header(s, cip_header, *payload_length,
1682     data_blocks, data_block_counter, syt);
1683     @@ -932,23 +938,22 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed)
1684     s->ctx_data.rx.last_syt_offset = TICKS_PER_CYCLE;
1685     }
1686    
1687     - /* initialize packet buffer */
1688     + // initialize packet buffer.
1689     + max_ctx_payload_size = amdtp_stream_get_max_payload(s);
1690     if (s->direction == AMDTP_IN_STREAM) {
1691     dir = DMA_FROM_DEVICE;
1692     type = FW_ISO_CONTEXT_RECEIVE;
1693     - if (!(s->flags & CIP_NO_HEADER))
1694     + if (!(s->flags & CIP_NO_HEADER)) {
1695     + max_ctx_payload_size -= 8;
1696     ctx_header_size = IR_CTX_HEADER_SIZE_CIP;
1697     - else
1698     + } else {
1699     ctx_header_size = IR_CTX_HEADER_SIZE_NO_CIP;
1700     -
1701     - max_ctx_payload_size = amdtp_stream_get_max_payload(s) -
1702     - ctx_header_size;
1703     + }
1704     } else {
1705     dir = DMA_TO_DEVICE;
1706     type = FW_ISO_CONTEXT_TRANSMIT;
1707     ctx_header_size = 0; // No effect for IT context.
1708    
1709     - max_ctx_payload_size = amdtp_stream_get_max_payload(s);
1710     if (!(s->flags & CIP_NO_HEADER))
1711     max_ctx_payload_size -= IT_PKT_HEADER_SIZE_CIP;
1712     }
1713     diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c
1714     index 976d8cb9a34f0..441c58283b47e 100644
1715     --- a/sound/firewire/bebob/bebob.c
1716     +++ b/sound/firewire/bebob/bebob.c
1717     @@ -387,7 +387,7 @@ static const struct ieee1394_device_id bebob_id_table[] = {
1718     SND_BEBOB_DEV_ENTRY(VEN_BRIDGECO, 0x00010049, &spec_normal),
1719     /* Mackie, Onyx 1220/1620/1640 (Firewire I/O Card) */
1720     SND_BEBOB_DEV_ENTRY(VEN_MACKIE2, 0x00010065, &spec_normal),
1721     - /* Mackie, d.2 (Firewire Option) */
1722     + // Mackie, d.2 (Firewire option card) and d.2 Pro (the card is built-in).
1723     SND_BEBOB_DEV_ENTRY(VEN_MACKIE1, 0x00010067, &spec_normal),
1724     /* Stanton, ScratchAmp */
1725     SND_BEBOB_DEV_ENTRY(VEN_STANTON, 0x00000001, &spec_normal),
1726     diff --git a/sound/firewire/dice/dice-alesis.c b/sound/firewire/dice/dice-alesis.c
1727     index f5b325263b674..39a4ef8c85430 100644
1728     --- a/sound/firewire/dice/dice-alesis.c
1729     +++ b/sound/firewire/dice/dice-alesis.c
1730     @@ -16,7 +16,7 @@ alesis_io14_tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT] = {
1731     static const unsigned int
1732     alesis_io26_tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT] = {
1733     {10, 10, 4}, /* Tx0 = Analog + S/PDIF. */
1734     - {16, 8, 0}, /* Tx1 = ADAT1 + ADAT2. */
1735     + {16, 4, 0}, /* Tx1 = ADAT1 + ADAT2 (available at low rate). */
1736     };
1737    
1738     int snd_dice_detect_alesis_formats(struct snd_dice *dice)
1739     diff --git a/sound/firewire/dice/dice-tcelectronic.c b/sound/firewire/dice/dice-tcelectronic.c
1740     index a8875d24ba2aa..43a3bcb15b3d1 100644
1741     --- a/sound/firewire/dice/dice-tcelectronic.c
1742     +++ b/sound/firewire/dice/dice-tcelectronic.c
1743     @@ -38,8 +38,8 @@ static const struct dice_tc_spec konnekt_24d = {
1744     };
1745    
1746     static const struct dice_tc_spec konnekt_live = {
1747     - .tx_pcm_chs = {{16, 16, 16}, {0, 0, 0} },
1748     - .rx_pcm_chs = {{16, 16, 16}, {0, 0, 0} },
1749     + .tx_pcm_chs = {{16, 16, 6}, {0, 0, 0} },
1750     + .rx_pcm_chs = {{16, 16, 6}, {0, 0, 0} },
1751     .has_midi = true,
1752     };
1753    
1754     diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
1755     index fb6df3fc018ed..6184a7c8f2b34 100644
1756     --- a/sound/firewire/oxfw/oxfw.c
1757     +++ b/sound/firewire/oxfw/oxfw.c
1758     @@ -350,7 +350,6 @@ static const struct ieee1394_device_id oxfw_id_table[] = {
1759     * Onyx-i series (former models): 0x081216
1760     * Mackie Onyx Satellite: 0x00200f
1761     * Tapco LINK.firewire 4x6: 0x000460
1762     - * d.2 pro: Unknown
1763     * d.4 pro: Unknown
1764     * U.420: Unknown
1765     * U.420d: Unknown
1766     diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
1767     index d67eae3988bd7..6f1fc87896765 100644
1768     --- a/sound/isa/sb/sb8.c
1769     +++ b/sound/isa/sb/sb8.c
1770     @@ -96,10 +96,6 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
1771    
1772     /* block the 0x388 port to avoid PnP conflicts */
1773     acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
1774     - if (!acard->fm_res) {
1775     - err = -EBUSY;
1776     - goto _err;
1777     - }
1778    
1779     if (port[dev] != SNDRV_AUTO_PORT) {
1780     if ((err = snd_sbdsp_create(card, port[dev], irq[dev],
1781     diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1782     index b7297a22438af..d02c49e1686b6 100644
1783     --- a/sound/pci/hda/patch_realtek.c
1784     +++ b/sound/pci/hda/patch_realtek.c
1785     @@ -385,7 +385,6 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
1786     case 0x10ec0282:
1787     case 0x10ec0283:
1788     case 0x10ec0286:
1789     - case 0x10ec0287:
1790     case 0x10ec0288:
1791     case 0x10ec0285:
1792     case 0x10ec0298:
1793     @@ -396,6 +395,10 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
1794     case 0x10ec0275:
1795     alc_update_coef_idx(codec, 0xe, 0, 1<<0);
1796     break;
1797     + case 0x10ec0287:
1798     + alc_update_coef_idx(codec, 0x10, 1<<9, 0);
1799     + alc_write_coef_idx(codec, 0x8, 0x4ab7);
1800     + break;
1801     case 0x10ec0293:
1802     alc_update_coef_idx(codec, 0xa, 1<<13, 0);
1803     break;
1804     @@ -5605,6 +5608,18 @@ static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
1805     spec->gen.preferred_dacs = preferred_pairs;
1806     }
1807    
1808     +static void alc295_fixup_asus_dacs(struct hda_codec *codec,
1809     + const struct hda_fixup *fix, int action)
1810     +{
1811     + static const hda_nid_t preferred_pairs[] = {
1812     + 0x17, 0x02, 0x21, 0x03, 0
1813     + };
1814     + struct alc_spec *spec = codec->spec;
1815     +
1816     + if (action == HDA_FIXUP_ACT_PRE_PROBE)
1817     + spec->gen.preferred_dacs = preferred_pairs;
1818     +}
1819     +
1820     static void alc_shutup_dell_xps13(struct hda_codec *codec)
1821     {
1822     struct alc_spec *spec = codec->spec;
1823     @@ -6120,6 +6135,35 @@ static void alc294_fixup_gx502_hp(struct hda_codec *codec,
1824     }
1825     }
1826    
1827     +static void alc294_gu502_toggle_output(struct hda_codec *codec,
1828     + struct hda_jack_callback *cb)
1829     +{
1830     + /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
1831     + * responsible from changes between speakers and headphones
1832     + */
1833     + if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
1834     + alc_write_coef_idx(codec, 0x10, 0x8420);
1835     + else
1836     + alc_write_coef_idx(codec, 0x10, 0x0a20);
1837     +}
1838     +
1839     +static void alc294_fixup_gu502_hp(struct hda_codec *codec,
1840     + const struct hda_fixup *fix, int action)
1841     +{
1842     + if (!is_jack_detectable(codec, 0x21))
1843     + return;
1844     +
1845     + switch (action) {
1846     + case HDA_FIXUP_ACT_PRE_PROBE:
1847     + snd_hda_jack_detect_enable_callback(codec, 0x21,
1848     + alc294_gu502_toggle_output);
1849     + break;
1850     + case HDA_FIXUP_ACT_INIT:
1851     + alc294_gu502_toggle_output(codec, NULL);
1852     + break;
1853     + }
1854     +}
1855     +
1856     static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
1857     const struct hda_fixup *fix, int action)
1858     {
1859     @@ -6316,6 +6360,9 @@ enum {
1860     ALC294_FIXUP_ASUS_GX502_HP,
1861     ALC294_FIXUP_ASUS_GX502_PINS,
1862     ALC294_FIXUP_ASUS_GX502_VERBS,
1863     + ALC294_FIXUP_ASUS_GU502_HP,
1864     + ALC294_FIXUP_ASUS_GU502_PINS,
1865     + ALC294_FIXUP_ASUS_GU502_VERBS,
1866     ALC285_FIXUP_HP_GPIO_LED,
1867     ALC285_FIXUP_HP_MUTE_LED,
1868     ALC236_FIXUP_HP_MUTE_LED,
1869     @@ -6342,6 +6389,9 @@ enum {
1870     ALC274_FIXUP_HP_HEADSET_MIC,
1871     ALC256_FIXUP_ASUS_HPE,
1872     ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
1873     + ALC295_FIXUP_ASUS_DACS,
1874     + ALC295_FIXUP_HP_OMEN,
1875     + ALC285_FIXUP_HP_SPECTRE_X360,
1876     };
1877    
1878     static const struct hda_fixup alc269_fixups[] = {
1879     @@ -7540,6 +7590,35 @@ static const struct hda_fixup alc269_fixups[] = {
1880     .type = HDA_FIXUP_FUNC,
1881     .v.func = alc294_fixup_gx502_hp,
1882     },
1883     + [ALC294_FIXUP_ASUS_GU502_PINS] = {
1884     + .type = HDA_FIXUP_PINS,
1885     + .v.pins = (const struct hda_pintbl[]) {
1886     + { 0x19, 0x01a11050 }, /* rear HP mic */
1887     + { 0x1a, 0x01a11830 }, /* rear external mic */
1888     + { 0x21, 0x012110f0 }, /* rear HP out */
1889     + { }
1890     + },
1891     + .chained = true,
1892     + .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
1893     + },
1894     + [ALC294_FIXUP_ASUS_GU502_VERBS] = {
1895     + .type = HDA_FIXUP_VERBS,
1896     + .v.verbs = (const struct hda_verb[]) {
1897     + /* set 0x15 to HP-OUT ctrl */
1898     + { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
1899     + /* unmute the 0x15 amp */
1900     + { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
1901     + /* set 0x1b to HP-OUT */
1902     + { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
1903     + { }
1904     + },
1905     + .chained = true,
1906     + .chain_id = ALC294_FIXUP_ASUS_GU502_HP
1907     + },
1908     + [ALC294_FIXUP_ASUS_GU502_HP] = {
1909     + .type = HDA_FIXUP_FUNC,
1910     + .v.func = alc294_fixup_gu502_hp,
1911     + },
1912     [ALC294_FIXUP_ASUS_COEF_1B] = {
1913     .type = HDA_FIXUP_VERBS,
1914     .v.verbs = (const struct hda_verb[]) {
1915     @@ -7778,6 +7857,39 @@ static const struct hda_fixup alc269_fixups[] = {
1916     .chained = true,
1917     .chain_id = ALC269_FIXUP_THINKPAD_ACPI
1918     },
1919     + [ALC295_FIXUP_ASUS_DACS] = {
1920     + .type = HDA_FIXUP_FUNC,
1921     + .v.func = alc295_fixup_asus_dacs,
1922     + },
1923     + [ALC295_FIXUP_HP_OMEN] = {
1924     + .type = HDA_FIXUP_PINS,
1925     + .v.pins = (const struct hda_pintbl[]) {
1926     + { 0x12, 0xb7a60130 },
1927     + { 0x13, 0x40000000 },
1928     + { 0x14, 0x411111f0 },
1929     + { 0x16, 0x411111f0 },
1930     + { 0x17, 0x90170110 },
1931     + { 0x18, 0x411111f0 },
1932     + { 0x19, 0x02a11030 },
1933     + { 0x1a, 0x411111f0 },
1934     + { 0x1b, 0x04a19030 },
1935     + { 0x1d, 0x40600001 },
1936     + { 0x1e, 0x411111f0 },
1937     + { 0x21, 0x03211020 },
1938     + {}
1939     + },
1940     + .chained = true,
1941     + .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
1942     + },
1943     + [ALC285_FIXUP_HP_SPECTRE_X360] = {
1944     + .type = HDA_FIXUP_PINS,
1945     + .v.pins = (const struct hda_pintbl[]) {
1946     + { 0x14, 0x90170110 }, /* enable top speaker */
1947     + {}
1948     + },
1949     + .chained = true,
1950     + .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1,
1951     + },
1952     };
1953    
1954     static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1955     @@ -7928,7 +8040,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1956     SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1957     SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
1958     SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
1959     + SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
1960     SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
1961     + SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
1962     SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
1963     SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
1964     SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
1965     @@ -7954,6 +8068,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1966     SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
1967     SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
1968     SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
1969     + SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
1970     SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
1971     SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
1972     SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
1973     @@ -7971,6 +8086,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1974     SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
1975     SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
1976     SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
1977     + SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
1978     SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
1979     SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
1980     SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
1981     @@ -8027,12 +8143,19 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1982     SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1983     SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1984     SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1985     + SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1986     SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1987     + SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1988     + SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1989     SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1990     SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1991     SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1992     SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1993     SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1994     + SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1995     + SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1996     + SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1997     + SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1998     SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1999     SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2000     SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2001     @@ -8050,9 +8173,17 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2002     SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2003     SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2004     SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2005     + SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2006     SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2007     SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2008     SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2009     + SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL5XNU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2010     + SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2011     + SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2012     + SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2013     + SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2014     + SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2015     + SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
2016     SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
2017     SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
2018     SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
2019     @@ -8315,6 +8446,8 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
2020     {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
2021     {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
2022     {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
2023     + {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
2024     + {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
2025     {}
2026     };
2027     #define ALC225_STANDARD_PINS \
2028     diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
2029     index 6ff94d8ad86e5..2a73fc4fd019f 100644
2030     --- a/sound/pci/intel8x0.c
2031     +++ b/sound/pci/intel8x0.c
2032     @@ -354,6 +354,7 @@ struct ichdev {
2033     unsigned int ali_slot; /* ALI DMA slot */
2034     struct ac97_pcm *pcm;
2035     int pcm_open_flag;
2036     + unsigned int prepared:1;
2037     unsigned int suspended: 1;
2038     };
2039    
2040     @@ -714,6 +715,9 @@ static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ich
2041     int status, civ, i, step;
2042     int ack = 0;
2043    
2044     + if (!ichdev->prepared || ichdev->suspended)
2045     + return;
2046     +
2047     spin_lock_irqsave(&chip->reg_lock, flags);
2048     status = igetbyte(chip, port + ichdev->roff_sr);
2049     civ = igetbyte(chip, port + ICH_REG_OFF_CIV);
2050     @@ -907,6 +911,7 @@ static int snd_intel8x0_hw_params(struct snd_pcm_substream *substream,
2051     if (ichdev->pcm_open_flag) {
2052     snd_ac97_pcm_close(ichdev->pcm);
2053     ichdev->pcm_open_flag = 0;
2054     + ichdev->prepared = 0;
2055     }
2056     err = snd_ac97_pcm_open(ichdev->pcm, params_rate(hw_params),
2057     params_channels(hw_params),
2058     @@ -928,6 +933,7 @@ static int snd_intel8x0_hw_free(struct snd_pcm_substream *substream)
2059     if (ichdev->pcm_open_flag) {
2060     snd_ac97_pcm_close(ichdev->pcm);
2061     ichdev->pcm_open_flag = 0;
2062     + ichdev->prepared = 0;
2063     }
2064     return snd_pcm_lib_free_pages(substream);
2065     }
2066     @@ -1002,6 +1008,7 @@ static int snd_intel8x0_pcm_prepare(struct snd_pcm_substream *substream)
2067     ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1;
2068     }
2069     snd_intel8x0_setup_periods(chip, ichdev);
2070     + ichdev->prepared = 1;
2071     return 0;
2072     }
2073    
2074     diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
2075     index 0caf53f5764cb..1e38cdda2af69 100644
2076     --- a/sound/usb/line6/driver.c
2077     +++ b/sound/usb/line6/driver.c
2078     @@ -690,6 +690,10 @@ static int line6_init_cap_control(struct usb_line6 *line6)
2079     line6->buffer_message = kmalloc(LINE6_MIDI_MESSAGE_MAXLEN, GFP_KERNEL);
2080     if (!line6->buffer_message)
2081     return -ENOMEM;
2082     +
2083     + ret = line6_init_midi(line6);
2084     + if (ret < 0)
2085     + return ret;
2086     } else {
2087     ret = line6_hwdep_init(line6);
2088     if (ret < 0)
2089     diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c
2090     index ee4c9d220fdf7..b667bb8ad938a 100644
2091     --- a/sound/usb/line6/pod.c
2092     +++ b/sound/usb/line6/pod.c
2093     @@ -376,11 +376,6 @@ static int pod_init(struct usb_line6 *line6,
2094     if (err < 0)
2095     return err;
2096    
2097     - /* initialize MIDI subsystem: */
2098     - err = line6_init_midi(line6);
2099     - if (err < 0)
2100     - return err;
2101     -
2102     /* initialize PCM subsystem: */
2103     err = line6_init_pcm(line6, &pod_pcm_properties);
2104     if (err < 0)
2105     diff --git a/sound/usb/line6/variax.c b/sound/usb/line6/variax.c
2106     index ed158f04de80f..c2245aa93b08f 100644
2107     --- a/sound/usb/line6/variax.c
2108     +++ b/sound/usb/line6/variax.c
2109     @@ -159,7 +159,6 @@ static int variax_init(struct usb_line6 *line6,
2110     const struct usb_device_id *id)
2111     {
2112     struct usb_line6_variax *variax = line6_to_variax(line6);
2113     - int err;
2114    
2115     line6->process_message = line6_variax_process_message;
2116     line6->disconnect = line6_variax_disconnect;
2117     @@ -172,11 +171,6 @@ static int variax_init(struct usb_line6 *line6,
2118     if (variax->buffer_activate == NULL)
2119     return -ENOMEM;
2120    
2121     - /* initialize MIDI subsystem: */
2122     - err = line6_init_midi(&variax->line6);
2123     - if (err < 0)
2124     - return err;
2125     -
2126     /* initiate startup procedure: */
2127     schedule_delayed_work(&line6->startup_work,
2128     msecs_to_jiffies(VARIAX_STARTUP_DELAY1));
2129     diff --git a/sound/usb/midi.c b/sound/usb/midi.c
2130     index c205a26ef5092..33e9a7f6246f7 100644
2131     --- a/sound/usb/midi.c
2132     +++ b/sound/usb/midi.c
2133     @@ -1889,8 +1889,12 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi *umidi,
2134     ms_ep = find_usb_ms_endpoint_descriptor(hostep);
2135     if (!ms_ep)
2136     continue;
2137     + if (ms_ep->bLength <= sizeof(*ms_ep))
2138     + continue;
2139     if (ms_ep->bNumEmbMIDIJack > 0x10)
2140     continue;
2141     + if (ms_ep->bLength < sizeof(*ms_ep) + ms_ep->bNumEmbMIDIJack)
2142     + continue;
2143     if (usb_endpoint_dir_out(ep)) {
2144     if (endpoints[epidx].out_ep) {
2145     if (++epidx >= MIDI_MAX_ENDPOINTS) {