* [PATCH] gnss: mtk: Simplify return variables in mtk_set_active and mtk_set_standby
@ 2024-11-17 5:25 Nobuhiro Iwamatsu
2024-11-18 6:44 ` AngeloGioacchino Del Regno
2025-01-14 15:10 ` Johan Hovold
0 siblings, 2 replies; 3+ messages in thread
From: Nobuhiro Iwamatsu @ 2024-11-17 5:25 UTC (permalink / raw)
To: Johan Hovold, Matthias Brugger, AngeloGioacchino Del Regno
Cc: linux-kernel, linux-arm-kernel, linux-mediatek, Nobuhiro Iwamatsu
Simply return directly instead of assign the return value.
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
drivers/gnss/mtk.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/gnss/mtk.c b/drivers/gnss/mtk.c
index c62b1211f4fe4e..be20f6d6470736 100644
--- a/drivers/gnss/mtk.c
+++ b/drivers/gnss/mtk.c
@@ -24,25 +24,15 @@ struct mtk_data {
static int mtk_set_active(struct gnss_serial *gserial)
{
struct mtk_data *data = gnss_serial_get_drvdata(gserial);
- int ret;
- ret = regulator_enable(data->vcc);
- if (ret)
- return ret;
-
- return 0;
+ return regulator_enable(data->vcc);
}
static int mtk_set_standby(struct gnss_serial *gserial)
{
struct mtk_data *data = gnss_serial_get_drvdata(gserial);
- int ret;
- ret = regulator_disable(data->vcc);
- if (ret)
- return ret;
-
- return 0;
+ return regulator_disable(data->vcc);
}
static int mtk_set_power(struct gnss_serial *gserial,
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] gnss: mtk: Simplify return variables in mtk_set_active and mtk_set_standby
2024-11-17 5:25 [PATCH] gnss: mtk: Simplify return variables in mtk_set_active and mtk_set_standby Nobuhiro Iwamatsu
@ 2024-11-18 6:44 ` AngeloGioacchino Del Regno
2025-01-14 15:10 ` Johan Hovold
1 sibling, 0 replies; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-11-18 6:44 UTC (permalink / raw)
To: Nobuhiro Iwamatsu, Johan Hovold, Matthias Brugger
Cc: linux-kernel, linux-arm-kernel, linux-mediatek
Il 17/11/24 06:25, Nobuhiro Iwamatsu ha scritto:
> Simply return directly instead of assign the return value.
>
> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gnss: mtk: Simplify return variables in mtk_set_active and mtk_set_standby
2024-11-17 5:25 [PATCH] gnss: mtk: Simplify return variables in mtk_set_active and mtk_set_standby Nobuhiro Iwamatsu
2024-11-18 6:44 ` AngeloGioacchino Del Regno
@ 2025-01-14 15:10 ` Johan Hovold
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2025-01-14 15:10 UTC (permalink / raw)
To: Nobuhiro Iwamatsu
Cc: Matthias Brugger, AngeloGioacchino Del Regno, linux-kernel,
linux-arm-kernel, linux-mediatek
On Sun, Nov 17, 2024 at 02:25:01PM +0900, Nobuhiro Iwamatsu wrote:
> Simply return directly instead of assign the return value.
>
> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> ---
> drivers/gnss/mtk.c | 14 ++------------
> 1 file changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gnss/mtk.c b/drivers/gnss/mtk.c
> index c62b1211f4fe4e..be20f6d6470736 100644
> --- a/drivers/gnss/mtk.c
> +++ b/drivers/gnss/mtk.c
> @@ -24,25 +24,15 @@ struct mtk_data {
> static int mtk_set_active(struct gnss_serial *gserial)
> {
> struct mtk_data *data = gnss_serial_get_drvdata(gserial);
> - int ret;
>
> - ret = regulator_enable(data->vcc);
> - if (ret)
> - return ret;
> -
> - return 0;
> + return regulator_enable(data->vcc);
The current style with separate success and error paths was used on
purpose (e.g. to make it obvious from just looking at this function to
determine what is returned).
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-14 15:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-17 5:25 [PATCH] gnss: mtk: Simplify return variables in mtk_set_active and mtk_set_standby Nobuhiro Iwamatsu
2024-11-18 6:44 ` AngeloGioacchino Del Regno
2025-01-14 15:10 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox