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

Configure Feed

Select the types of activity you want to include in your feed.

Input: msg2638 - use guard notation when acquiring mutex

Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+9 -10
+9 -10
drivers/input/touchscreen/msg2638.c
··· 446 446 struct i2c_client *client = to_i2c_client(dev); 447 447 struct msg2638_ts_data *msg2638 = i2c_get_clientdata(client); 448 448 449 - mutex_lock(&msg2638->input_dev->mutex); 449 + guard(mutex)(&msg2638->input_dev->mutex); 450 450 451 451 if (input_device_enabled(msg2638->input_dev)) 452 452 msg2638_stop(msg2638); 453 - 454 - mutex_unlock(&msg2638->input_dev->mutex); 455 453 456 454 return 0; 457 455 } ··· 458 460 { 459 461 struct i2c_client *client = to_i2c_client(dev); 460 462 struct msg2638_ts_data *msg2638 = i2c_get_clientdata(client); 461 - int ret = 0; 463 + int error; 462 464 463 - mutex_lock(&msg2638->input_dev->mutex); 465 + guard(mutex)(&msg2638->input_dev->mutex); 464 466 465 - if (input_device_enabled(msg2638->input_dev)) 466 - ret = msg2638_start(msg2638); 467 + if (input_device_enabled(msg2638->input_dev)) { 468 + error = msg2638_start(msg2638); 469 + if (error) 470 + return error; 471 + } 467 472 468 - mutex_unlock(&msg2638->input_dev->mutex); 469 - 470 - return ret; 473 + return 0; 471 474 } 472 475 473 476 static DEFINE_SIMPLE_DEV_PM_OPS(msg2638_pm_ops, msg2638_suspend, msg2638_resume);