Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752099AbdFOQ5B (ORCPT ); Thu, 15 Jun 2017 12:57:01 -0400 Received: from mail-lf0-f52.google.com ([209.85.215.52]:34496 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbdFOQ5A (ORCPT ); Thu, 15 Jun 2017 12:57:00 -0400 Date: Thu, 15 Jun 2017 18:56:51 +0200 From: Dawid Kurek To: Jani Nikula 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 Message-ID: <20170615165651.GA695@gmail.com> References: <20170615104142.GA29276@gmail.com> <871sqlzewc.fsf@intel.com> <20170615142430.GA13398@gmail.com> <87vanxxp5h.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87vanxxp5h.fsf@intel.com> 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: 941 Lines: 24 On 15/06/17, Jani Nikula wrote: > 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. > Yeah, makes sense. If you need to check then it exceeds simple initialization, and then it is not declare&initialize. Yes, now I see it. Thanks a lot, Dawid --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus