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: imagis - use guard notation when acquiring mutex

Guard notation simplifies code.

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

+16 -14
+16 -14
drivers/input/touchscreen/imagis.c
··· 366 366 { 367 367 struct i2c_client *client = to_i2c_client(dev); 368 368 struct imagis_ts *ts = i2c_get_clientdata(client); 369 - int retval = 0; 369 + int error; 370 370 371 - mutex_lock(&ts->input_dev->mutex); 371 + guard(mutex)(&ts->input_dev->mutex); 372 372 373 - if (input_device_enabled(ts->input_dev)) 374 - retval = imagis_stop(ts); 373 + if (input_device_enabled(ts->input_dev)) { 374 + error = imagis_stop(ts); 375 + if (error) 376 + return error; 377 + } 375 378 376 - mutex_unlock(&ts->input_dev->mutex); 377 - 378 - return retval; 379 + return 0; 379 380 } 380 381 381 382 static int imagis_resume(struct device *dev) 382 383 { 383 384 struct i2c_client *client = to_i2c_client(dev); 384 385 struct imagis_ts *ts = i2c_get_clientdata(client); 385 - int retval = 0; 386 + int error; 386 387 387 - mutex_lock(&ts->input_dev->mutex); 388 + guard(mutex)(&ts->input_dev->mutex); 388 389 389 - if (input_device_enabled(ts->input_dev)) 390 - retval = imagis_start(ts); 390 + if (input_device_enabled(ts->input_dev)) { 391 + error = imagis_start(ts); 392 + if (error) 393 + return error; 394 + } 391 395 392 - mutex_unlock(&ts->input_dev->mutex); 393 - 394 - return retval; 396 + return 0; 395 397 } 396 398 397 399 static DEFINE_SIMPLE_DEV_PM_OPS(imagis_pm_ops, imagis_suspend, imagis_resume);