The "goto cleanup" path can deference "rswitch" when it is NULL.

Reported-by: Dan Carpenter <erro...@gmail.com>
Signed-off-by: Alexandre Bounine <alexandre.boun...@idt.com>
Cc: Dan Carpenter <erro...@gmail.com>
Cc: Kumar Gala <ga...@kernel.crashing.org>
Cc: Matt Porter <mpor...@kernel.crashing.org>
Cc: Chul Kim <chul....@idt.com>
---
 drivers/rapidio/rio-scan.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index ebe77dd..5b2cb53 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -516,7 +516,7 @@ static struct rio_dev __devinit *rio_setup_device(struct 
rio_net *net,
        return rdev;
 
 cleanup:
-       if (rio_is_switch(rdev))
+       if (rswitch)
                kfree(rswitch->route_table);
 
        kfree(rdev);
-- 
1.7.6

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to