* [PATCH] gnss: ubx: Simplify the return expression in the ubx.c
@ 2021-02-24 9:29 dingsenjie
2021-02-24 9:38 ` Johan Hovold
0 siblings, 1 reply; 2+ messages in thread
From: dingsenjie @ 2021-02-24 9:29 UTC (permalink / raw)
To: johan; +Cc: linux-kernel, dingsenjie
From: dingsenjie <dingsenjie@yulong.com>
Simplify the return expression.
Signed-off-by: dingsenjie <dingsenjie@yulong.com>
---
drivers/gnss/ubx.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c
index 7b05bc4..7a22fc9 100644
--- a/drivers/gnss/ubx.c
+++ b/drivers/gnss/ubx.c
@@ -24,25 +24,15 @@ struct ubx_data {
static int ubx_set_active(struct gnss_serial *gserial)
{
struct ubx_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 ubx_set_standby(struct gnss_serial *gserial)
{
struct ubx_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 ubx_set_power(struct gnss_serial *gserial,
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gnss: ubx: Simplify the return expression in the ubx.c
2021-02-24 9:29 [PATCH] gnss: ubx: Simplify the return expression in the ubx.c dingsenjie
@ 2021-02-24 9:38 ` Johan Hovold
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2021-02-24 9:38 UTC (permalink / raw)
To: dingsenjie; +Cc: linux-kernel, dingsenjie
On Wed, Feb 24, 2021 at 05:29:47PM +0800, dingsenjie@163.com wrote:
> From: dingsenjie <dingsenjie@yulong.com>
>
> Simplify the return expression.
This was done on purpose (keep error paths separate from success) so no
need to "simplify".
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-24 9:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24 9:29 [PATCH] gnss: ubx: Simplify the return expression in the ubx.c dingsenjie
2021-02-24 9:38 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®