From: Pan Bian Date: Mon, 5 Dec 2016 08:22:22 +0000 (+0800) Subject: xen: xenbus: set error code on failure X-Git-Tag: v4.10-rc1~137^2~6 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2466d4b9d0c21e6c28cd63516dea65806bf5a307;p=karo-tx-linux.git xen: xenbus: set error code on failure Variable err is initialized with 0. As a result, the return value may be 0 even if get_zeroed_page() fails to allocate memory. This patch fixes the bug, initializing err with "-ENOMEM". Signed-off-by: Pan Bian Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross --- diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index b5c1dec4a7c2..4bdf654041e9 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -702,7 +702,7 @@ device_initcall(xenbus_probe_initcall); */ static int __init xenstored_local_init(void) { - int err = 0; + int err = -ENOMEM; unsigned long page = 0; struct evtchn_alloc_unbound alloc_unbound;