From: Thomas Gleixner <tglx@kernel.org>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>,
Frederic Weisbecker <frederic@kernel.org>
Cc: linux-kernel@vger.kernel.org, Zhan Xusheng <zhanxusheng@xiaomi.com>
Subject: Re: [PATCH] clockevents: Add error handling and rollback in tick_init_sysfs()
Date: Wed, 11 Feb 2026 13:58:39 +0100 [thread overview]
Message-ID: <87y0kz8mio.ffs@tglx> (raw)
In-Reply-To: <20260210072754.178963-1-zhanxusheng@xiaomi.com>
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
prev parent reply other threads:[~2026-02-11 12:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 7:27 [PATCH] clockevents: Add error handling and rollback in tick_init_sysfs() Zhan Xusheng
2026-02-11 12:58 ` Thomas Gleixner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y0kz8mio.ffs@tglx \
--to=tglx@kernel.org \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zhanxusheng1024@gmail.com \
--cc=zhanxusheng@xiaomi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox