Skip to content

Commit

Permalink
extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()'
Browse files Browse the repository at this point in the history
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: 1993986 ("extcon: adc_jack: adc-jack driver to support 3.5 pi or simliar devices")
Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Chanwoo Choi <[email protected]>
  • Loading branch information
tititiou36 authored and chanwoochoi committed May 29, 2020
1 parent 1fa80f1 commit bc84cff
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/extcon/extcon-adc-jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit bc84cff

Please sign in to comment.