rapidio: utilize new cdev_device_add helper function
authorLogan Gunthorpe <logang@deltatee.com>
Fri, 17 Mar 2017 18:48:20 +0000 (12:48 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Mar 2017 05:44:33 +0000 (06:44 +0100)
commitdbef390d2eb0a7b0a6be21381a326d4e13953aba
tree959cf65e5592d2d397f92eef4141f70bf200860f
parent493cfaeaa0c9bc0c79ce5751193d49fdac9aaaec
rapidio: utilize new cdev_device_add helper function

This driver did not originally set kobj.parent so it likely had
potential a use after free bug which this patch fixes.

We convert from device_register to device_initialize/cdev_device_add.
While we are at it we use put_device instead of kfree (as recommended
by the device_initialize documentation). We also remove an unnecessary
extra get_device from the code.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/rapidio/devices/rio_mport_cdev.c