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: imx6ul_tsc - 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/imx6ul_tsc.c
··· 551 551 struct imx6ul_tsc *tsc = platform_get_drvdata(pdev); 552 552 struct input_dev *input_dev = tsc->input; 553 553 554 - mutex_lock(&input_dev->mutex); 554 + guard(mutex)(&input_dev->mutex); 555 555 556 556 if (input_device_enabled(input_dev)) 557 557 imx6ul_tsc_stop(tsc); 558 - 559 - mutex_unlock(&input_dev->mutex); 560 558 561 559 return 0; 562 560 } ··· 564 566 struct platform_device *pdev = to_platform_device(dev); 565 567 struct imx6ul_tsc *tsc = platform_get_drvdata(pdev); 566 568 struct input_dev *input_dev = tsc->input; 567 - int retval = 0; 569 + int error; 568 570 569 - mutex_lock(&input_dev->mutex); 571 + guard(mutex)(&input_dev->mutex); 570 572 571 - if (input_device_enabled(input_dev)) 572 - retval = imx6ul_tsc_start(tsc); 573 + if (input_device_enabled(input_dev)) { 574 + error = imx6ul_tsc_start(tsc); 575 + if (error) 576 + return error; 577 + } 573 578 574 - mutex_unlock(&input_dev->mutex); 575 - 576 - return retval; 579 + return 0; 577 580 } 578 581 579 582 static DEFINE_SIMPLE_DEV_PM_OPS(imx6ul_tsc_pm_ops,