diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/platform/chrome/cros_ec_lightbar.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c index 144e09df9b84..fc30a991b738 100644 --- a/drivers/platform/chrome/cros_ec_lightbar.c +++ b/drivers/platform/chrome/cros_ec_lightbar.c | |||
| @@ -352,10 +352,6 @@ static ssize_t sequence_store(struct device *dev, struct device_attribute *attr, | |||
| 352 | struct cros_ec_dev *ec = container_of(dev, | 352 | struct cros_ec_dev *ec = container_of(dev, |
| 353 | struct cros_ec_dev, class_dev); | 353 | struct cros_ec_dev, class_dev); |
| 354 | 354 | ||
| 355 | msg = alloc_lightbar_cmd_msg(ec); | ||
| 356 | if (!msg) | ||
| 357 | return -ENOMEM; | ||
| 358 | |||
| 359 | for (len = 0; len < count; len++) | 355 | for (len = 0; len < count; len++) |
| 360 | if (!isalnum(buf[len])) | 356 | if (!isalnum(buf[len])) |
| 361 | break; | 357 | break; |
| @@ -370,21 +366,30 @@ static ssize_t sequence_store(struct device *dev, struct device_attribute *attr, | |||
| 370 | return ret; | 366 | return ret; |
| 371 | } | 367 | } |
| 372 | 368 | ||
| 369 | msg = alloc_lightbar_cmd_msg(ec); | ||
| 370 | if (!msg) | ||
| 371 | return -ENOMEM; | ||
| 372 | |||
| 373 | param = (struct ec_params_lightbar *)msg->data; | 373 | param = (struct ec_params_lightbar *)msg->data; |
| 374 | param->cmd = LIGHTBAR_CMD_SEQ; | 374 | param->cmd = LIGHTBAR_CMD_SEQ; |
| 375 | param->seq.num = num; | 375 | param->seq.num = num; |
| 376 | ret = lb_throttle(); | 376 | ret = lb_throttle(); |
| 377 | if (ret) | 377 | if (ret) |
| 378 | return ret; | 378 | goto exit; |
| 379 | 379 | ||
| 380 | ret = cros_ec_cmd_xfer(ec->ec_dev, msg); | 380 | ret = cros_ec_cmd_xfer(ec->ec_dev, msg); |
| 381 | if (ret < 0) | 381 | if (ret < 0) |
| 382 | return ret; | 382 | goto exit; |
| 383 | 383 | ||
| 384 | if (msg->result != EC_RES_SUCCESS) | 384 | if (msg->result != EC_RES_SUCCESS) { |
| 385 | return -EINVAL; | 385 | ret = -EINVAL; |
| 386 | goto exit; | ||
| 387 | } | ||
| 386 | 388 | ||
| 387 | return count; | 389 | ret = count; |
| 390 | exit: | ||
| 391 | kfree(msg); | ||
| 392 | return ret; | ||
| 388 | } | 393 | } |
| 389 | 394 | ||
| 390 | /* Module initialization */ | 395 | /* Module initialization */ |
