| .. | .. |
|---|
| 47 | 47 | struct mcp4725_data *data = iio_priv(i2c_get_clientdata( |
|---|
| 48 | 48 | to_i2c_client(dev))); |
|---|
| 49 | 49 | u8 outbuf[2]; |
|---|
| 50 | + int ret; |
|---|
| 50 | 51 | |
|---|
| 51 | 52 | outbuf[0] = (data->powerdown_mode + 1) << 4; |
|---|
| 52 | 53 | outbuf[1] = 0; |
|---|
| 53 | 54 | data->powerdown = true; |
|---|
| 54 | 55 | |
|---|
| 55 | | - return i2c_master_send(data->client, outbuf, 2); |
|---|
| 56 | + ret = i2c_master_send(data->client, outbuf, 2); |
|---|
| 57 | + if (ret < 0) |
|---|
| 58 | + return ret; |
|---|
| 59 | + else if (ret != 2) |
|---|
| 60 | + return -EIO; |
|---|
| 61 | + return 0; |
|---|
| 56 | 62 | } |
|---|
| 57 | 63 | |
|---|
| 58 | 64 | static int __maybe_unused mcp4725_resume(struct device *dev) |
|---|
| .. | .. |
|---|
| 60 | 66 | struct mcp4725_data *data = iio_priv(i2c_get_clientdata( |
|---|
| 61 | 67 | to_i2c_client(dev))); |
|---|
| 62 | 68 | u8 outbuf[2]; |
|---|
| 69 | + int ret; |
|---|
| 63 | 70 | |
|---|
| 64 | 71 | /* restore previous DAC value */ |
|---|
| 65 | 72 | outbuf[0] = (data->dac_value >> 8) & 0xf; |
|---|
| 66 | 73 | outbuf[1] = data->dac_value & 0xff; |
|---|
| 67 | 74 | data->powerdown = false; |
|---|
| 68 | 75 | |
|---|
| 69 | | - return i2c_master_send(data->client, outbuf, 2); |
|---|
| 76 | + ret = i2c_master_send(data->client, outbuf, 2); |
|---|
| 77 | + if (ret < 0) |
|---|
| 78 | + return ret; |
|---|
| 79 | + else if (ret != 2) |
|---|
| 80 | + return -EIO; |
|---|
| 81 | + return 0; |
|---|
| 70 | 82 | } |
|---|
| 71 | 83 | static SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend, mcp4725_resume); |
|---|
| 72 | 84 | |
|---|