Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (ad7414) Return proper error code for ad7414_probe()

Return proper error if i2c_check_functionality reports
the adapter does not support the capability we need.

Also remove unneeded initialization for err variable.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sean MacLennan <smaclennan@pikatech.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>

authored by

Axel Lin and committed by
Guenter Roeck
f0030d87 f7334b4c

+4 -2
+4 -2
drivers/hwmon/ad7414.c
··· 178 178 { 179 179 struct ad7414_data *data; 180 180 int conf; 181 - int err = 0; 181 + int err; 182 182 183 183 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA | 184 - I2C_FUNC_SMBUS_READ_WORD_DATA)) 184 + I2C_FUNC_SMBUS_READ_WORD_DATA)) { 185 + err = -EOPNOTSUPP; 185 186 goto exit; 187 + } 186 188 187 189 data = kzalloc(sizeof(struct ad7414_data), GFP_KERNEL); 188 190 if (!data) {