Skip to content

Commit

Permalink
hwmon: (ad7414) Return proper error code for ad7414_probe()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Guenter Roeck committed Nov 11, 2010
1 parent f7334b4 commit f0030d8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/hwmon/ad7414.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ static int ad7414_probe(struct i2c_client *client,
{
struct ad7414_data *data;
int conf;
int err = 0;
int err;

if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_READ_WORD_DATA))
I2C_FUNC_SMBUS_READ_WORD_DATA)) {
err = -EOPNOTSUPP;
goto exit;
}

data = kzalloc(sizeof(struct ad7414_data), GFP_KERNEL);
if (!data) {
Expand Down

0 comments on commit f0030d8

Please sign in to comment.