Received: by 10.223.148.5 with SMTP id 5csp7468825wrq; Thu, 18 Jan 2018 06:00:07 -0800 (PST) X-Google-Smtp-Source: ACJfBovV04EIFRPQv2B0C2qT4BT2B7sfotbFaPsdeDggks9IFu2ZGThpTW9o3xk1JbJrER/YMC30 X-Received: by 10.101.76.193 with SMTP id n1mr3053579pgt.194.1516284007186; Thu, 18 Jan 2018 06:00:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516284007; cv=none; d=google.com; s=arc-20160816; b=iSy6nv/WRyVoa2HbhqyfJnOzRBpFo7oGXFzlo5elRZz+UxZ+aKGhzSLurLnN9TZKmG Y/FjUvbadpW2R6FHfKd90sa/ZbJGp4QuXOjLsRNwkkmbSJMXTzOwrhjBi0mfESsNq4RU cKakE2DwImh8tLPGW6bY0ZE6MDYPymylVL5/bKSzqYZEtRxf61eDSbm7p0CPf26JgtEv 83U2Zc5aAVCEON+KNCFMEWI9EWmfy+hvE6s8wcD3ToN1DbeXAuPBFeOXOwkPIt/9PSk+ Zw5vMJTMvHTUSgBD0zzcy8XSFKnPQlZle8GpdsvhKnIU/XL/MIm1UAMHjVsQMAx3piaW xAbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:arc-authentication-results; bh=LnUoM0HCdyJGdGduT7Whmhd7P5sdbsaKALicx3E+UIA=; b=VKvlrKTCAbu5B6aZLmZX2qX3OiwoceAL7H8wZm9j+nosvvMdYxK+tOff57LMVfiW1I mmuogTy+7MWpS1AZ624dQgqN5bzh94RqmuyVNcJYyu41sbFOEdgZffd9P9UPB5JMmjM7 4rKygt7f4EfYHg8t1eCcKGXG0WwPDTSF40dUjPZN3XXrlWUd1b3LWcXZWnBwj1eVm462 +JVhbal0EApMfkXZYa98nMPMZFqwJGcXLvtm0UvBgf4E90D4KtH6CTx+BKFaBVjEoP+2 eavlfB1mGvRoi0KYqQIAPSISFn9ukCF4oRepSEKR8pmqxXTwDkeY1BX5GWOWBYmPGh4b F+sQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68si6732100pff.213.2018.01.18.05.59.53; Thu, 18 Jan 2018 06:00:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756406AbeARN66 (ORCPT + 99 others); Thu, 18 Jan 2018 08:58:58 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:46897 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1756185AbeARN64 (ORCPT ); Thu, 18 Jan 2018 08:58:56 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id F327E48D5E2B0; Thu, 18 Jan 2018 21:58:41 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.361.1; Thu, 18 Jan 2018 21:58:32 +0800 From: Wei Yongjun To: Artem Bityutskiy , Richard Weinberger , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Cyrille Pitchen CC: Wei Yongjun , , , Subject: [PATCH -next] mtd: ubi: wl: Fix error return code in ubi_wl_init() Date: Thu, 18 Jan 2018 14:05:05 +0000 Message-ID: <1516284305-82544-1-git-send-email-weiyongjun1@huawei.com> X-Mailer: git-send-email 1.8.3.1 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix to return error code -ENOMEM from the kmem_cache_alloc() error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun --- drivers/mtd/ubi/wl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 77ab49f..2052a64 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -1617,8 +1617,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai) cond_resched(); e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL); - if (!e) + if (!e) { + err = -ENOMEM; goto out_free; + } e->pnum = aeb->pnum; e->ec = aeb->ec; @@ -1637,8 +1639,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai) cond_resched(); e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL); - if (!e) + if (!e) { + err = -ENOMEM; goto out_free; + } e->pnum = aeb->pnum; e->ec = aeb->ec;