diff options
| -rw-r--r-- | drivers/mfd/twl-core.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 557f9ee5ec18..89ab4d970643 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
| @@ -316,12 +316,12 @@ int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) | |||
| 316 | int sid; | 316 | int sid; |
| 317 | struct twl_client *twl; | 317 | struct twl_client *twl; |
| 318 | 318 | ||
| 319 | if (unlikely(mod_no >= twl_get_last_module())) { | 319 | if (unlikely(!twl_priv || !twl_priv->ready)) { |
| 320 | pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); | 320 | pr_err("%s: not initialized\n", DRIVER_NAME); |
| 321 | return -EPERM; | 321 | return -EPERM; |
| 322 | } | 322 | } |
| 323 | if (unlikely(!twl_priv->ready)) { | 323 | if (unlikely(mod_no >= twl_get_last_module())) { |
| 324 | pr_err("%s: not initialized\n", DRIVER_NAME); | 324 | pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); |
| 325 | return -EPERM; | 325 | return -EPERM; |
| 326 | } | 326 | } |
| 327 | 327 | ||
| @@ -355,12 +355,12 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) | |||
| 355 | int sid; | 355 | int sid; |
| 356 | struct twl_client *twl; | 356 | struct twl_client *twl; |
| 357 | 357 | ||
| 358 | if (unlikely(mod_no >= twl_get_last_module())) { | 358 | if (unlikely(!twl_priv || !twl_priv->ready)) { |
| 359 | pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); | 359 | pr_err("%s: not initialized\n", DRIVER_NAME); |
| 360 | return -EPERM; | 360 | return -EPERM; |
| 361 | } | 361 | } |
| 362 | if (unlikely(!twl_priv->ready)) { | 362 | if (unlikely(mod_no >= twl_get_last_module())) { |
| 363 | pr_err("%s: not initialized\n", DRIVER_NAME); | 363 | pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); |
| 364 | return -EPERM; | 364 | return -EPERM; |
| 365 | } | 365 | } |
| 366 | 366 | ||
