From patchwork Fri Nov 8 04:13:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Hattori X-Patchwork-Id: 13867527 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 268C81C3F00 for ; Fri, 8 Nov 2024 04:14:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731039247; cv=none; b=c6Pq7uu6LMQG6rV1mI3/izAX73aPMzT3l1lf8verCMTQEWcOexBO4QC6/j9yMx6k0huAllSR7iSKOAd2nKu1BlP+VtHmGWdpfXAt7H2xGkY6lCbSm8dM6MBflD35lqLaEAVawyOAJ2VUWh+MvLeerwDELyPJy8u0N8NqJ730l9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731039247; c=relaxed/simple; bh=kiT/02fO/y8QF6p6cCZDX+NsUrqelIEyFq3E2Ifw6VQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=coLTfRAnOPomQ/FnzzRsSmTy9GnKNxmRaMRQ2Sobiuw4w124tobytVJjmz/PA1+uPaQj308zETctE7RrYjecYphJ6aph+XbOlnZ7vAnOzZb4rFiUEEU8erIDhEdNpsM5zIYhYLaOYr6tqhAyYTBlusInBpN/yKY+x7R8UF+FCRk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=pf.is.s.u-tokyo.ac.jp; spf=none smtp.mailfrom=pf.is.s.u-tokyo.ac.jp; dkim=pass (2048-bit key) header.d=pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.i=@pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.b=yixEgGfy; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=pf.is.s.u-tokyo.ac.jp Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=pf.is.s.u-tokyo.ac.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.i=@pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.b="yixEgGfy" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2e59746062fso1388889a91.2 for ; Thu, 07 Nov 2024 20:14:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com; s=20230601; t=1731039244; x=1731644044; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bPVATv792foYxRFYTwOl9/mjQWN0tkjHAgn+BUkGmog=; b=yixEgGfyWmjPngc+thaYs9zGyJmOKv1VQbRRlmgn4/wadVPIDVmAKwqqq1LJKFGlew zNZhj81Ewr8uyB/lKbi+pRIs1L0L4RAYU4Sufs3HiBrOSH005R59baWTD7DVZUikohAV rFBC9cd0lu+wGHALqbiSbLqf1XA5srKOBt5BJOJtgAqVj1r0GJN0M+Ks9oyaVH1kWff9 5pqMghO9thN6RBtnQ5eeUGrSfkqNKKGLJNiolCa+UWvNUDfAEAOHXsEoMzT57NjUO2ag xDMEdNf0puumK7/10sV/Ad0aM4gy656zWL6irFnWugi4uR1G9jnE+Xde0ifBcuOpKhYJ tpFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731039244; x=1731644044; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bPVATv792foYxRFYTwOl9/mjQWN0tkjHAgn+BUkGmog=; b=OUYrxHVt4rvXDU1ypeeyw7lbZG1328A8qooCXiOgCcpxEDD7cfkrmGpBExr7y4OGwR ugFAQbvMD+IN+dWvCCr3/YgNei4D7A2w4xvVqpEV/9xz7lkK7iUz29+TPPibrXnEWXcH ujIzM9giC4xdRtWP2h2ap+0pCNRu0+nNKWPFCd4DYJvbZ3xD4rJpSCuyJewRp3i6ndtO XCYoXjXAIsg7La5Gcq6fUqtkEoXNmLyxRzTgvQVMiMAq6yrT4EoIXGIN5Mu17GyOIDFS HzDGFvFlNYM+cdT3pcp34obtEWiL6JP44LD5fVf9IceuGvcDaFcrtx+N13tXP35GUMwa v6vg== X-Gm-Message-State: AOJu0YzV9id27ZQk1f4f6656jKnngPZvyIloAVlFbJsE8Hz66Jap3C6V xE2VzFZ9QoU4+brfT6QUfAY6AqkdeW8yCFqtznUOCat7/eQ0tdhQkcKzPJlGUDk= X-Google-Smtp-Source: AGHT+IHuICo9i+Vs014lkoRqNsIGQfSk5dbFgZwWC7sqHI4BL76FLUzaIRJPlL35tzSRL3dYFyqG2w== X-Received: by 2002:a17:90b:1a8d:b0:2e5:e43a:1413 with SMTP id 98e67ed59e1d1-2e9b16955bamr2217103a91.9.1731039244386; Thu, 07 Nov 2024 20:14:04 -0800 (PST) Received: from localhost.localdomain (133-32-133-31.east.xps.vectant.ne.jp. [133.32.133.31]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e99a541c95sm4964898a91.17.2024.11.07.20.14.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 20:14:03 -0800 (PST) From: Joe Hattori To: andersson@kernel.org, mathieu.poirier@linaro.org Cc: linux-remoteproc@vger.kernel.org, Joe Hattori Subject: [PATCH 1/3] remoteproc: qcom: pas: Remove subdevs on the error path of adsp_probe() Date: Fri, 8 Nov 2024 13:13:53 +0900 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Current implementation of adsp_probe() in qcom_q6v5_pas.c does not remove the subdevs of adsp on the error path. Fix this bug by calling qcom_remove_{ssr,sysmon,pdm,smd,glink}_subdev(), qcom_q6v5_deinit(), and adsp_unassign_memory_region() appropriately. Fixes: 4b48921a8f74 ("remoteproc: qcom: Use common SMD edge handler") Signed-off-by: Joe Hattori --- drivers/remoteproc/qcom_q6v5_pas.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index ef82835e98a4..27b23a000c7a 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -759,16 +759,16 @@ static int adsp_probe(struct platform_device *pdev) ret = adsp_init_clock(adsp); if (ret) - goto free_rproc; + goto unassign_mem; ret = adsp_init_regulator(adsp); if (ret) - goto free_rproc; + goto unassign_mem; ret = adsp_pds_attach(&pdev->dev, adsp->proxy_pds, desc->proxy_pd_names); if (ret < 0) - goto free_rproc; + goto unassign_mem; adsp->proxy_pd_count = ret; ret = qcom_q6v5_init(&adsp->q6v5, pdev, rproc, desc->crash_reason_smem, desc->load_state, @@ -784,18 +784,28 @@ static int adsp_probe(struct platform_device *pdev) desc->ssctl_id); if (IS_ERR(adsp->sysmon)) { ret = PTR_ERR(adsp->sysmon); - goto detach_proxy_pds; + goto deinit_remove_pdm_smd_glink; } qcom_add_ssr_subdev(rproc, &adsp->ssr_subdev, desc->ssr_name); ret = rproc_add(rproc); if (ret) - goto detach_proxy_pds; + goto remove_ssr_sysmon; return 0; +remove_ssr_sysmon: + qcom_remove_ssr_subdev(rproc, &adsp->ssr_subdev); + qcom_remove_sysmon_subdev(adsp->sysmon); +deinit_remove_pdm_smd_glink: + qcom_remove_pdm_subdev(rproc, &adsp->pdm_subdev); + qcom_remove_smd_subdev(rproc, &adsp->smd_subdev); + qcom_remove_glink_subdev(rproc, &adsp->glink_subdev); + qcom_q6v5_deinit(&adsp->q6v5); detach_proxy_pds: adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count); +unassign_mem: + adsp_unassign_memory_region(adsp); free_rproc: device_init_wakeup(adsp->dev, false); From patchwork Fri Nov 8 04:13:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Hattori X-Patchwork-Id: 13867528 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 E298A1C3F39 for ; Fri, 8 Nov 2024 04:14:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731039250; cv=none; b=SDHqCBqRqbx3oZTZ9qCNE3TS+/0cKYJNChFCHPcI4N3Fza/MKlUX3tYeU8fMUb54kNSjhm/EIG0x/jaQ6oTS6FTl8GxsnuLRAogt3++4ZE7uw2FoUl6a0RDCxDeY2+tYdnRTSi3P1FEp01Hw03bav1yhmkGM6UJeuYVPmJs2AWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731039250; c=relaxed/simple; bh=52vkohNZH/fUTR1TgWtB+26GSgZUmkBIQEyJYX7FmJ8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AIeuZmDoCEh3anwd8oog3tvYuVXOsHRj7Lsi4rWjQnWBs3dSchUaVu1jRokBrm1SObPPH+7p3jXPDH0n4mMhN3QjIVrEhdQWuVBneQn7lT9U2WrqwjFvfC6lI1p4SMC8E9SrlILYJlBzWt/LiSLbtLro28+pKeiijdGiOLBhLRE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=pf.is.s.u-tokyo.ac.jp; spf=none smtp.mailfrom=pf.is.s.u-tokyo.ac.jp; dkim=pass (2048-bit key) header.d=pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.i=@pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.b=qwIl6pMU; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=pf.is.s.u-tokyo.ac.jp Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=pf.is.s.u-tokyo.ac.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.i=@pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.b="qwIl6pMU" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7ee7e87f6e4so1247351a12.2 for ; Thu, 07 Nov 2024 20:14:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com; s=20230601; t=1731039247; x=1731644047; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BvJAK1kPdQuIBdNEMaaMSxFXdpiJyiGm4xygS9ksrhI=; b=qwIl6pMU3zUMpXXcVSKF4VVllvbExWW6xWwrD2bkw+lMuElZlJ3YUa01y533KBi5PO vHPxSgYh00A/ay5oeaXwsnX3bv7sb03InP+IM7RzgEuL2pquNC7937aLttnqugcuKyWb C25oeLxy2Htatnm/JMeq/F66f+d4vDJTL5ukllYrDdw8SCRjp62+4WugjejVk9L1rnj0 Qg2ppuCNfnh7IZ66srN+ZcjalSg7F3YnS/7fDFa6Hh+h28usyyWXSKuSlxUqxl2coRHQ FPlLYnfpKuiuEfzoG1XoqNa4qs3E72ERyNR1z0vnOJBeo5+lZgRFFCvB7SlHRVkadjYs GiHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731039247; x=1731644047; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BvJAK1kPdQuIBdNEMaaMSxFXdpiJyiGm4xygS9ksrhI=; b=xIHzljbzhfUFnm4H8vc9lGK7TFg92vmDZzXXXwnfgc8Z2LOa1ghUy58lFkygQ/etD/ i1ALdGktuSz1DxNKKRCXo5wApi7cJlCrV2eUOX1zomIeOTxA8jrOVkY/KEFiPLUx0uLe 6tyufXzrR1L9sb/GN/VDz5Dehlw8LGEnSf6DBSiukZSzQg1DVbChD7t/fpgmGY7kEUIX 1FOa9DnzYTzDHCmgJsWrAWx5UfStDcP8j0Gh0v6AyXJfVipPR6jmr3WSBGSsfFIgXMaz o69csAMF+K9oiWQibcWb8SXuQTyzz3BxyA8jGeFRfdtNUNCJMFPISDQFh1dxtRC0ysTt ttWA== X-Gm-Message-State: AOJu0YyMuxWlZsSYwCeBRSPgpyYJp9Qjw4lh1yqgEI8ndfJCHl5xu869 yzpwzWTEkpPoipLlV5gx1ImfL7hLu8OubWMuJ1e1bCw6PgDEL9IfL/Hfz+9zRKEOukG0OCXHmDT 0 X-Google-Smtp-Source: AGHT+IHDypIgjCUCqkntfJFuUWBEKE7e5vOPljgD9Q+XJZOd5/vPNZpqeJV+wrEBGYgiN+UY+/qyaQ== X-Received: by 2002:a05:6a20:a12b:b0:1db:efd3:b811 with SMTP id adf61e73a8af0-1dc22b90c50mr2027406637.38.1731039247139; Thu, 07 Nov 2024 20:14:07 -0800 (PST) Received: from localhost.localdomain (133-32-133-31.east.xps.vectant.ne.jp. [133.32.133.31]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e99a541c95sm4964898a91.17.2024.11.07.20.14.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 20:14:06 -0800 (PST) From: Joe Hattori To: andersson@kernel.org, mathieu.poirier@linaro.org Cc: linux-remoteproc@vger.kernel.org, Joe Hattori Subject: [PATCH 2/3] remoteproc: qcom: adsp: Remove subdevs on the error path of adsp_probe() Date: Fri, 8 Nov 2024 13:13:54 +0900 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Current implementation of adsp_probe() in qcom_q6v5_adsp.c and does not remove the subdevs of adsp on the error path. Fix this bug by calling qcom_remove_{ssr,sysmon,pdm,smd,glink}_subdev(), and qcom_q6v5_deinit() appropriately. Fixes: dc160e449122 ("remoteproc: qcom: Introduce Non-PAS ADSP PIL driver") Signed-off-by: Joe Hattori --- drivers/remoteproc/qcom_q6v5_adsp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index 572dcb0f055b..223f6ca0745d 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -734,15 +734,22 @@ static int adsp_probe(struct platform_device *pdev) desc->ssctl_id); if (IS_ERR(adsp->sysmon)) { ret = PTR_ERR(adsp->sysmon); - goto disable_pm; + goto deinit_remove_glink_pdm_ssr; } ret = rproc_add(rproc); if (ret) - goto disable_pm; + goto remove_sysmon; return 0; +remove_sysmon: + qcom_remove_sysmon_subdev(adsp->sysmon); +deinit_remove_glink_pdm_ssr: + qcom_q6v5_deinit(&adsp->q6v5); + qcom_remove_glink_subdev(rproc, &adsp->glink_subdev); + qcom_remove_pdm_subdev(rproc, &adsp->pdm_subdev); + qcom_remove_ssr_subdev(rproc, &adsp->ssr_subdev); disable_pm: qcom_rproc_pds_detach(adsp); From patchwork Fri Nov 8 04:13:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Hattori X-Patchwork-Id: 13867529 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (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 741731BC09A for ; Fri, 8 Nov 2024 04:14:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731039254; cv=none; b=SyE4BZgY4JVVpN9d+VYeudbfZpQsNlcurvrfg+ZVtAqoGLfXVZyIIPJ61NXz9NHh6NzBJPMjjUUVq+Wxnaief5Xw8JGtQD00tMhKDgpPjlBcgMtJ+OEDLXwrqlI0Fm5dQqaHfcVIzW36a8veNmkar4eCzB3FSlui5WIuy2UHSL0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731039254; c=relaxed/simple; bh=U05aE29ZGNS/A5hteh174GSSsB+Ef6dyJmroxixrz9Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BucfevadcXG7h/ajGiq79YaUHH1Tz3HE7vI1UpnlTls0FkkQi2GvduRzdOJj0mJUAC+WSWsU0ag571bLpx4puQMKtccIBu+Tg69GP8/dpdFbrAxpNHt4D1z+eq+bpXgFkvCfjRI6GHfN+nqk5QNy2yCrQqId748beX5Sio/BwcU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=pf.is.s.u-tokyo.ac.jp; spf=none smtp.mailfrom=pf.is.s.u-tokyo.ac.jp; dkim=pass (2048-bit key) header.d=pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.i=@pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.b=V//t45IY; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=pf.is.s.u-tokyo.ac.jp Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=pf.is.s.u-tokyo.ac.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.i=@pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com header.b="V//t45IY" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-7f4325168c8so140296a12.1 for ; Thu, 07 Nov 2024 20:14:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pf-is-s-u-tokyo-ac-jp.20230601.gappssmtp.com; s=20230601; t=1731039252; x=1731644052; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0acZ1vxJLPbYnRkgptI9IrKTobxhKP01mtuMRII5lrA=; b=V//t45IYgUXSOWusQJm26lE9ikVooGo7MT4bvx4cMlEODUqTyh99sdJxJTzI040VnG MPKTrAPhiY6U6d7GQ1baBY2kGFsF/BrNXwonqXb5aZ0be+cUHrVuxZJp3DPor4O5Q1b7 a8wprQ0SyduvCWBdzdmKAKNC/0ct/E2QZrgb7Lr70UFwafoWg1KLR6eTojhZaHeEW7nE 4NzqnFnYP6mAQ0PfLKFma9+/C6ip3KeHHZzYEV8Q3KLyqBWm5OXRMiE3VbLeuicYEngt A4SrP9zgAXeX+dtwk3D9+Zm2D4w1e0ly6mZK5x83+TurJKZxX502U2oytlW2ML/tG8+d E+Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731039252; x=1731644052; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0acZ1vxJLPbYnRkgptI9IrKTobxhKP01mtuMRII5lrA=; b=ZtsKyhTaorDDeiwK8gowf4ZBnVexJggZmzM2jZp0FyxVbOcPBYQkqFMvCuvrVdz+F5 eVDi3Y6IHg6+5Dqf4Ijkeh1rloyk4oATbUXpEzjAUP0i7asfzffdwYFXa5vNfPlVBd3g EiYvgVPdOZXlbm/vbkfjRqJdQcKBPc4Jh/VM4v3QUov3cBaKIDdgVc5W0vlfHpy0FBfs zHFCZWTq1HuVQ1UsUjmlMHrQWbLZaM7exhZmz9Gy0vIPTS1hy3wwtlph2RMK39IB7eSV /23vcUjkMQLwbZBs0xInQbKtbgRaPVhrKQogB0PM23aiJDO34Ii04RpobM+tkWSDQous Q3Sw== X-Gm-Message-State: AOJu0Yyn8mXmdykVvdPRGv74cV7Fhs40uqUuudjxF1+cEllnkGgSfMsZ cerZg7Bsp2B85gpCsEwr7FXdXZJxADdNf7+dG+yEw2xnMNLEOlhjXemmBgjSXFU= X-Google-Smtp-Source: AGHT+IHtudU+pzNmLGD6u9E4l70muCszYHwdWPhSGl5P1NVKaUoSjbAf7nZb5RDPUvwN84qz/G6Vxw== X-Received: by 2002:a05:6a20:3d87:b0:1db:9367:d018 with SMTP id adf61e73a8af0-1dc229d6d4dmr2212057637.20.1731039251446; Thu, 07 Nov 2024 20:14:11 -0800 (PST) Received: from localhost.localdomain (133-32-133-31.east.xps.vectant.ne.jp. [133.32.133.31]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e99a541c95sm4964898a91.17.2024.11.07.20.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 20:14:10 -0800 (PST) From: Joe Hattori To: andersson@kernel.org, mathieu.poirier@linaro.org Cc: linux-remoteproc@vger.kernel.org, Joe Hattori Subject: [PATCH 3/3] remoteproc: qcom: wcss: Remove subdevs on the error path of q6v5_wcss_probe() Date: Fri, 8 Nov 2024 13:13:55 +0900 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Current implementation of q6v5_wcss_probe() in qcom_q6v5_wcss.c and does not remove the subdevs on the error path. Fix this bug by calling qcom_remove_{ssr,sysmon,pdm,glink}_subdev(), and qcom_q6v5_deinit() appropriately. Signed-off-by: Joe Hattori --- drivers/remoteproc/qcom_q6v5_wcss.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c index e913dabae992..1e85beb8f9f6 100644 --- a/drivers/remoteproc/qcom_q6v5_wcss.c +++ b/drivers/remoteproc/qcom_q6v5_wcss.c @@ -1056,18 +1056,33 @@ static int q6v5_wcss_probe(struct platform_device *pdev) qcom_add_pdm_subdev(rproc, &wcss->pdm_subdev); qcom_add_ssr_subdev(rproc, &wcss->ssr_subdev, "q6wcss"); - if (desc->ssctl_id) + if (desc->ssctl_id) { wcss->sysmon = qcom_add_sysmon_subdev(rproc, desc->sysmon_name, desc->ssctl_id); + if (IS_ERR(wcss->sysmon)) { + ret = PTR_ERR(wcss->sysmon); + goto deinit_remove_subdevs; + } + } ret = rproc_add(rproc); if (ret) - return ret; + goto remove_sysmon_subdev; platform_set_drvdata(pdev, rproc); return 0; + +remove_sysmon_subdev: + if (desc->ssctl_id) + qcom_remove_sysmon_subdev(wcss->sysmon); +deinit_remove_subdevs: + qcom_q6v5_deinit(&wcss->q6v5); + qcom_remove_glink_subdev(rproc, &wcss->glink_subdev); + qcom_remove_pdm_subdev(rproc, &wcss->pdm_subdev); + qcom_remove_ssr_subdev(rproc, &wcss->ssr_subdev); + return ret; } static void q6v5_wcss_remove(struct platform_device *pdev)