From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DDAA0366DAB for ; Wed, 11 Feb 2026 12:58:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770814722; cv=none; b=dX6dyeXZ/w7c9Dk3Oi9AwSwUI5AaIrJ0fLuK1sKCPp9yDM8T1hGZjbtXab9dgV/KZcMhyeBqEGsDaLwIy5clZUcOldD+oMvTVy4V/pXQvRtj2ELsDo3867qi552dB59tZkljNX6FhBnvzGbuRc1NAT7hv3MB+NDmlAkF0X//QSI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770814722; c=relaxed/simple; bh=p2t78UcvojgocMcsCXspWJlIbbQckG2PyLKH4A9oVfw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=LouQSOG9OvepTbjivDmHcBQDRB/Zg6LG0sPrRdcuoQL6RS+goSYxDkRIYGSm/kiQPGkMayUJgtBRoTf2AHOCSpTBGpT6t1Kz7vRzeZDemdH2y/xucndI1tQEPwHKEMQrzITOS+5pBd8HLGxYvtr9hIlJgbP8/qh4wwDa80qkb6E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UjA94hn6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UjA94hn6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30278C4CEF7; Wed, 11 Feb 2026 12:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770814722; bh=p2t78UcvojgocMcsCXspWJlIbbQckG2PyLKH4A9oVfw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=UjA94hn6isQCAU8BYkdx3geN9Ee1Bu2tgiDyKJXoyurElTTBfBLNA2la5ypHVsBcN GMahYYK8LHk5KtcseuN4jKg+yccuXTmhVtrBhPzhPAPbvMoy5lEmuc5iDiOhIkn2jX fomZuOsgjbvbHcq7SkTXWWJyRq9VmagPpmItJdTYjc5++KxVWzqtu/LlPinXtJKNp6 5sV0R0wrpzPwSgNYh9IUDnVcfFKoengH2xW7uDVVsxMsmID1jStWxmU/WcvrHSlXGK t0Yu0VgFlmMyt6vixtqcTEorCmPIGCAP7MHt1/hjOHC50kN+VX1J2/kzz8ipD/O0Bx ocIUuVGhtDsGQ== From: Thomas Gleixner To: Zhan Xusheng , Frederic Weisbecker Cc: linux-kernel@vger.kernel.org, Zhan Xusheng Subject: Re: [PATCH] clockevents: Add error handling and rollback in tick_init_sysfs() In-Reply-To: <20260210072754.178963-1-zhanxusheng@xiaomi.com> References: <20260210072754.178963-1-zhanxusheng@xiaomi.com> Date: Wed, 11 Feb 2026 13:58:39 +0100 Message-ID: <87y0kz8mio.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Tue, Feb 10 2026 at 15:27, Zhan Xusheng wrote: > @@ -756,12 +756,24 @@ static int __init tick_init_sysfs(void) > dev->id = cpu; > dev->bus = &clockevents_subsys; > err = device_register(dev); > - if (!err) > - err = device_create_file(dev, &dev_attr_current_device); > - if (!err) > - err = device_create_file(dev, &dev_attr_unbind_device); > if (err) > return err; > + > + err = device_create_file(dev, &dev_attr_current_device); > + if (err) > + goto err_unregister; > + > + err = device_create_file(dev, &dev_attr_unbind_device); > + if (err) > + goto err_remove_file; > + > + continue; > + > +err_remove_file: > + device_remove_file(dev, &dev_attr_current_device); > +err_unregister: > + device_unregister(dev); > + return err; So this leaves already created per CPU files and devices around which is inconsistent as well. So what's the point of this half baked cleanup? If this fails and it only can fail because of out of memory then the system is doomed anyway. Cleanup up a couple of kilobytes wont make a difference at all Thanks, tglx