Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757199AbcLADJ3 (ORCPT ); Wed, 30 Nov 2016 22:09:29 -0500 Received: from m12-18.163.com ([220.181.12.18]:45311 "EHLO m12-18.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754225AbcLADJ1 (ORCPT ); Wed, 30 Nov 2016 22:09:27 -0500 From: Pan Bian To: Joshua Morris , Philip Kelleher Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] block: rsxx: set error code on exception path Date: Thu, 1 Dec 2016 10:53:14 +0800 Message-Id: <1480560794-2342-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: EsCowADX5cqbkD9Yky1BEg--.46736S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7JFWUuFyrJrWxZF18Gr43GFg_yoWftwb_u3 y8JrZrCrs5Ar1ak340yFnxA34IkF45Xws5Ka1xKr9xKryIkasrZw1F9ryDC342ga9rJa4D K3Z8X3W7WFnrAjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUYfEf5UUUUU== X-Originating-IP: [106.120.213.17] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiQB8zclSIRQZngQAAsn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 913 Lines: 26 Fix bug https://bugzilla.kernel.org/show_bug.cgi?id=188541. In function rsxx_pci_probe(), variable st takes the return value. Its value should be negative on failures. However, the value of st is 0 even if the call to create_singlethread_workqueue() returns a NULL pointer. This patch fixes the bug by assigning -ENOMEM to st when the call fails. Signed-off-by: Pan Bian --- drivers/block/rsxx/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index 34997df..925bc46 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c @@ -890,6 +890,7 @@ static int rsxx_pci_probe(struct pci_dev *dev, card->event_wq = create_singlethread_workqueue(DRIVER_NAME"_event"); if (!card->event_wq) { dev_err(CARD_TO_DEV(card), "Failed card event setup.\n"); + st = -ENOMEM; goto failed_event_handler; } -- 1.9.1