Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <christophe.jaillet@wanadoo.fr>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Christophe JAILLET and committed by
Chanwoo Choi
bc84cff2 1fa80f18

+1 -2
+1 -2
drivers/extcon/extcon-adc-jack.c
··· 124 124 for (i = 0; data->adc_conditions[i].id != EXTCON_NONE; i++); 125 125 data->num_conditions = i; 126 126 127 - data->chan = iio_channel_get(&pdev->dev, pdata->consumer_channel); 127 + data->chan = devm_iio_channel_get(&pdev->dev, pdata->consumer_channel); 128 128 if (IS_ERR(data->chan)) 129 129 return PTR_ERR(data->chan); 130 130 ··· 164 164 165 165 free_irq(data->irq, data); 166 166 cancel_work_sync(&data->handler.work); 167 - iio_channel_release(data->chan); 168 167 169 168 return 0; 170 169 }