mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-03 18:20:25 +02:00 
			
		
		
		
	drm/amdgpu: use WARN_ON_ONCE instead of BUG_ON in the SA
Crashing the system doesn't helps at all. Also properly return -EINVAL if size or alignment are outside valid ranges. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
		
							parent
							
								
									777dbd458c
								
							
						
					
					
						commit
						fe6b2ad91f
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -321,8 +321,11 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
 | 
				
			||||||
	int i, r;
 | 
						int i, r;
 | 
				
			||||||
	signed long t;
 | 
						signed long t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BUG_ON(align > sa_manager->align);
 | 
						if (WARN_ON_ONCE(align > sa_manager->align))
 | 
				
			||||||
	BUG_ON(size > sa_manager->size);
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (WARN_ON_ONCE(size > sa_manager->size))
 | 
				
			||||||
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*sa_bo = kmalloc(sizeof(struct amdgpu_sa_bo), GFP_KERNEL);
 | 
						*sa_bo = kmalloc(sizeof(struct amdgpu_sa_bo), GFP_KERNEL);
 | 
				
			||||||
	if ((*sa_bo) == NULL) {
 | 
						if ((*sa_bo) == NULL) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue