Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751812AbdFORqE (ORCPT ); Thu, 15 Jun 2017 13:46:04 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:35851 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750793AbdFORqD (ORCPT ); Thu, 15 Jun 2017 13:46:03 -0400 Date: Thu, 15 Jun 2017 19:45:56 +0200 From: Dawid Kurek To: Daniel Vetter , Jani Nikula , Sean Paul , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] drm: Reduce scope of 'state' variable Message-ID: <20170615174556.GA8872@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) X-Antivirus: Avast (VPS 170615-0, 15/06/2017), Outbound message X-Antivirus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 988 Lines: 36 Smaller scope reduces visibility of variable and makes usage of uninitialized variable less possible. Changes in v2: - separate declaration and initialization Changes in v3: - add missing signed-off-by tag Signed-off-by: Dawid Kurek --- drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index f32506a..5e0d1e1 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -108,9 +108,10 @@ struct drm_atomic_state * drm_atomic_state_alloc(struct drm_device *dev) { struct drm_mode_config *config = &dev->mode_config; - struct drm_atomic_state *state; if (!config->funcs->atomic_state_alloc) { + struct drm_atomic_state *state; + state = kzalloc(sizeof(*state), GFP_KERNEL); if (!state) return NULL; -- 2.10.0 --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus