[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240828094521.978220-1-yanzhen@vivo.com>
Date: Wed, 28 Aug 2024 17:45:21 +0800
From: Yan Zhen <yanzhen@...o.com>
To: rashanmu@...il.com,
mchehab@...nel.org
Cc: linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org,
opensource.kernel@...o.com,
Yan Zhen <yanzhen@...o.com>
Subject: [PATCH v1] i2c: max2175: Simplify with dev_err_probe()
Switch to use dev_err_probe() to simplify the error path and
unify a message template.
Using this helper is totally fine even if err is known to never
be -EPROBE_DEFER.
The benefit compared to a normal dev_err() is the standardized format
of the error code, it being emitted symbolically and the fact that
the error code is returned which allows more compact error paths.
Signed-off-by: Yan Zhen <yanzhen@...o.com>
---
drivers/media/i2c/max2175.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c
index bf02ca23a284..700a70a6cee3 100644
--- a/drivers/media/i2c/max2175.c
+++ b/drivers/media/i2c/max2175.c
@@ -1299,9 +1299,8 @@ static int max2175_probe(struct i2c_client *client)
ret = max2175_refout_load_to_bits(client, refout_load,
&refout_bits);
if (ret) {
- dev_err(&client->dev, "invalid refout_load %u\n",
- refout_load);
- return -EINVAL;
+ return dev_err_probe(&client->dev, -EINVAL,
+ "invalid refout_load %u\n", refout_load);
}
}
--
2.34.1
Powered by blists - more mailing lists