[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210517150006.8436-1-tangbin@cmss.chinamobile.com>
Date: Mon, 17 May 2021 23:00:06 +0800
From: Tang Bin <tangbin@...s.chinamobile.com>
To: lars@...afoo.de, Michael.Hennerich@...log.com, jic23@...nel.org,
knaack.h@....de, pmeerw@...erw.net, gregkh@...uxfoundation.org
Cc: linux-iio@...r.kernel.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org,
Tang Bin <tangbin@...s.chinamobile.com>
Subject: [PATCH] staging: iio: cdc: ad7746: Fix unnecessary check and assignment in ad7746_probe()
In the function ad7746_probe(), the return value of
devm_iio_device_register() can be zero or ret, thus it is
unnecessary to repeated check here. And delete unused
initialized value of 'ret', because it will be assigned by
the function i2c_smbus_write_byte_data().
Signed-off-by: Tang Bin <tangbin@...s.chinamobile.com>
---
drivers/staging/iio/cdc/ad7746.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index dfd71e99e..d3b6e68df 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -680,7 +680,7 @@ static int ad7746_probe(struct i2c_client *client,
struct ad7746_chip_info *chip;
struct iio_dev *indio_dev;
unsigned char regval = 0;
- int ret = 0;
+ int ret;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
if (!indio_dev)
@@ -730,11 +730,7 @@ static int ad7746_probe(struct i2c_client *client,
if (ret < 0)
return ret;
- ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev);
- if (ret)
- return ret;
-
- return 0;
+ return devm_iio_device_register(indio_dev->dev.parent, indio_dev);
}
static const struct i2c_device_id ad7746_id[] = {
--
2.20.1.windows.1
Powered by blists - more mailing lists