Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2362362lqo; Mon, 20 May 2024 03:34:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMcCEbWzp3OvWtdJ2NWki4yyHSELKYQ7M5wdN2H2ShsWDiaXiC175lyxFmbODMdOpP6AppVM75QkuVo0kGZ+3z2C+W0vcBApsJd4NUtA== X-Google-Smtp-Source: AGHT+IGA4izTgWkq4NKKnhqssG4Nqf9rU8WiVrC6dKoR5iXmvRERYcafHDJC7HKM1n4mQdCeku0S X-Received: by 2002:a17:902:eccb:b0:1f2:ffca:879e with SMTP id d9443c01a7336-1f2ffca8d6fmr26181515ad.11.1716201264226; Mon, 20 May 2024 03:34:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716201264; cv=pass; d=google.com; s=arc-20160816; b=MYej2H+KNECVy0klLqt6Noax/aYtXz+p3Ge8XMwo0E0bl8YUlc+V3nUX8aKYpf9BrG H8XZ2wYZyUQyJeF07qdJXiCb8fF7SYtRWMB2Trs675x82vr9bYIuxLyDjK93ndkLT/7N DFlDs7O8aJIQ0WaRBw7fKBR/MPw1/2kJ4xloLVrZ5pBpM5yJ9UEK1luAT9KY1jgJcWdG 0AqS7AWlSIc3u6NVNvZo6bwG9SYun/pp+VBbKaV2yRtBvBxxcRxVh9WIlbBTghnT8MeL CAxsM0659vbrDRIsuHOeR8Zjs2Keu/ykLPGE6VfLKxzGUc1eWqqYylwLwwJrHSRVv37t w5ew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=jH83Xw81RQUDduCSpRwSEidVirNBcipY2p4iiDsaCOg=; fh=M35bAvXuybPe+8JlqglE9FgT3zRhXQeFzz6i/Wa9dBI=; b=WWh5XEMy7+Sq4KO0IDseTtEfI7jE6x0CoCPmPNO5EW0VrRyeqGQvQTXVq0usTWQ0bw 2K+SoB1sOOEVGNbC/v3Aly4qG3c6vMRz3NMCdr+tovOoVhQCzq8tedYdi2RgmP7rC6iY ArR7VWKJw83HWWL1x9viw5vMEpgyOOIxPlsVPK3n1IvdSun5kZgyskAg32K4SOYWOkor Dx+49WsbnhT5R35iRQq31X9FqrbeSY3FkkgDJ7DCQ2PHbbx2V+Y34up54l/pevUh1gpQ umAWaQN+JshoO+UMzAAFV+q4m9b0E9v803l/UJptZR3mMVyb1KudKPbdZ/qOPFjUV4/d F1jg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=GoDgnQyV; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-183611-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f2f497282asi31812935ad.289.2024.05.20.03.34.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 03:34:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183611-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=GoDgnQyV; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-183611-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A9CEAB21F80 for ; Mon, 20 May 2024 10:33:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 256BB51C54; Mon, 20 May 2024 10:32:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="GoDgnQyV" Received: from smtp.smtpout.orange.fr (smtp-17.smtpout.orange.fr [80.12.242.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E94805337E; Mon, 20 May 2024 10:32:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716201173; cv=none; b=T1rF6bNP6xefUsshQzsz3PQuIW31ESA5Ys6kHN6tWVieiO1lbShGwB6tqM5wVCpID+lDcKlwWJcMfxlAI512ETiKI0WWcZgo2n8lh895oZziKSbAV8QayEAFP3KNW8GK9Hxz/cQkOunq9KAhM46McSP9GOKWJqA69CSXrduojVc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716201173; c=relaxed/simple; bh=yppvaVyHc8AMdaEFI5sTpzu6tQKpvsN6JlKqYM7j/Uk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uE1+sZwVIFG8LWTAUorifywtknX0iPcv7I3pifEprR1/XR8uuMULKELskAgHmckqOMXq2+cPx02w3K2yI/pcKuUBL0rtwU0cXkZAofxZyTG8LUies86RNFbIbtmV8gixTFxaeP96XPOelo1bskwC/xn+uc4eFq88S7IID85sJBs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=GoDgnQyV; arc=none smtp.client-ip=80.12.242.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from localhost.localdomain ([86.243.17.157]) by smtp.orange.fr with ESMTPA id 90JssdheHXiTd90JtsborX; Mon, 20 May 2024 12:32:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1716201163; bh=jH83Xw81RQUDduCSpRwSEidVirNBcipY2p4iiDsaCOg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=GoDgnQyVwyw5HcubtP7hwSD8xBT3OkQ7aE6lRjee+3948nWnm9x9Haa80z7EHexGv gjHKeZRc0uZNLEEjTr6C203h7Xhea2aqWkBvpCCp7KOpl2dmlEXIl8/HRxTiu8Bncj RMZtGGB5+VUUZFNTM1rLblBIm3i+1DNV8v3A/EFXmqv13ZZXTQIlzk+rdpvDshATcK 9/vM3iUGdH3E1CCB71Jhey4B0LTpjRYjLx8Qy6sNxkfSt916D+LXzBxz2Urs1UkhEM 3xJohXc79a3eRroiVnI5CTw3MD3QG4Q5qkJb4DO4A473N1vULaxKrKesXXOReGGR0b BMj3iMTATt0sg== X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 20 May 2024 12:32:43 +0200 X-ME-IP: 86.243.17.157 From: Christophe JAILLET To: Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Hans de Goede , Hans Verkuil Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-media@vger.kernel.org Subject: [PATCH] media: intel/ipu6: Fix an error handling path in isys_probe() Date: Mon, 20 May 2024 12:32:30 +0200 Message-ID: <545315bcaac0a897c25cfa20a603be2af2a40aa9.1716201136.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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); + out_remove_pkg_dir_shared_buffer: if (!isp->secure_mode) ipu6_cpd_free_pkg_dir(adev); -- 2.45.1