rapidio: fix potential null deref on failure path

If rio is not a switch then "rswitch" is null.

Signed-off-by: Dan Carpenter <[email protected]>
Cc: Matt Porter <[email protected]>
Cc: Kumar Gala <[email protected]>
Signed-off-by: Alexandre Bounine <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Dan Carpenter 2011-03-23 16:43:07 -07:00 • committed by Linus Torvalds
commit ad4ac17ad1

View file

@ -517,7 +517,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
return rdev;
cleanup:
if (rswitch->route_table)
if (rio_is_switch(rdev))
kfree(rswitch->route_table);
kfree(rdev);