[PATCH v2 3/4] iio: backend: make use of dev_err_cast_probe()

From: Nuno Sa via B4 Relay
Date: Tue Apr 23 2024 - 11:21:58 EST


From: Nuno Sa <nuno.sa@xxxxxxxxxx>

Using dev_err_cast_probe() to simplify the code.

Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx>
---
drivers/iio/industrialio-backend.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
index f08ed6d70ae5..2cc6459246ce 100644
--- a/drivers/iio/industrialio-backend.c
+++ b/drivers/iio/industrialio-backend.c
@@ -475,11 +475,9 @@ struct iio_backend *devm_iio_backend_get(struct device *dev, const char *name)
}

fwnode = fwnode_find_reference(dev_fwnode(dev), "io-backends", index);
- if (IS_ERR(fwnode)) {
- dev_err_probe(dev, PTR_ERR(fwnode),
- "Cannot get Firmware reference\n");
- return ERR_CAST(fwnode);
- }
+ if (IS_ERR(fwnode))
+ return dev_err_cast_probe(dev, fwnode,
+ "Cannot get Firmware reference\n");

guard(mutex)(&iio_back_lock);
list_for_each_entry(back, &iio_back_list, entry) {

--
2.44.0