Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3109287imb; Tue, 5 Mar 2019 00:50:18 -0800 (PST) X-Google-Smtp-Source: APXvYqyIFA1M5Vony+GJ1yShqEOVjfs1ic3xxUlsJWmXvSVMOlfjQREPwSn9jaS+1cee/0xFCX1E X-Received: by 2002:a17:902:650b:: with SMTP id b11mr34057plk.293.1551775818724; Tue, 05 Mar 2019 00:50:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551775818; cv=none; d=google.com; s=arc-20160816; b=gkBkq4SF6RGJpKDpWNtsV0ZDfFe/VBOlKEQeYF7Idc5GDOUW6xltT1zUyrTFjkP1dX d8CMtQrzyyR2EHpkQLUOx4I+Ex8lXQ3bkafZj/8uzGi04nGGfCD6y1XfzBYfLprwQTxG Ms6OJ6UIIkgj/hk31tCQlm7QWKjHumRn2I4Gld6ePZsAL0DhpUyHzvwrP+urMsXol4bD KY81oLCosnDX+17Zmp05vTaMaN4kdROtGm5IEvTOieji3Giqoaeb6D0u+/AJ7MnyG2QU WWt+IE/6rh4HgGG3r4/H0kPbj1xSyLIxojjUajnE7TxQtZG7w7y7Z9aH/+O1uRhcfygg FUsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=5odl1/TECdS+sYnvaM4tL1/kC1WakoJaHJmpcUwla2I=; b=JVD+41V7lzqtkrMY5cqdQ1/vzeBhOjZ0RWEuDpfrrly6L2gRD28vvXCUnzBZ7PEfRN dSJwiPSp4wrF0WX8WijWz7wdoo/NjeBISvH04BqQNzf8TdGs+sWZBN/Jxv8RanGJ/+Ck mt5a6NXnmNK8jFxBXCuyF7EOQadnut/V3/sKSQvjSmCil/N41znZPM6g4YT1cpACs3cz RRIxWJ7OBjPfUXb4XTwx29ADbSQzhyAUKcm2scHZhY5aJUioky9h2qbtz4WzRH45QDcB QFm01n3qHmxdmnZksaHGizPPUQ70m1OqFkOJg13H54TDvsayBqOSq1yPgE8befqu/TlE +VSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e17si7154987pgo.44.2019.03.05.00.50.02; Tue, 05 Mar 2019 00:50:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727427AbfCEIr1 (ORCPT + 99 others); Tue, 5 Mar 2019 03:47:27 -0500 Received: from mga18.intel.com ([134.134.136.126]:48616 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725818AbfCEIr0 (ORCPT ); Tue, 5 Mar 2019 03:47:26 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2019 00:47:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,443,1544515200"; d="scan'208";a="138148851" Received: from schmiger-mobl3.ger.corp.intel.com (HELO kekkonen.fi.intel.com) ([10.249.45.12]) by FMSMGA003.fm.intel.com with ESMTP; 05 Mar 2019 00:47:23 -0800 Received: by kekkonen.fi.intel.com (Postfix, from userid 1000) id CCAFD21E9B; Tue, 5 Mar 2019 10:47:20 +0200 (EET) Date: Tue, 5 Mar 2019 10:47:20 +0200 From: Sakari Ailus To: Arnd Bergmann Cc: "Cao, Bingbu" , Mauro Carvalho Chehab , Greg Kroah-Hartman , "Zhi, Yong" , "linux-media@vger.kernel.org" , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] media: staging/intel-ipu3: reduce kernel stack usage Message-ID: <20190305084720.jlgwd5ifouq3vvra@kekkonen.localdomain> References: <20190304202758.1802417-1-arnd@arndb.de> <20190305075317.4t32uyyhzftuoebp@kekkonen.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 05, 2019 at 09:40:24AM +0100, Arnd Bergmann wrote: > On Tue, Mar 5, 2019 at 8:53 AM Sakari Ailus > wrote: > > On Tue, Mar 05, 2019 at 12:25:18AM +0000, Cao, Bingbu wrote: > > > > > struct v4l2_pix_format_mplane *const in = > > > > &q[IPU3_CSS_QUEUE_IN].fmt.mpix; > > > > struct v4l2_pix_format_mplane *const out = @@ -1753,6 +1754,11 @@ > > > > int imgu_css_fmt_try(struct imgu_css *css, > > > > &q[IPU3_CSS_QUEUE_VF].fmt.mpix; > > > > int i, s, ret; > > > > > > > > + if (!q) { > > > > + ret = -ENOMEM; > > > > + goto out; > > > > + } > > > [Cao, Bingbu] > > > The goto here is wrong, you can just report an error, and I prefer it is next to the alloc. > > > > I agree, the goto is just not needed. > > Should I remove all the gotos then and do an explicit kfree() in each > error path? > > I'd prefer not to mix the two styles, as that can lead to subtle mistakes > when the code is refactored again. In this case there's no need for kfree as q is NULL. Goto is often useful if you need to do things to undo stuff that was done earlier in the function but it's not the case here. I prefer keeping the rest gotos. -- Sakari Ailus sakari.ailus@linux.intel.com