Re: [PATCH -next] gnss: simplify the return expression of gnss_uevent

From: miaoqinglang
Date: Thu Oct 08 2020 - 21:10:28 EST




在 2020/10/8 22:42, Johan Hovold 写道:
On Mon, Sep 21, 2020 at 09:10:28PM +0800, Qinglang Miao wrote:
Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@xxxxxxxxxx>

The current code was written with an explicit error path on purpose, and
there's no need to change it.

Same applies to your other gnss ubx patch.

Glad for knowing that and it sounds resonable to me.

Thanks.
---
drivers/gnss/core.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c
index e6f94501c..e6b9ac9da 100644
--- a/drivers/gnss/core.c
+++ b/drivers/gnss/core.c
@@ -368,13 +368,8 @@ ATTRIBUTE_GROUPS(gnss);
static int gnss_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct gnss_device *gdev = to_gnss_device(dev);
- int ret;
- ret = add_uevent_var(env, "GNSS_TYPE=%s", gnss_type_name(gdev));
- if (ret)
- return ret;
-
- return 0;
+ return add_uevent_var(env, "GNSS_TYPE=%s", gnss_type_name(gdev));
}
static int __init gnss_module_init(void)

Johan
.