| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Freescale MXS LRADC ADC driver |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 7 | 8 | * Authors: |
|---|
| 8 | 9 | * Marek Vasut <marex@denx.de> |
|---|
| 9 | 10 | * Ksenija Stanojevic <ksenija.stanojevic@gmail.com> |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 12 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 13 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 14 | | - * (at your option) any later version. |
|---|
| 15 | | - * |
|---|
| 16 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 17 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 | | - * GNU General Public License for more details. |
|---|
| 20 | 11 | */ |
|---|
| 21 | 12 | |
|---|
| 22 | 13 | #include <linux/completion.h> |
|---|
| .. | .. |
|---|
| 466 | 457 | |
|---|
| 467 | 458 | trig = devm_iio_trigger_alloc(&iio->dev, "%s-dev%i", iio->name, |
|---|
| 468 | 459 | iio->id); |
|---|
| 460 | + if (!trig) |
|---|
| 461 | + return -ENOMEM; |
|---|
| 469 | 462 | |
|---|
| 470 | 463 | trig->dev.parent = adc->dev; |
|---|
| 471 | 464 | iio_trigger_set_drvdata(trig, iio); |
|---|
| .. | .. |
|---|
| 576 | 569 | |
|---|
| 577 | 570 | static const struct iio_buffer_setup_ops mxs_lradc_adc_buffer_ops = { |
|---|
| 578 | 571 | .preenable = &mxs_lradc_adc_buffer_preenable, |
|---|
| 579 | | - .postenable = &iio_triggered_buffer_postenable, |
|---|
| 580 | | - .predisable = &iio_triggered_buffer_predisable, |
|---|
| 581 | 572 | .postdisable = &mxs_lradc_adc_buffer_postdisable, |
|---|
| 582 | 573 | .validate_scan_mask = &mxs_lradc_adc_validate_scan_mask, |
|---|
| 583 | 574 | }; |
|---|
| .. | .. |
|---|
| 730 | 721 | platform_set_drvdata(pdev, iio); |
|---|
| 731 | 722 | |
|---|
| 732 | 723 | iio->name = pdev->name; |
|---|
| 733 | | - iio->dev.parent = dev; |
|---|
| 734 | 724 | iio->dev.of_node = dev->parent->of_node; |
|---|
| 735 | 725 | iio->info = &mxs_lradc_adc_iio_info; |
|---|
| 736 | 726 | iio->modes = INDIO_DIRECT_MODE; |
|---|
| .. | .. |
|---|
| 767 | 757 | |
|---|
| 768 | 758 | ret = mxs_lradc_adc_trigger_init(iio); |
|---|
| 769 | 759 | if (ret) |
|---|
| 770 | | - goto err_trig; |
|---|
| 760 | + return ret; |
|---|
| 771 | 761 | |
|---|
| 772 | 762 | ret = iio_triggered_buffer_setup(iio, &iio_pollfunc_store_time, |
|---|
| 773 | 763 | &mxs_lradc_adc_trigger_handler, |
|---|
| 774 | 764 | &mxs_lradc_adc_buffer_ops); |
|---|
| 775 | 765 | if (ret) |
|---|
| 776 | | - return ret; |
|---|
| 766 | + goto err_trig; |
|---|
| 777 | 767 | |
|---|
| 778 | 768 | adc->vref_mv = mxs_lradc_adc_vref_mv[lradc->soc]; |
|---|
| 779 | 769 | |
|---|
| .. | .. |
|---|
| 811 | 801 | |
|---|
| 812 | 802 | err_dev: |
|---|
| 813 | 803 | mxs_lradc_adc_hw_stop(adc); |
|---|
| 814 | | - mxs_lradc_adc_trigger_remove(iio); |
|---|
| 815 | | -err_trig: |
|---|
| 816 | 804 | iio_triggered_buffer_cleanup(iio); |
|---|
| 805 | +err_trig: |
|---|
| 806 | + mxs_lradc_adc_trigger_remove(iio); |
|---|
| 817 | 807 | return ret; |
|---|
| 818 | 808 | } |
|---|
| 819 | 809 | |
|---|
| .. | .. |
|---|
| 824 | 814 | |
|---|
| 825 | 815 | iio_device_unregister(iio); |
|---|
| 826 | 816 | mxs_lradc_adc_hw_stop(adc); |
|---|
| 827 | | - mxs_lradc_adc_trigger_remove(iio); |
|---|
| 828 | 817 | iio_triggered_buffer_cleanup(iio); |
|---|
| 818 | + mxs_lradc_adc_trigger_remove(iio); |
|---|
| 829 | 819 | |
|---|
| 830 | 820 | return 0; |
|---|
| 831 | 821 | } |
|---|