aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-06-18 12:02:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-06-18 12:02:37 -0400
commit07b5ca22a1e6268c5193f9606ad5b746853ace40 (patch)
tree7d9e92d3b98b3b6d3602b7608c5bd72d5b2b17e3
parent4c6459f945c7c64123c4aec0667d196090213d53 (diff)
parent5014e904681ddbdf663bb20f134eb053ddccb181 (diff)
Merge tag 'char-misc-4.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here are a small number of char and misc driver fixes for 4.7-rc4. They resolve some minor issues that have been reported, and have all been in linux-next" * tag 'char-misc-4.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: coresight: Handle build path error coresight: Fix erroneous memset in tmc_read_unprepare_etr coresight: Fix tmc_read_unprepare_etr coresight: Fix NULL pointer dereference in _coresight_build_path extcon: palmas: Fix boot up state of VBUS when using GPIO detection mcb: Acquire reference to carrier module in core mcb: Acquire reference to device in probe mei: don't use wake_up_interruptible for wr_ctrl
-rw-r--r--drivers/extcon/extcon-palmas.c2
-rw-r--r--drivers/hwtracing/coresight/coresight-tmc-etr.c11
-rw-r--r--drivers/hwtracing/coresight/coresight.c15
-rw-r--r--drivers/mcb/mcb-core.c17
-rw-r--r--drivers/misc/mei/client.c2
5 files changed, 32 insertions, 15 deletions
diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 8b3226dca1d9..caff46c0e214 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -360,6 +360,8 @@ static int palmas_usb_probe(struct platform_device *pdev)
360 360
361 palmas_enable_irq(palmas_usb); 361 palmas_enable_irq(palmas_usb);
362 /* perform initial detection */ 362 /* perform initial detection */
363 if (palmas_usb->enable_gpio_vbus_detection)
364 palmas_vbus_irq_handler(palmas_usb->gpio_vbus_irq, palmas_usb);
363 palmas_gpio_id_detect(&palmas_usb->wq_detectid.work); 365 palmas_gpio_id_detect(&palmas_usb->wq_detectid.work);
364 device_set_wakeup_capable(&pdev->dev, true); 366 device_set_wakeup_capable(&pdev->dev, true);
365 return 0; 367 return 0;
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
index 847d1b5f2c13..688be9e060fc 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
@@ -300,13 +300,10 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata)
300 if (local_read(&drvdata->mode) == CS_MODE_SYSFS) { 300 if (local_read(&drvdata->mode) == CS_MODE_SYSFS) {
301 /* 301 /*
302 * The trace run will continue with the same allocated trace 302 * The trace run will continue with the same allocated trace
303 * buffer. As such zero-out the buffer so that we don't end 303 * buffer. The trace buffer is cleared in tmc_etr_enable_hw(),
304 * up with stale data. 304 * so we don't have to explicitly clear it. Also, since the
305 * 305 * tracer is still enabled drvdata::buf can't be NULL.
306 * Since the tracer is still enabled drvdata::buf
307 * can't be NULL.
308 */ 306 */
309 memset(drvdata->buf, 0, drvdata->size);
310 tmc_etr_enable_hw(drvdata); 307 tmc_etr_enable_hw(drvdata);
311 } else { 308 } else {
312 /* 309 /*
@@ -315,7 +312,7 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata)
315 */ 312 */
316 vaddr = drvdata->vaddr; 313 vaddr = drvdata->vaddr;
317 paddr = drvdata->paddr; 314 paddr = drvdata->paddr;
318 drvdata->buf = NULL; 315 drvdata->buf = drvdata->vaddr = NULL;
319 } 316 }
320 317
321 drvdata->reading = false; 318 drvdata->reading = false;
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index 5443d03a1eec..d08d1ab9bba5 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -385,7 +385,6 @@ static int _coresight_build_path(struct coresight_device *csdev,
385 int i; 385 int i;
386 bool found = false; 386 bool found = false;
387 struct coresight_node *node; 387 struct coresight_node *node;
388 struct coresight_connection *conn;
389 388
390 /* An activated sink has been found. Enqueue the element */ 389 /* An activated sink has been found. Enqueue the element */
391 if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || 390 if ((csdev->type == CORESIGHT_DEV_TYPE_SINK ||
@@ -394,8 +393,9 @@ static int _coresight_build_path(struct coresight_device *csdev,
394 393
395 /* Not a sink - recursively explore each port found on this element */ 394 /* Not a sink - recursively explore each port found on this element */
396 for (i = 0; i < csdev->nr_outport; i++) { 395 for (i = 0; i < csdev->nr_outport; i++) {
397 conn = &csdev->conns[i]; 396 struct coresight_device *child_dev = csdev->conns[i].child_dev;
398 if (_coresight_build_path(conn->child_dev, path) == 0) { 397
398 if (child_dev && _coresight_build_path(child_dev, path) == 0) {
399 found = true; 399 found = true;
400 break; 400 break;
401 } 401 }
@@ -425,6 +425,7 @@ out:
425struct list_head *coresight_build_path(struct coresight_device *csdev) 425struct list_head *coresight_build_path(struct coresight_device *csdev)
426{ 426{
427 struct list_head *path; 427 struct list_head *path;
428 int rc;
428 429
429 path = kzalloc(sizeof(struct list_head), GFP_KERNEL); 430 path = kzalloc(sizeof(struct list_head), GFP_KERNEL);
430 if (!path) 431 if (!path)
@@ -432,9 +433,10 @@ struct list_head *coresight_build_path(struct coresight_device *csdev)
432 433
433 INIT_LIST_HEAD(path); 434 INIT_LIST_HEAD(path);
434 435
435 if (_coresight_build_path(csdev, path)) { 436 rc = _coresight_build_path(csdev, path);
437 if (rc) {
436 kfree(path); 438 kfree(path);
437 path = NULL; 439 return ERR_PTR(rc);
438 } 440 }
439 441
440 return path; 442 return path;
@@ -507,8 +509,9 @@ int coresight_enable(struct coresight_device *csdev)
507 goto out; 509 goto out;
508 510
509 path = coresight_build_path(csdev); 511 path = coresight_build_path(csdev);
510 if (!path) { 512 if (IS_ERR(path)) {
511 pr_err("building path(s) failed\n"); 513 pr_err("building path(s) failed\n");
514 ret = PTR_ERR(path);
512 goto out; 515 goto out;
513 } 516 }
514 517
diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c
index b73c6e7d28e4..6f2c8522e14a 100644
--- a/drivers/mcb/mcb-core.c
+++ b/drivers/mcb/mcb-core.c
@@ -61,21 +61,36 @@ static int mcb_probe(struct device *dev)
61 struct mcb_driver *mdrv = to_mcb_driver(dev->driver); 61 struct mcb_driver *mdrv = to_mcb_driver(dev->driver);
62 struct mcb_device *mdev = to_mcb_device(dev); 62 struct mcb_device *mdev = to_mcb_device(dev);
63 const struct mcb_device_id *found_id; 63 const struct mcb_device_id *found_id;
64 struct module *carrier_mod;
65 int ret;
64 66
65 found_id = mcb_match_id(mdrv->id_table, mdev); 67 found_id = mcb_match_id(mdrv->id_table, mdev);
66 if (!found_id) 68 if (!found_id)
67 return -ENODEV; 69 return -ENODEV;
68 70
69 return mdrv->probe(mdev, found_id); 71 carrier_mod = mdev->dev.parent->driver->owner;
72 if (!try_module_get(carrier_mod))
73 return -EINVAL;
74
75 get_device(dev);
76 ret = mdrv->probe(mdev, found_id);
77 if (ret)
78 module_put(carrier_mod);
79
80 return ret;
70} 81}
71 82
72static int mcb_remove(struct device *dev) 83static int mcb_remove(struct device *dev)
73{ 84{
74 struct mcb_driver *mdrv = to_mcb_driver(dev->driver); 85 struct mcb_driver *mdrv = to_mcb_driver(dev->driver);
75 struct mcb_device *mdev = to_mcb_device(dev); 86 struct mcb_device *mdev = to_mcb_device(dev);
87 struct module *carrier_mod;
76 88
77 mdrv->remove(mdev); 89 mdrv->remove(mdev);
78 90
91 carrier_mod = mdev->dev.parent->driver->owner;
92 module_put(carrier_mod);
93
79 put_device(&mdev->dev); 94 put_device(&mdev->dev);
80 95
81 return 0; 96 return 0;
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
index eed254da63a8..641c1a566687 100644
--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -730,7 +730,7 @@ static void mei_cl_wake_all(struct mei_cl *cl)
730 /* synchronized under device mutex */ 730 /* synchronized under device mutex */
731 if (waitqueue_active(&cl->wait)) { 731 if (waitqueue_active(&cl->wait)) {
732 cl_dbg(dev, cl, "Waking up ctrl write clients!\n"); 732 cl_dbg(dev, cl, "Waking up ctrl write clients!\n");
733 wake_up_interruptible(&cl->wait); 733 wake_up(&cl->wait);
734 } 734 }
735} 735}
736 736