mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	drm: Make drm_fb_unregister/remove accept NULL fb
These functions are used by drivers to release fbdev emulation buffers. We need to make them resilient to NULL pointers to make the fbdev compile/runtime knobs not cause Oopses on module unload. Cc: Archit Taneja <architt@codeaurora.org> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
		
							parent
							
								
									b7bdf0a87a
								
							
						
					
					
						commit
						a39a357c6c
					
				
					 1 changed files with 12 additions and 2 deletions
				
			
		| 
						 | 
					@ -538,7 +538,12 @@ EXPORT_SYMBOL(drm_framebuffer_reference);
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void drm_framebuffer_unregister_private(struct drm_framebuffer *fb)
 | 
					void drm_framebuffer_unregister_private(struct drm_framebuffer *fb)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct drm_device *dev = fb->dev;
 | 
						struct drm_device *dev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!fb)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dev = fb->dev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mutex_lock(&dev->mode_config.fb_lock);
 | 
						mutex_lock(&dev->mode_config.fb_lock);
 | 
				
			||||||
	/* Mark fb as reaped and drop idr ref. */
 | 
						/* Mark fb as reaped and drop idr ref. */
 | 
				
			||||||
| 
						 | 
					@ -589,12 +594,17 @@ EXPORT_SYMBOL(drm_framebuffer_cleanup);
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void drm_framebuffer_remove(struct drm_framebuffer *fb)
 | 
					void drm_framebuffer_remove(struct drm_framebuffer *fb)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct drm_device *dev = fb->dev;
 | 
						struct drm_device *dev;
 | 
				
			||||||
	struct drm_crtc *crtc;
 | 
						struct drm_crtc *crtc;
 | 
				
			||||||
	struct drm_plane *plane;
 | 
						struct drm_plane *plane;
 | 
				
			||||||
	struct drm_mode_set set;
 | 
						struct drm_mode_set set;
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!fb)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dev = fb->dev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WARN_ON(!list_empty(&fb->filp_head));
 | 
						WARN_ON(!list_empty(&fb->filp_head));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue