@@ -548,27 +548,27 @@ acpi_video_device_EDID(struct acpi_video_device *device,
548
548
* 1. The system BIOS should NOT automatically control the brightness
549
549
* level of the LCD when the power changes from AC to DC.
550
550
* Return Value:
551
- * -1 wrong arg.
551
+ * -EINVAL wrong arg.
552
552
*/
553
553
554
554
static int
555
555
acpi_video_bus_DOS (struct acpi_video_bus * video , int bios_flag , int lcd_flag )
556
556
{
557
- u64 status = 0 ;
557
+ acpi_status status ;
558
558
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
559
559
struct acpi_object_list args = { 1 , & arg0 };
560
560
561
561
562
- if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1 ) {
563
- status = -1 ;
564
- goto Failed ;
565
- }
562
+ if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1 )
563
+ return - EINVAL ;
566
564
arg0 .integer .value = (lcd_flag << 2 ) | bios_flag ;
567
565
video -> dos_setting = arg0 .integer .value ;
568
- acpi_evaluate_object (video -> device -> handle , "_DOS" , & args , NULL );
566
+ status = acpi_evaluate_object (video -> device -> handle , "_DOS" ,
567
+ & args , NULL );
568
+ if (ACPI_FAILURE (status ))
569
+ return - EIO ;
569
570
570
- Failed :
571
- return status ;
571
+ return 0 ;
572
572
}
573
573
574
574
/*
@@ -1343,15 +1343,17 @@ static int
1343
1343
acpi_video_bus_get_devices (struct acpi_video_bus * video ,
1344
1344
struct acpi_device * device )
1345
1345
{
1346
- int status = 0 ;
1346
+ int status ;
1347
1347
struct acpi_device * dev ;
1348
1348
1349
- acpi_video_device_enumerate (video );
1349
+ status = acpi_video_device_enumerate (video );
1350
+ if (status )
1351
+ return status ;
1350
1352
1351
1353
list_for_each_entry (dev , & device -> children , node ) {
1352
1354
1353
1355
status = acpi_video_bus_get_one_device (dev , video );
1354
- if (ACPI_FAILURE ( status ) ) {
1356
+ if (status ) {
1355
1357
printk (KERN_WARNING PREFIX
1356
1358
"Can't attach device\n" );
1357
1359
continue ;
@@ -1653,8 +1655,12 @@ static int acpi_video_bus_add(struct acpi_device *device)
1653
1655
mutex_init (& video -> device_list_lock );
1654
1656
INIT_LIST_HEAD (& video -> video_device_list );
1655
1657
1656
- acpi_video_bus_get_devices (video , device );
1657
- acpi_video_bus_start_devices (video );
1658
+ error = acpi_video_bus_get_devices (video , device );
1659
+ if (error )
1660
+ goto err_free_video ;
1661
+ error = acpi_video_bus_start_devices (video );
1662
+ if (error )
1663
+ goto err_put_video ;
1658
1664
1659
1665
video -> input = input = input_allocate_device ();
1660
1666
if (!input ) {
@@ -1692,14 +1698,19 @@ static int acpi_video_bus_add(struct acpi_device *device)
1692
1698
1693
1699
video -> pm_nb .notifier_call = acpi_video_resume ;
1694
1700
video -> pm_nb .priority = 0 ;
1695
- register_pm_notifier (& video -> pm_nb );
1701
+ error = register_pm_notifier (& video -> pm_nb );
1702
+ if (error )
1703
+ goto err_unregister_input_dev ;
1696
1704
1697
1705
return 0 ;
1698
1706
1707
+ err_unregister_input_dev :
1708
+ input_unregister_device (input );
1699
1709
err_free_input_dev :
1700
1710
input_free_device (input );
1701
1711
err_stop_video :
1702
1712
acpi_video_bus_stop_devices (video );
1713
+ err_put_video :
1703
1714
acpi_video_bus_put_devices (video );
1704
1715
kfree (video -> attached_array );
1705
1716
err_free_video :
0 commit comments