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 v4.9.337 by commit 5d2146889fad4cb9e6c13e790d4cfd871486eca8, it was introduced in version v4.9.224 by commit da97a80a657d1b1b50ef633e8ff5dbf0d417fc8d. For more details please see the references link.