]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen/hvc: Fix up checks when the info is allocated.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 26 Jun 2012 13:30:51 +0000 (09:30 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 19 Jul 2012 23:06:14 +0000 (19:06 -0400)
Coverity would complain about this - even thought it looks OK.

CID 401957
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Conflicts:

drivers/tty/hvc/hvc_xen.c

drivers/tty/hvc/hvc_xen.c

index 5fb1cb9889ae04765d2b9fce6402f71acdaaa6a8..f2faf0d78a24cf80072526a86bcdbe10f5861a68 100644 (file)
@@ -209,12 +209,10 @@ static int xen_hvm_console_init(void)
                info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL | __GFP_ZERO);
                if (!info)
                        return -ENOMEM;
-       }
-
-       /* already configured */
-       if (info->intf != NULL)
+       } else if (info->intf != NULL) {
+               /* already configured */
                return 0;
-
+       }
        r = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v);
        if (r < 0 || v == 0)
                goto err;
@@ -254,12 +252,10 @@ static int xen_pv_console_init(void)
                info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL | __GFP_ZERO);
                if (!info)
                        return -ENOMEM;
-       }
-
-       /* already configured */
-       if (info->intf != NULL)
+       } else if (info->intf != NULL) {
+               /* already configured */
                return 0;
-
+       }
        info->evtchn = xen_start_info->console.domU.evtchn;
        info->intf = mfn_to_virt(xen_start_info->console.domU.mfn);
        info->vtermno = HVC_COOKIE;