backlight: msi-laptop, msi-wmi: fix incomplete registration failure handling
Properly return backlight registration error to parent. Mark struct backlight_ops as const. Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org> Reviewed-by: Anisse Astier <anisse@astier.eu> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
		
					parent
					
						
							
								fa11de0a33
							
						
					
				
			
			
				commit
				
					
						28d85873cd
					
				
			
		
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -138,7 +138,7 @@ static int bl_set_status(struct backlight_device *bd)
 | 
				
			||||||
	return msi_wmi_set_block(0, backlight_map[bright]);
 | 
						return msi_wmi_set_block(0, backlight_map[bright]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct backlight_ops msi_backlight_ops = {
 | 
					static const struct backlight_ops msi_backlight_ops = {
 | 
				
			||||||
	.get_brightness	= bl_get,
 | 
						.get_brightness	= bl_get,
 | 
				
			||||||
	.update_status	= bl_set_status,
 | 
						.update_status	= bl_set_status,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -255,8 +255,10 @@ static int __init msi_wmi_init(void)
 | 
				
			||||||
		backlight = backlight_device_register(DRV_NAME, NULL, NULL,
 | 
							backlight = backlight_device_register(DRV_NAME, NULL, NULL,
 | 
				
			||||||
						      &msi_backlight_ops,
 | 
											      &msi_backlight_ops,
 | 
				
			||||||
						      &props);
 | 
											      &props);
 | 
				
			||||||
		if (IS_ERR(backlight))
 | 
							if (IS_ERR(backlight)) {
 | 
				
			||||||
 | 
								err = PTR_ERR(backlight);
 | 
				
			||||||
			goto err_free_input;
 | 
								goto err_free_input;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		err = bl_get(NULL);
 | 
							err = bl_get(NULL);
 | 
				
			||||||
		if (err < 0)
 | 
							if (err < 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue