mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-11-01 09:13:37 +00:00 
			
		
		
		
	bus_remove_device: be more careful about incomplete initialization
Prevent bus_remove_device() from crashing if dev->knode_bus has not been initialized before it's called. This can happen if the device_add() ended up breaking out early due to an error, for example. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									08119e8966
								
							
						
					
					
						commit
						29591b92e1
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -530,6 +530,7 @@ void bus_remove_device(struct device *dev)
 | 
			
		|||
		sysfs_remove_link(&dev->bus->p->devices_kset->kobj,
 | 
			
		||||
				  dev->bus_id);
 | 
			
		||||
		device_remove_attrs(dev->bus, dev);
 | 
			
		||||
		if (klist_node_attached(&dev->knode_bus))
 | 
			
		||||
			klist_del(&dev->knode_bus);
 | 
			
		||||
 | 
			
		||||
		pr_debug("bus: '%s': remove device %s\n",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue