Messages in this thread | | | Date | Wed, 29 Dec 2021 13:07:23 +0100 | From | Uwe Kleine-König <> | Subject | Re: [PATCH v2 13/23] counter: Provide alternative counter registration functions |
| |
Hello,
On Wed, Dec 29, 2021 at 12:27:32PM +0100, Uwe Kleine-König wrote: > > Personal inclination here would be to keep the elements in here > > in the same order as in counter_register() where it doesn't matter > > in the interests of slightly easier comparison of the code. > > I reordered a bit because counter_register fails to undo ida_alloc() in > the error path. However I might have missed that some initialisation has > to be done before calling counter_chrdev_add().
Another issue in counter_register() is: If counter_sysfs_add() fails, put_device() is called which eventually calls counter_device_release() -> counter_chrdev_remove() -> kfifo_free(). I think it's not a real problem, but it's ugly because because counter_chrdev_add() -> kfifo_alloc() wasn't called yet.
Best regards Uwe
-- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ | [unhandled content-type:application/pgp-signature] | |