If device_add() fails, call only put_device() to decrement reference count for cleanup. Do not call device_del() before put_device().
…
Found by code review.
Are you looking for possibilities to improve automated source code analyses accordingly?
Regards, Markus