mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-04 05:50:17 +00:00 
			
		
		
		
	dm: blk: Free the block device name when unbound
Mark the device name as allocated so that it will be freed correctly when the device is unbound. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
		
							parent
							
								
									a2040facd2
								
							
						
					
					
						commit
						d0773524e1
					
				@ -468,14 +468,22 @@ int blk_create_devicef(struct udevice *parent, const char *drv_name,
 | 
			
		||||
		       lbaint_t size, struct udevice **devp)
 | 
			
		||||
{
 | 
			
		||||
	char dev_name[30], *str;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	snprintf(dev_name, sizeof(dev_name), "%s.%s", parent->name, name);
 | 
			
		||||
	str = strdup(dev_name);
 | 
			
		||||
	if (!str)
 | 
			
		||||
		return -ENOMEM;
 | 
			
		||||
 | 
			
		||||
	return blk_create_device(parent, drv_name, str, if_type, devnum,
 | 
			
		||||
				 blksz, size, devp);
 | 
			
		||||
	ret = blk_create_device(parent, drv_name, str, if_type, devnum,
 | 
			
		||||
				blksz, size, devp);
 | 
			
		||||
	if (ret) {
 | 
			
		||||
		free(str);
 | 
			
		||||
		return ret;
 | 
			
		||||
	}
 | 
			
		||||
	device_set_name_alloced(*devp);
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int blk_unbind_all(int if_type)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user