Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753137AbdFOPKj (ORCPT ); Thu, 15 Jun 2017 11:10:39 -0400 Received: from mga07.intel.com ([134.134.136.100]:27694 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753098AbdFOPKi (ORCPT ); Thu, 15 Jun 2017 11:10:38 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,343,1493708400"; d="scan'208";a="868307213" From: Jani Nikula To: Dawid Kurek Cc: Daniel Vetter , Sean Paul , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm: Reduce scope of 'state' variable In-Reply-To: <20170615142430.GA13398@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20170615104142.GA29276@gmail.com> <871sqlzewc.fsf@intel.com> <20170615142430.GA13398@gmail.com> Date: Thu, 15 Jun 2017 18:10:34 +0300 Message-ID: <87vanxxp5h.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 682 Lines: 20 On Thu, 15 Jun 2017, Dawid Kurek wrote: > On 15/06/17, Jani Nikula wrote: >> Separate declaration and initialization would lead to a cleaner patch >> and result. > > I saw combining declaration and initialization is quite common, i.e. in > drm_atomic file. Personally, I also prefer those in one statement. But yes, it > looks cleaner here, in two lines. I'd say the rule of thumb is that combined declaration and initialization is fine if the initialization is trivial, in particular can never fail. If you need to check the return value, like in this case, I'd prefer separate initialization. BR, Jani. -- Jani Nikula, Intel Open Source Technology Center