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

mfd: max8997: Convert to i2c_new_dummy_device

Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an
ERRPTR which we use in error handling.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Wolfram Sang and committed by
Lee Jones
4e32bff6 ddbf6ffe

+9 -9
+9 -9
drivers/mfd/max8997.c
··· 185 185 186 186 mutex_init(&max8997->iolock); 187 187 188 - max8997->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC); 189 - if (!max8997->rtc) { 188 + max8997->rtc = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_RTC); 189 + if (IS_ERR(max8997->rtc)) { 190 190 dev_err(max8997->dev, "Failed to allocate I2C device for RTC\n"); 191 - return -ENODEV; 191 + return PTR_ERR(max8997->rtc); 192 192 } 193 193 i2c_set_clientdata(max8997->rtc, max8997); 194 194 195 - max8997->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); 196 - if (!max8997->haptic) { 195 + max8997->haptic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_HAPTIC); 196 + if (IS_ERR(max8997->haptic)) { 197 197 dev_err(max8997->dev, "Failed to allocate I2C device for Haptic\n"); 198 - ret = -ENODEV; 198 + ret = PTR_ERR(max8997->haptic); 199 199 goto err_i2c_haptic; 200 200 } 201 201 i2c_set_clientdata(max8997->haptic, max8997); 202 202 203 - max8997->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC); 204 - if (!max8997->muic) { 203 + max8997->muic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_MUIC); 204 + if (IS_ERR(max8997->muic)) { 205 205 dev_err(max8997->dev, "Failed to allocate I2C device for MUIC\n"); 206 - ret = -ENODEV; 206 + ret = PTR_ERR(max8997->muic); 207 207 goto err_i2c_muic; 208 208 } 209 209 i2c_set_clientdata(max8997->muic, max8997);