Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp828119pxu; Thu, 26 Nov 2020 13:08:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuBIQnxLj5Mh319TXuu+QSO8rdu6/Da+DLxagwokyzQAi1jvVErj9TsJatXVeMtG9B+7Nb X-Received: by 2002:a17:906:d72:: with SMTP id s18mr4479551ejh.110.1606424922398; Thu, 26 Nov 2020 13:08:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606424922; cv=none; d=google.com; s=arc-20160816; b=y9NY5eImgWpTNCERiUrsJqp4jnIcm4jouIU9eZhg2Fp9oARnw/mQTgkbMtwO+LwpTO lZPnprfdobosHTKHVkZSk9bePuV7A7GPsolZ42iXZ+xAHVVae/wHCZnjb2gMHn2EKaGG vD+YYeuwrwpoDd2yZnYVXbSfyiybVVfICGEpRxkRQ8Ca2CeP02W8NTh/ReM88uJa04UI HkWfVJX+ZXt1w719AGtPqPmaNKTLkOC5hMpxRQ37SuyL6M4TN591mdPJJcgVdjGWH8ie O8plpwWZeSmX+cVTXtHUf9C7GeIy7NxE3LAgUVEbLBIKnZypCq4e7bKuHvWoLhbntrQI 3nKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=iXgVyAkkyVMh/+NzMYM5S6eMNuJtxKx1AQ3NE739HkY=; b=tnyJDYzEttFWI89iB8cUVtQaO8ITSNjD1V4x10uOqvBe/F/Q0I5kKGZF9Du52KOByp wbXUprmDoNSo+k23a4xHb7WlvJ7Ifu6p1E70PqDW6tfKjyhBGAhFlrC7pdNYA05nu7mX K7MEpF1XyyNWfhZjtTA3kE2qluN/yTwbWwENpG+Zw4g4qXa3wNTUtPlHXhqgblmcvw55 32GUKirvKHRz9v9O5uQ9KOtSQxLuoOaZS8t1pGzR2HfEZEq8DgE2n+Bj4XrzX7PL3b+F VB+uXeZmHKTXDPLmzEw7ZiiXE0l2w4eT+qJMyNmRyqe3k0PHif+hS3q8d0fgcRWVFJVM 3hHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n10si3840857edv.118.2020.11.26.13.07.54; Thu, 26 Nov 2020 13:08:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732462AbgKZCpj (ORCPT + 99 others); Wed, 25 Nov 2020 21:45:39 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:7735 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727232AbgKZCpj (ORCPT ); Wed, 25 Nov 2020 21:45:39 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4ChMYY6lTMzkfZH; Thu, 26 Nov 2020 10:45:05 +0800 (CST) Received: from huawei.com (10.175.101.6) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Thu, 26 Nov 2020 10:45:29 +0800 From: Lu Wei To: , , , , Subject: [PATCH] maple: fix wrong return value of maple_bus_init(). Date: Thu, 26 Nov 2020 10:43:11 +0800 Message-ID: <20201126024311.292908-1-luwei32@huawei.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If KMEM_CACHE or maple_alloc_dev failed, the maple_bus_init() will return 0 rather than error, because the retval is not changed after KMEM_CACHE or maple_alloc_dev failed. Fixes: 17be2d2b1c33 ("sh: Add maple bus support for the SEGA Dreamcast.") Reported-by: Hulk Robot Signed-off-by: Lu Wei --- drivers/sh/maple/maple.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c index e5d7fb81ad66..44a931d41a13 100644 --- a/drivers/sh/maple/maple.c +++ b/drivers/sh/maple/maple.c @@ -835,8 +835,10 @@ static int __init maple_bus_init(void) maple_queue_cache = KMEM_CACHE(maple_buffer, SLAB_HWCACHE_ALIGN); - if (!maple_queue_cache) + if (!maple_queue_cache) { + retval = -ENOMEM; goto cleanup_bothirqs; + } INIT_LIST_HEAD(&maple_waitq); INIT_LIST_HEAD(&maple_sentq); @@ -849,6 +851,7 @@ static int __init maple_bus_init(void) if (!mdev[i]) { while (i-- > 0) maple_free_dev(mdev[i]); + retval = -ENOMEM; goto cleanup_cache; } baseunits[i] = mdev[i]; -- 2.22.0