Skip to content

Commit

Permalink
ssb: use put_device() if device_register fail
Browse files Browse the repository at this point in the history
Never directly free @dev after calling device_register(), even
if it returned an error! Always use put_device() to give up the
reference initialized.

Signed-off-by: Arvind Yadav <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
  • Loading branch information
ArvindYadavCs authored and Kalle Valo committed Mar 13, 2018
1 parent 79ca239 commit a24853a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/ssb/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
/* Set dev to NULL to not unregister
* dev on error unwinding. */
sdev->dev = NULL;
kfree(devwrap);
put_device(dev);
goto error;
}
dev_idx++;
Expand Down

0 comments on commit a24853a

Please sign in to comment.