From 1fa80f182794bbefe8f1bffd74abda5470cdd973 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 16 Apr 2020 00:08:21 +0100 Subject: extcon: remove redundant assignment to variable idx The variable idx is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 2dfbfec572f9..0a6438cbb3f3 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -900,7 +900,7 @@ int extcon_register_notifier(struct extcon_dev *edev, unsigned int id, struct notifier_block *nb) { unsigned long flags; - int ret, idx = -EINVAL; + int ret, idx; if (!edev || !nb) return -EINVAL; -- cgit From bc84cff2c92ae5ccb2c37da73756e7174b1b430f Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sun, 10 May 2020 11:53:03 +0200 Subject: extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()' In some error handling paths, a call to 'iio_channel_get()' is not balanced by a corresponding call to 'iio_channel_release()'. This can be achieved easily by using the devm_ variant of 'iio_channel_get()'. This has the extra benefit to simplify the remove function. Fixes: 19939860dcae ("extcon: adc_jack: adc-jack driver to support 3.5 pi or simliar devices") Signed-off-by: Christophe JAILLET Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-adc-jack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c index ad02dc6747a4..0317b614b680 100644 --- a/drivers/extcon/extcon-adc-jack.c +++ b/drivers/extcon/extcon-adc-jack.c @@ -124,7 +124,7 @@ static int adc_jack_probe(struct platform_device *pdev) for (i = 0; data->adc_conditions[i].id != EXTCON_NONE; i++); data->num_conditions = i; - data->chan = iio_channel_get(&pdev->dev, pdata->consumer_channel); + data->chan = devm_iio_channel_get(&pdev->dev, pdata->consumer_channel); if (IS_ERR(data->chan)) return PTR_ERR(data->chan); @@ -164,7 +164,6 @@ static int adc_jack_remove(struct platform_device *pdev) free_irq(data->irq, data); cancel_work_sync(&data->handler.work); - iio_channel_release(data->chan); return 0; } -- cgit From 3d6954dda499f73b0efb659d22b65428345753bf Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Fri, 22 May 2020 12:24:47 +0200 Subject: extcon: max14577: Add proper dt-compatible strings Add device tree compatible strings and create proper modalias structures to let this driver load automatically if compiled as module, because max14577 MFD driver creates MFD cells with such compatible strings. Signed-off-by: Marek Szyprowski Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-max14577.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c index 32f663436e6e..cc47d626095c 100644 --- a/drivers/extcon/extcon-max14577.c +++ b/drivers/extcon/extcon-max14577.c @@ -782,9 +782,19 @@ static const struct platform_device_id max14577_muic_id[] = { }; MODULE_DEVICE_TABLE(platform, max14577_muic_id); +static const struct of_device_id of_max14577_muic_dt_match[] = { + { .compatible = "maxim,max14577-muic", + .data = (void *)MAXIM_DEVICE_TYPE_MAX14577, }, + { .compatible = "maxim,max77836-muic", + .data = (void *)MAXIM_DEVICE_TYPE_MAX77836, }, + { }, +}; +MODULE_DEVICE_TABLE(of, of_max14577_muic_dt_match); + static struct platform_driver max14577_muic_driver = { .driver = { .name = "max14577-muic", + .of_match_table = of_max14577_muic_dt_match, }, .probe = max14577_muic_probe, .remove = max14577_muic_remove, -- cgit From b2e5575a8d04028d17f6c914eea31036589bc79a Mon Sep 17 00:00:00 2001 From: Dinghao Liu Date: Sat, 23 May 2020 14:17:26 +0800 Subject: extcon: arizona: Fix runtime PM imbalance on error When arizona_request_irq() returns an error code, a pairing runtime PM usage counter decrement is needed to keep the counter balanced. For error paths after this function, things are the same. Also, remove calls to pm_runtime_disable() when pm_runtime_enable() has not been executed. Signed-off-by: Dinghao Liu Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-arizona.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 7401733db08b..aae82db542a5 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -1460,7 +1460,7 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (!info->input) { dev_err(arizona->dev, "Can't allocate input dev\n"); ret = -ENOMEM; - goto err_register; + return ret; } info->input->name = "Headset"; @@ -1492,7 +1492,7 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (ret != 0) { dev_err(arizona->dev, "Failed to request GPIO%d: %d\n", pdata->micd_pol_gpio, ret); - goto err_register; + return ret; } info->micd_pol_gpio = gpio_to_desc(pdata->micd_pol_gpio); @@ -1515,7 +1515,7 @@ static int arizona_extcon_probe(struct platform_device *pdev) dev_err(arizona->dev, "Failed to get microphone polarity GPIO: %d\n", ret); - goto err_register; + return ret; } } @@ -1672,7 +1672,7 @@ static int arizona_extcon_probe(struct platform_device *pdev) if (ret != 0) { dev_err(&pdev->dev, "Failed to get JACKDET rise IRQ: %d\n", ret); - goto err_gpio; + goto err_pm; } ret = arizona_set_irq_wake(arizona, jack_irq_rise, 1); @@ -1721,14 +1721,14 @@ static int arizona_extcon_probe(struct platform_device *pdev) dev_warn(arizona->dev, "Failed to set MICVDD to bypass: %d\n", ret); - pm_runtime_put(&pdev->dev); - ret = input_register_device(info->input); if (ret) { dev_err(&pdev->dev, "Can't register input device: %d\n", ret); goto err_hpdet; } + pm_runtime_put(&pdev->dev); + return 0; err_hpdet: @@ -1743,10 +1743,11 @@ err_rise_wake: arizona_set_irq_wake(arizona, jack_irq_rise, 0); err_rise: arizona_free_irq(arizona, jack_irq_rise, info); +err_pm: + pm_runtime_put(&pdev->dev); + pm_runtime_disable(&pdev->dev); err_gpio: gpiod_put(info->micd_pol_gpio); -err_register: - pm_runtime_disable(&pdev->dev); return ret; } -- cgit