bcachefs: chardev: make bch_chardev_class constant
authorRicardo B. Marliere <ricardo@marliere.net>
Fri, 8 Mar 2024 12:12:47 +0000 (09:12 -0300)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 8 May 2024 21:29:19 +0000 (17:29 -0400)
commitaf3b39b4c64198a08271485c6c2214ff637c3cbd
tree51db6141856eeaf442dc2d64a45ff6abe1e79bc1
parent2f724563fcd76166b9922c506078a4afa4e3a90a
bcachefs: chardev: make bch_chardev_class constant

Since commit 43a7206b0963 ("driver core: class: make class_register() take
a const *"), the driver core allows for struct class to be in read-only
memory, so move the bch_chardev_class structure to be declared at build
time placing it into read-only memory, instead of having to be dynamically
allocated at boot time. Also, correctly clean up after failing paths in
bch2_chardev_init().

Cc: Hongbo Li <lihongbo22@huawei.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/chardev.c