Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp204609pxa; Fri, 14 Aug 2020 01:31:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbPGDWR/9rzaImr5UMvHmxXCUhzapFxKu0Cpjda7nWKWjafcLLNh5gZ3SYzV0yHW16YTqG X-Received: by 2002:a17:906:2506:: with SMTP id i6mr1347834ejb.72.1597393907401; Fri, 14 Aug 2020 01:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597393907; cv=none; d=google.com; s=arc-20160816; b=V2ApWiLKvw1bJoaUU8765m4qFqUfhRrPe0xrVXSYdb+ziQrMJAQfpQXd1c4dCbUAiz ZIYV4jjkXEKdvqsB/CtAH4YnXtVPEcIyRPlFigJWhwMM9RJT2/ni8PTruSDWvPuQChcE HYWfURq5YruVV7hdz+STRywChVdN4Xx7MXpqzpnp/2tEeDNwHLBP04oOyfWvCnFvT5Lo HKxmS33a8+/kmxkOhdNw3uB66J9KS4S5Pb2ulCB/1M/rcSK1WmY4i8MaS5DErA0rHBrr lPDDFSFpShTLqYCuo/HuZA0brlUujwg+gnanjqgIBoB0m2WIQDwO9yYFFzJqmj0JYFIy Wyhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=1LXahQGgVNlrSIBryNDzGcM3Q6hv4kryHJEAT/HF8rw=; b=iPnv1gmf+E6fCSQ6qk5jlVBeWevUlB/JEZWLszmqsF6y9TxjYS8iwA8Fe2oPoEDQFR kd8oMnqvLUvzawYuymINmzUJA88Fp+vDpbW79GK9X6y7+I5mRN8dg1CEuDOJA1OUCIpd gWGDqefV5Bk6H5YNUdYBVKvWWtwHRKxbEnl6OJCLhCk19tk0+53JHgwnlThPIbz2crKP AlBOD4bYHNp9vPbeIVD9QRvUubgL+QHhfKeomxjH2S1lz4PAqtI/RU6vZv+EcYdHBgJ0 PuQI868GLJ0u0jcDa2W4+JB1YS7ijwy7m2rGz4C9+jGInV9Jz3fEX4M0A+htMZrVOCEU 9tEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nv2si5014973ejb.154.2020.08.14.01.31.23; Fri, 14 Aug 2020 01:31:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726856AbgHNIab (ORCPT + 99 others); Fri, 14 Aug 2020 04:30:31 -0400 Received: from mail-m17613.qiye.163.com ([59.111.176.13]:32390 "EHLO mail-m17613.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbgHNIab (ORCPT ); Fri, 14 Aug 2020 04:30:31 -0400 Received: from ubuntu.localdomain (unknown [157.0.31.125]) by mail-m17613.qiye.163.com (Hmail) with ESMTPA id C2A404826D4; Fri, 14 Aug 2020 16:30:27 +0800 (CST) From: Bernard Zhao To: David Airlie , Daniel Vetter , Bernard Zhao , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com Subject: [PATCH] drm/via: reduce no need mutex_lock area Date: Fri, 14 Aug 2020 01:30:19 -0700 Message-Id: <20200814083021.8962-1-bernard@vivo.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZT0JNTh1KTRhLSkNLVkpOQkxIQkhDSUxCT0JVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS0hKTFVKS0tZBg++ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Mhw6Sjo5KT8dCjosSQEOEx4t DjIKCxNVSlVKTkJMSEJIQ0lDTklMVTMWGhIXVRkeCRUaCR87DRINFFUYFBZFWVdZEgtZQVlKTkxV S1VISlVKSU5ZV1kIAVlBSkNPSjcG X-HM-Tid: 0a73ec17783893bakuwsc2a404826d4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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