[PATCH] dell_rbu: fix error check
platform_device_register_simple() returns error code as pointer when it fails. The return value should be checked by IS_ERR(). Cc: Abhay Salunke <abhay_salunke@dell.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Matt Domsch <Matt_Domsch@dell.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
55aa601e14
commit
6897083abf
|
@ -705,17 +705,16 @@ static struct bin_attribute rbu_packet_size_attr = {
|
||||||
|
|
||||||
static int __init dcdrbu_init(void)
|
static int __init dcdrbu_init(void)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc;
|
||||||
spin_lock_init(&rbu_data.lock);
|
spin_lock_init(&rbu_data.lock);
|
||||||
|
|
||||||
init_packet_head();
|
init_packet_head();
|
||||||
rbu_device =
|
rbu_device = platform_device_register_simple("dell_rbu", -1, NULL, 0);
|
||||||
platform_device_register_simple("dell_rbu", -1, NULL, 0);
|
if (IS_ERR(rbu_device)) {
|
||||||
if (!rbu_device) {
|
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"dell_rbu:%s:platform_device_register_simple "
|
"dell_rbu:%s:platform_device_register_simple "
|
||||||
"failed\n", __FUNCTION__);
|
"failed\n", __FUNCTION__);
|
||||||
return -EIO;
|
return PTR_ERR(rbu_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr);
|
rc = sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr);
|
||||||
|
|
Loading…
Reference in a new issue