Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3143252imb; Tue, 5 Mar 2019 01:54:47 -0800 (PST) X-Google-Smtp-Source: APXvYqz+MrE1dFbgBqkFIIrQaYWmLnijuNv0TOfTErJ8b/DFFXYbqK9rR4ba3wd43xfNnOwwYXpP X-Received: by 2002:a17:902:b416:: with SMTP id x22mr300340plr.285.1551779687321; Tue, 05 Mar 2019 01:54:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551779687; cv=none; d=google.com; s=arc-20160816; b=oE+sA4DoRldX8PuEsLJHHTJFBpu/w4Bz6NyGIWL9bovsLxwkUXW3wEuLRxHqPMKn59 o+/7Dw8alJKw61b/+b/5nQ7VAVUriQIjiBH6fxFNDbOye71XC+bUg+2hjmT8VuFx9kh8 yLB7KqKoB2b5xfx4S9rgdydpYaWihGgH5IN3RT0Hdg9jhfl8AjhzqtYkcFDYrG714n1o 8f2rANvF2FkBcyNE9JiF4WLFJ/usr8IlOKMuYXo9fzBCa4TATWTx0QwgCWKBwRGBfXxY tm8ZmzIAkJ5pAb5YnPuQOA8+aPjojPmzkv+gxAJxLNMzXKwjSjA1kLiyf2an2NgPcA5K TVjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=jexVvyA3iEsprtYPEf6Tq7zXfxjDn59k/qoQOcbtQKs=; b=O7K8auRhf33GBK2qI/tievfMOJBqEPu60EYDPjE+3q3HuLE3hdm0a+edLiEFe0Mfm5 EMUDSYfyA6NAhQeKD+usWF22A2JudlNGEvuOPozs4dAbiWykSSdCT3b4Tz49M0gbWmqX FHVTf7qKLAY8ua3TnWGXYK49Ow0nBAEXmStcb+bmgMPz80tJ9VY+Q/tyF9a7FaUnuCXp UR7uhMkZ7ZvDrLsDvCaIuHzvYY6yXn/G2L73/91UIsS38CrNuC0r469sLs2RcmVr5K6j OIfGdwojtBnMCbKtXGK12feZQi4ImI9BuCbiufnGghvnOUu6XweGJ2PRNPm7N2XBHY0i EnaQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si7859690plk.220.2019.03.05.01.54.31; Tue, 05 Mar 2019 01:54:47 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727420AbfCEJac (ORCPT + 99 others); Tue, 5 Mar 2019 04:30:32 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:46992 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726069AbfCEJac (ORCPT ); Tue, 5 Mar 2019 04:30:32 -0500 Received: by mail-qk1-f194.google.com with SMTP id i5so4409465qkd.13; Tue, 05 Mar 2019 01:30:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jexVvyA3iEsprtYPEf6Tq7zXfxjDn59k/qoQOcbtQKs=; b=LfD5HPPCrzHgy/VrMSNjo55JhnIO+7EQcMbu62plunm3QOE9cvK2Hv5cyO74ERtVl1 AYvYm82VsuL1vPubasUJ+9IXpwOVCek6Glp/oBQwVnfnarM508b0SXvB0nTMMzh4woVX Vh2xKNuknZOh77+2z77GEb0QGGqxwpZHT6CUaVdyyKGeb0rcS7vOjqc1pnp8f8kz2hZ7 D1+zN4Yo+QKfGJ/vXyd1xRKyc7GlqFbEPzEVGJdoeNnVpTe4p5F1dxk5/sKjpkdnbhqd 0WHdYzLtRqKQC+EGNAWqSi1nb32mr8cildX9BpV6jU3etHFhKlVN/414sIcVWTBJDkYU o04w== X-Gm-Message-State: APjAAAVq3xY2SGjvB76sZQ/wR2nPwfk2/b0tRhPAfQ3iG+/CzExcPttj 057tHl7hVjokYnjFzLnp5WxGvPVw4h8jXWE6q1nK4Q== X-Received: by 2002:a05:620a:1478:: with SMTP id j24mr933719qkl.343.1551778230956; Tue, 05 Mar 2019 01:30:30 -0800 (PST) MIME-Version: 1.0 References: <20190304202758.1802417-1-arnd@arndb.de> <20190305075317.4t32uyyhzftuoebp@kekkonen.localdomain> <20190305084720.jlgwd5ifouq3vvra@kekkonen.localdomain> In-Reply-To: <20190305084720.jlgwd5ifouq3vvra@kekkonen.localdomain> From: Arnd Bergmann Date: Tue, 5 Mar 2019 10:30:12 +0100 Message-ID: Subject: Re: [PATCH] media: staging/intel-ipu3: reduce kernel stack usage To: Sakari Ailus 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" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 5, 2019 at 9:47 AM Sakari Ailus wrote: > 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. Ok, I'll send an updated patch the way you suggested then. Arnd