From: Jinjie Ruan <ruanjinjie@huawei.com> To: <jic23@kernel.org>, <lars@metafoo.de>, <matthias.bgg@gmail.com>, <angelogioacchino.delregno@collabora.com>, <linux-iio@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org> Cc: <ruanjinjie@huawei.com> Subject: [PATCH -next 1/2] iio: adc: mt6577_auxadc: Simplify with dev_err_probe() Date: Sat, 26 Aug 2023 11:54:01 +0800 [thread overview] Message-ID: <20230826035402.3512033-2-ruanjinjie@huawei.com> (raw) In-Reply-To: <20230826035402.3512033-1-ruanjinjie@huawei.com> Use the dev_err_probe() helper to simplify error handling during probe. This also handle scenario, when EDEFER is returned and useless error is printed. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Suggested-by: Jonathan Cameron <jic23@kernel.org> --- drivers/iio/adc/mt6577_auxadc.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c index ea42fd7a8c99..935cf560e238 100644 --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -265,22 +265,18 @@ static int mt6577_auxadc_probe(struct platform_device *pdev) indio_dev->num_channels = ARRAY_SIZE(mt6577_auxadc_iio_channels); adc_dev->reg_base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(adc_dev->reg_base)) { - dev_err(&pdev->dev, "failed to get auxadc base address\n"); - return PTR_ERR(adc_dev->reg_base); - } + if (IS_ERR(adc_dev->reg_base)) + return dev_err_probe(&pdev->dev, PTR_ERR(adc_dev->reg_base), + "failed to get auxadc base address\n"); adc_dev->adc_clk = devm_clk_get_enabled(&pdev->dev, "main"); - if (IS_ERR(adc_dev->adc_clk)) { - dev_err(&pdev->dev, "failed to enable auxadc clock\n"); - return PTR_ERR(adc_dev->adc_clk); - } + if (IS_ERR(adc_dev->adc_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(adc_dev->adc_clk), + "failed to enable auxadc clock\n"); adc_clk_rate = clk_get_rate(adc_dev->adc_clk); - if (!adc_clk_rate) { - dev_err(&pdev->dev, "null clock rate\n"); - return -EINVAL; - } + if (!adc_clk_rate) + return dev_err_probe(&pdev->dev, -EINVAL, "null clock rate\n"); adc_dev->dev_comp = device_get_match_data(&pdev->dev); -- 2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Jinjie Ruan <ruanjinjie@huawei.com> To: <jic23@kernel.org>, <lars@metafoo.de>, <matthias.bgg@gmail.com>, <angelogioacchino.delregno@collabora.com>, <linux-iio@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org> Cc: <ruanjinjie@huawei.com> Subject: [PATCH -next 1/2] iio: adc: mt6577_auxadc: Simplify with dev_err_probe() Date: Sat, 26 Aug 2023 11:54:01 +0800 [thread overview] Message-ID: <20230826035402.3512033-2-ruanjinjie@huawei.com> (raw) In-Reply-To: <20230826035402.3512033-1-ruanjinjie@huawei.com> Use the dev_err_probe() helper to simplify error handling during probe. This also handle scenario, when EDEFER is returned and useless error is printed. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Suggested-by: Jonathan Cameron <jic23@kernel.org> --- drivers/iio/adc/mt6577_auxadc.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c index ea42fd7a8c99..935cf560e238 100644 --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -265,22 +265,18 @@ static int mt6577_auxadc_probe(struct platform_device *pdev) indio_dev->num_channels = ARRAY_SIZE(mt6577_auxadc_iio_channels); adc_dev->reg_base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(adc_dev->reg_base)) { - dev_err(&pdev->dev, "failed to get auxadc base address\n"); - return PTR_ERR(adc_dev->reg_base); - } + if (IS_ERR(adc_dev->reg_base)) + return dev_err_probe(&pdev->dev, PTR_ERR(adc_dev->reg_base), + "failed to get auxadc base address\n"); adc_dev->adc_clk = devm_clk_get_enabled(&pdev->dev, "main"); - if (IS_ERR(adc_dev->adc_clk)) { - dev_err(&pdev->dev, "failed to enable auxadc clock\n"); - return PTR_ERR(adc_dev->adc_clk); - } + if (IS_ERR(adc_dev->adc_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(adc_dev->adc_clk), + "failed to enable auxadc clock\n"); adc_clk_rate = clk_get_rate(adc_dev->adc_clk); - if (!adc_clk_rate) { - dev_err(&pdev->dev, "null clock rate\n"); - return -EINVAL; - } + if (!adc_clk_rate) + return dev_err_probe(&pdev->dev, -EINVAL, "null clock rate\n"); adc_dev->dev_comp = device_get_match_data(&pdev->dev); -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-08-26 3:55 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-26 3:54 [PATCH -next 0/2] iio: adc: mt6577_auxadc: Cleanup with the helpers Jinjie Ruan 2023-08-26 3:54 ` Jinjie Ruan 2023-08-26 3:54 ` Jinjie Ruan [this message] 2023-08-26 3:54 ` [PATCH -next 1/2] iio: adc: mt6577_auxadc: Simplify with dev_err_probe() Jinjie Ruan 2023-09-13 8:56 ` AngeloGioacchino Del Regno 2023-09-13 8:56 ` AngeloGioacchino Del Regno 2023-08-26 3:54 ` [PATCH -next 2/2] iio: adc: mt6577_auxadc: Simplify with device managed function Jinjie Ruan 2023-08-26 3:54 ` Jinjie Ruan 2023-08-27 17:04 ` Jonathan Cameron 2023-08-27 17:04 ` Jonathan Cameron 2023-09-13 8:56 ` AngeloGioacchino Del Regno 2023-09-13 8:56 ` AngeloGioacchino Del Regno 2023-09-13 19:17 ` Jonathan Cameron 2023-09-13 19:17 ` Jonathan Cameron 2023-08-27 17:07 ` [PATCH -next 0/2] iio: adc: mt6577_auxadc: Cleanup with the helpers Jonathan Cameron 2023-08-27 17:07 ` Jonathan Cameron
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230826035402.3512033-2-ruanjinjie@huawei.com \ --to=ruanjinjie@huawei.com \ --cc=angelogioacchino.delregno@collabora.com \ --cc=jic23@kernel.org \ --cc=lars@metafoo.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-iio@vger.kernel.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=matthias.bgg@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.