From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 729673D79EF for ; Thu, 2 Jul 2026 11:11:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782990714; cv=none; b=lr+VdwTrpuq/98SjlATT7wvDS6v37l/K7VzCyJk+eetJPM6iv9E3iGK90hOlflfj7mC+I1qFqg2mOxO9SdjWKqaMg9CeMtQf35loC++41HwDf3sO+0UNWmR5AXrRzm+cmSFyNwrro9kDAPmWWuOY/TPfQnB5fwjS2W0SxNJAFJ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782990714; c=relaxed/simple; bh=9GHyueZkrJ1pvOdd4W4j5hDGSd0mJXFUacJKCs5ECGU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Pj2kCB4s6Lq5WaPpgo+uXLAixWth+oMYDl4arXXp/nWGTYRrInEBeGH2Gfd5DROsv/DSa6qfIWIToQow5425su2MGF293BOPTE2kvJF+B9aZKvR3NpJ3XSSDQDFh6GF7AluAIuqpt94ixvtpto2LZz2h6JmN8s0muoSmtUR2KiY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lwJfk59P; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lwJfk59P" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 831211F000E9; Thu, 2 Jul 2026 11:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782990713; bh=h5xr3ra8V8Ns/Whs9YQoYJVwowknHo4gFLczQdhS7Ig=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=lwJfk59PTKEI/KYg8tJTfbSNPl1Z/5oORn41GaGTDCCRq3Q3Dl20U3vqImFtyPtuZ ThLCPNTafujOxaCoUnfq760UYveiOB7llsJeM4JYOtVCGcfJ3p0siwHKVopQwzbu6v rIcej5vhvzLNIPjn98lXJXElXkH4ykLdLFd5y3WO89QzDfVhqvKh6mSqPbLUwncFN6 yb2rXA1VbwnjaaVmKfYqDy+GhsJpur0e66EutL1RVT0+W2MtSQpEcqyDO+xgENlCH2 AnmyFE9w6ttyEKyF/kQCE9xxgGkuAVofOFeFWGFCrvQa19GcbN2M+g55k4EZSWy2Wq eAi+ynPlsR6FQ== Date: Thu, 2 Jul 2026 12:11:49 +0100 From: Lee Jones To: Pengpeng Hou , Ben Dooks Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] mfd: sm501: unwind common init failures Message-ID: <20260702111149.GK2108533@google.com> References: <20260616004159.90144-1-pengpeng@iscas.ac.cn> 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: <20260616004159.90144-1-pengpeng@iscas.ac.cn> Once again, you're missing with ancient code. You need to draft in the author. On Tue, 16 Jun 2026, Pengpeng Hou wrote: > sm501_init_dev() creates the debug sysfs file and can register child > devices before the final clock-source sanity check. If that check fails, > the caller tears down the parent mapping but the children and debug file > remain published. The PCI probe path also ignored the return value from > sm501_init_dev(). > > Unwind the common SM501 registrations before returning the clock-check > failure, and make the PCI probe path propagate sm501_init_dev() errors. > > Signed-off-by: Pengpeng Hou > --- > drivers/mfd/sm501.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c > index 0ee6d8940e69..b21b4fc18e87 100644 > --- a/drivers/mfd/sm501.c > +++ b/drivers/mfd/sm501.c > @@ -1249,6 +1249,8 @@ static unsigned int sm501_mem_local[] = { > [5] = 2*1024*1024, > }; > > +static void sm501_dev_remove(struct sm501_devdata *sm); > + > /* sm501_init_dev > * > * Common init code for an SM501 > @@ -1321,6 +1323,7 @@ static int sm501_init_dev(struct sm501_devdata *sm) > if (ret) { > dev_err(sm->dev, "M1X and M clocks sourced from different " > "PLLs\n"); > + sm501_dev_remove(sm); > return -EINVAL; > } > > @@ -1583,9 +1586,14 @@ static int sm501_pci_probe(struct pci_dev *dev, > goto err4; > } > > - sm501_init_dev(sm); > + err = sm501_init_dev(sm); > + if (err) > + goto err5; > + > return 0; > > + err5: > + iounmap(sm->regs); > err4: > release_mem_region(sm->io_res->start, 0x100); > err3: > -- > 2.50.1 (Apple Git-155) > -- Lee Jones