Once you have called device_initialize() you have to call put_device()
on the structure to clean it up on an error path, otherwise you will
leak memory.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
}
hd = interface->gmod->hd;
- connection->hd = hd; /* XXX refcount? */
+ connection->hd = hd;
if (!gb_connection_hd_cport_id_alloc(connection)) {
- /* kref_put(connection->hd); */
gb_protocol_put(connection);
kfree(connection);
return NULL;
retval = device_add(&connection->dev);
if (retval) {
gb_connection_hd_cport_id_free(connection);
- /* kref_put(connection->hd); */
gb_protocol_put(connection);
- kfree(connection);
+ put_device(&connection->dev);
return NULL;
}