chardev: fix error handling in cdevdeviceadd()
This is an automated ID intended to aid in discovery of potential security vulnerabilities. The actual impact and attack plausibility have not yet been proven. This ID is fixed in Linux Kernel version v5.15.86 by commit 28dc61cc49c6e995121c6d86bef4b73df78dda80, it was introduced in version v4.12 by commit 233ed09d7fdacf592ee91e6c97ce5f4364fbe7c0. For more details please see the references link.