linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/via: reduce no need mutex_lock area
@ 2020-08-14  8:30 Bernard Zhao
  2020-10-17  8:11 ` Sam Ravnborg
  0 siblings, 1 reply; 2+ messages in thread
From: Bernard Zhao @ 2020-08-14  8:30 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Bernard Zhao, dri-devel, linux-kernel
  Cc: opensource.kernel

In function via_mem_alloc`s error branch, DRM_ERROR is protected
in the mutex_lock(&dev->struct_mutex) area.
From the code, we see that DRM_ERROR is just an error log print
without any struct element, there is no need to protect this.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/gpu/drm/via/via_mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c
index 45cc9e900260..dae1bacd86c1 100644
--- a/drivers/gpu/drm/via/via_mm.c
+++ b/drivers/gpu/drm/via/via_mm.c
@@ -129,9 +129,9 @@ int via_mem_alloc(struct drm_device *dev, void *data,
 	mutex_lock(&dev->struct_mutex);
 	if (0 == ((mem->type == VIA_MEM_VIDEO) ? dev_priv->vram_initialized :
 		      dev_priv->agp_initialized)) {
+		mutex_unlock(&dev->struct_mutex);
 		DRM_ERROR
 		    ("Attempt to allocate from uninitialized memory manager.\n");
-		mutex_unlock(&dev->struct_mutex);
 		return -EINVAL;
 	}
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/via: reduce no need mutex_lock area
  2020-08-14  8:30 [PATCH] drm/via: reduce no need mutex_lock area Bernard Zhao
@ 2020-10-17  8:11 ` Sam Ravnborg
  0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2020-10-17  8:11 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: David Airlie, Daniel Vetter, dri-devel, linux-kernel, opensource.kernel

Hi Bernard.

On Fri, Aug 14, 2020 at 01:30:19AM -0700, Bernard Zhao wrote:
> In function via_mem_alloc`s error branch, DRM_ERROR is protected
> in the mutex_lock(&dev->struct_mutex) area.
> >From the code, we see that DRM_ERROR is just an error log print
> without any struct element, there is no need to protect this.
> 
> Signed-off-by: Bernard Zhao <bernard@vivo.com>

Thanks, applied to drm-misc-next.

The patch will show up in -next in a few weeks.

	Sam

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-17  8:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-14  8:30 [PATCH] drm/via: reduce no need mutex_lock area Bernard Zhao
2020-10-17  8:11 ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).