[source] gpio-button-hotplug: leave platform_device.dev.platform_data untouched

LEDE Commits lede-commits at lists.infradead.org
Mon Aug 21 12:30:21 PDT 2017


hauke pushed a commit to source.git, branch master:
https://git.lede-project.org/5a22df69e421246ba4653d3dd70d25d1aaa5d31c

commit 5a22df69e421246ba4653d3dd70d25d1aaa5d31c
Author: Furong Xu <xfr at outlook.com>
AuthorDate: Thu Mar 2 17:00:32 2017 +0800

    gpio-button-hotplug: leave platform_device.dev.platform_data untouched
    
    get platform_data from gpio_keys_button_dev.pdata, and fix a illegal pointer
    dereference like this:
    
    [   51.143776] gpio-keys-polled gpio-keys-polled: missing poll_interval value
    [   51.150852] gpio-keys-polled: probe of gpio-keys-polled failed with error -22
    [  828.159993] gpio-keys-polled gpio-keys-polled: no memory for button data
    [  828.166821] gpio-keys-polled: probe of gpio-keys-polled failed with error -12
    
    Signed-off-by: Furong Xu <xfr at outlook.com>
---
 package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
index 2bd3ff1..1aef23e 100644
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
@@ -474,7 +474,6 @@ static int gpio_keys_button_probe(struct platform_device *pdev,
 			dev_err(dev, "missing platform data\n");
 			return -EINVAL;
 		}
-		pdev->dev.platform_data = pdata;
 	}
 
 	if (polled && !pdata->poll_interval) {
@@ -559,7 +558,7 @@ static int gpio_keys_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	pdata = pdev->dev.platform_data;
+	pdata = bdev->pdata;
 	for (i = 0; i < pdata->nbuttons; i++) {
 		struct gpio_keys_button *button = &pdata->buttons[i];
 		struct gpio_keys_button_data *bdata = &bdev->data[i];



More information about the lede-commits mailing list