Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2462272lqo; Mon, 20 May 2024 06:47:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXQUPuGNxMh+PSpEV6yH4JkWRxBG5o6cFXH3W3Eh2KzlXyAqM5Hd+2YZV/8PQs5wq1ZohzIkL//3t4LysN38GJqDJUf732nbc3MQ+2X2A== X-Google-Smtp-Source: AGHT+IFWVgWZsg6SXUwbKnWjzpavKEc9g4MU8+6hSbRna6qeoTZYG6lw8+2Z2hRDwHZnZRvbL/3N X-Received: by 2002:a17:907:94ca:b0:a61:7f85:e31c with SMTP id a640c23a62f3a-a617f85ef06mr251306066b.12.1716212848894; Mon, 20 May 2024 06:47:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716212848; cv=pass; d=google.com; s=arc-20160816; b=Gu9j8gZm+dHSH3j1b17Cs98TYqhMtKawod5HKnYWkagGEblqTxGdLLnIrxT0Fvz3t/ BN5I9pOcaob0TudBmnx1qctYPd04vjSP0s6ut42m0Ogrymuz2yrcKj56ZnUgqDVAlLAl C2CFotFYU1Sd27XjQNzpnYeyMX0NNwQwb4ulGWAjjJ0mlZu1JVf81OdVqfr9n+M8qNxK kycLXsDeh6V1M1VFjQ7J7OexSwStcRJPKS3VjsCOyEn7key3OItZCXffQx4f8PfjOveO O4M0MX8qLpjshnBaGmyq/4lJRxuHDCDTItBD0LnlRzsNIbrhadV27zTV8+SshXjmyR4X qnOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tjDIL/Y8sJBZS9x3QqwLRvnRuu+ROvWbid2ISQ67C5U=; fh=ytWq3+rAFP+0DJB2hearOsyNuIeimOTwnCPUvVTjSK0=; b=i9UFIHx/KjRybHhNPH5/Fej6ZkkKSPj0y0O8aXs94oH+L/rEz47fS7/RgqsuP6kjLI lZ8EcTZp/lHQlXskYSUZR9lQh35ZVby8yyMcVdktdeBnzktRiFinobMb5t5X7aXkXYoH 69myBFqbpVXOFCQlLGBGZZ8H6QP1dD+5H9Fc4opB4PS+qvD2PuV31waCVh1Mf9oRxP23 If+3Obm8i7PL5HfMxErTqJUFgTirSbPKV+XKkH8KKlUOgpgoms4CqsAKu+IzW4Tbf3P9 vix9QqmqZMbwHDSt5xc1IVPQAw3K8SGTuUOJeXl6pAP3HWSHKMj+bZMOcPfF4tWHcYCC zxIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="DjODDvL/"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-183626-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183626-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a1797cd03si1299966666b.264.2024.05.20.06.47.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 06:47:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183626-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="DjODDvL/"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-183626-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183626-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B1CF41F22E2A for ; Mon, 20 May 2024 10:47:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B994B53373; Mon, 20 May 2024 10:47:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DjODDvL/" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87A672032B; Mon, 20 May 2024 10:47:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716202046; cv=none; b=CSDdmANcKM8xrDtFhTE/plsQbBMi38yWGqHFAw9pLJE+ReCpz2mgD0RR2PXSjjeJEYG6+bIBDIjws/DFk3I5bZ75YLHjnnH67nDwTxj2gWPDsmI5jgG9CQMxMwGgnZmyjw6QTWDBy5YRONcUqUkt+ljGnMgAZ+W2ItQ6CQ1ZDIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716202046; c=relaxed/simple; bh=VR0o67WRvl71On11az9p5YmeGt19mCLC3wEHzN3SGf4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VOYNi0CJ33jr63joDBXoFhLJ2iZycL3g8/V4b6eMx1qAa/dqcQJ7BXngyguE+m9mUL+WPdKi+wN9XA1zKiEWygMShGr/xQuXQfaWMqJZyN9RLchURvE1cu9quM8z+aio7E4rBTzgcFkHhzmUFeOR6Ln0xX6yCGMaoNAK5eytdWo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=DjODDvL/; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716202046; x=1747738046; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=VR0o67WRvl71On11az9p5YmeGt19mCLC3wEHzN3SGf4=; b=DjODDvL/aT8f5xF2szSLWnYklOZeEv05XOaYlkVhogMjgUlI/+WaVgzE ipd6EGGccQLBFUDHIK8S4qJdowV392kgYkPDsOVJF6CrrU4WTzlToDOpy leXFUjPMiI0FN5kHghv3Pltlwe4sIhDDZ9RejJWzp3bZso5uQ1WFyhtR8 OsRTmv6clrDKQYLLBB/j5cD2ELiHF8/9idqyGZGU0InNmYQ33Yg4ut3vp 5eFqaMnUKntShOwv5v9ChuCfgCloRrsPJMfOc/zinzaRb8MbvtLk5pzfA prflIE4OLLWZI8ITC/FjXZk3qzitri8mJFoAhzU4kAFRyZtuVEsnxiR2l g==; X-CSE-ConnectionGUID: 1IUvbm5sSoKmtKGOsPk4lw== X-CSE-MsgGUID: uq3BDWrBRt2vrTMzzqidxg== X-IronPort-AV: E=McAfee;i="6600,9927,11077"; a="12164199" X-IronPort-AV: E=Sophos;i="6.08,174,1712646000"; d="scan'208";a="12164199" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2024 03:47:25 -0700 X-CSE-ConnectionGUID: 9ukQbBCFS52uf1+oM45loQ== X-CSE-MsgGUID: O088slIgQiWLBQ2zkyOn6A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,174,1712646000"; d="scan'208";a="37436813" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2024 03:47:23 -0700 Received: from kekkonen.localdomain (localhost [127.0.0.1]) by kekkonen.fi.intel.com (Postfix) with SMTP id 119BC11F830; Mon, 20 May 2024 13:47:20 +0300 (EEST) Date: Mon, 20 May 2024 10:47:20 +0000 From: Sakari Ailus To: Christophe JAILLET Cc: Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Hans de Goede , Hans Verkuil , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH] media: intel/ipu6: Fix an error handling path in isys_probe() Message-ID: References: <545315bcaac0a897c25cfa20a603be2af2a40aa9.1716201136.git.christophe.jaillet@wanadoo.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <545315bcaac0a897c25cfa20a603be2af2a40aa9.1716201136.git.christophe.jaillet@wanadoo.fr> Hi Christophe, Thanks for the patch. On Mon, May 20, 2024 at 12:32:30PM +0200, Christophe JAILLET wrote: > If an error occurs after a successful alloc_fw_msg_bufs() call, some > resources should be released as already done in the remove function. > > Fixes: f50c4ca0a820 ("media: intel/ipu6: add the main input system driver") > Signed-off-by: Christophe JAILLET > --- > Compile tested only > --- > drivers/media/pci/intel/ipu6/ipu6-isys.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys.c b/drivers/media/pci/intel/ipu6/ipu6-isys.c > index 5992138c7290..d9e1e1a135b9 100644 > --- a/drivers/media/pci/intel/ipu6/ipu6-isys.c > +++ b/drivers/media/pci/intel/ipu6/ipu6-isys.c > @@ -1062,6 +1062,7 @@ static int isys_probe(struct auxiliary_device *auxdev, > const struct ipu6_isys_internal_csi2_pdata *csi2_pdata; > struct ipu6_bus_device *adev = auxdev_to_adev(auxdev); > struct ipu6_device *isp = adev->isp; > + struct isys_fw_msgs *fwmsg, *safe; > const struct firmware *fw; > struct ipu6_isys *isys; > unsigned int i; > @@ -1140,12 +1141,17 @@ static int isys_probe(struct auxiliary_device *auxdev, > > ret = isys_register_devices(isys); > if (ret) > - goto out_remove_pkg_dir_shared_buffer; > + goto free_fw_msg_bufs; > > ipu6_mmu_hw_cleanup(adev->mmu); > > return 0; > > +free_fw_msg_bufs: > + list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist, head) > + dma_free_attrs(&auxdev->dev, sizeof(struct isys_fw_msgs), > + fwmsg, fwmsg->dma_addr, 0); This is also done in isys_remove(). How about moving these into a new function that releases memory from both lists? There's no harm in traversing framebuflist_fw as well, it's empty at this point. > + > out_remove_pkg_dir_shared_buffer: > if (!isp->secure_mode) > ipu6_cpd_free_pkg_dir(adev); -- Kind regards, Sakari Ailus