From patchwork Tue Apr 28 13:50:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 11514739 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 32A1414DD for ; Tue, 28 Apr 2020 13:49:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF8B9206B9 for ; Tue, 28 Apr 2020 13:49:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KTybrHFn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF8B9206B9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=0doKENOYA7WugFNThjfGW4WxiiEgKRNs1Kfy139MPDI=; b=KTybrHFnB1M3dr yKucFh7Av6+HY1CGdSTukfaC/eCArt0/DhP5cnUeMf22Zjdr2dgtqTgeCWTpVMt6p42KdKVv38YoR E72YyttDMNPffeOdJIStW9c8XTDlIkielkCq7RE+Vs+kKE0v9G3T1KkWM9hqOsLIfEuLa0Wj8l93x F8exg+L0Y+kDHq6OW93Wdb2MqmpRBqu897A8Qe4kPsbQR3BBT5qvPDcVWEIK/KY7DWfov2zYb9VtM NkW8q57JbtgkbMvcGHKa5Nir6WXgx/bDWciUbDrcoQVtaiygZSXk6UyJtgYK1XKXMJ0rua0urK9FH TcBkHzb3BRoNnGBnA8PA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jTQbw-0003Wj-GB; Tue, 28 Apr 2020 13:49:20 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jTQbu-0003Tg-0b for linux-arm-kernel@lists.infradead.org; Tue, 28 Apr 2020 13:49:19 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1C32781411DE4945C840; Tue, 28 Apr 2020 21:49:09 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Tue, 28 Apr 2020 21:49:02 +0800 From: Wei Yongjun To: Alexander Shishkin , Maxime Coquelin , Alexandre Torgue Subject: [PATCH -next] stm class: dummy_stm: fix error return code in dummy_stm_init() Date: Tue, 28 Apr 2020 13:50:19 +0000 Message-ID: <20200428135019.78920-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200428_064918_226607_C5BBC522 X-CRM114-Status: GOOD ( 10.97 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.35 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, Wei Yongjun , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Fix to return error code -ENOMEM from the error handling case instead of 0(ret can be overwritted to 0 in for loop). Signed-off-by: Wei Yongjun --- drivers/hwtracing/stm/dummy_stm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/stm/dummy_stm.c b/drivers/hwtracing/stm/dummy_stm.c index 38528ffdc0b3..36d32e7afb35 100644 --- a/drivers/hwtracing/stm/dummy_stm.c +++ b/drivers/hwtracing/stm/dummy_stm.c @@ -68,7 +68,7 @@ static int dummy_stm_link(struct stm_data *data, unsigned int master, static int dummy_stm_init(void) { - int i, ret = -ENOMEM; + int i, ret; if (nr_dummies < 0 || nr_dummies > DUMMY_STM_MAX) return -EINVAL; @@ -80,8 +80,10 @@ static int dummy_stm_init(void) for (i = 0; i < nr_dummies; i++) { dummy_stm[i].name = kasprintf(GFP_KERNEL, "dummy_stm.%d", i); - if (!dummy_stm[i].name) + if (!dummy_stm[i].name) { + ret = -ENOMEM; goto fail_unregister; + } dummy_stm[i].sw_start = master_min; dummy_stm[i].sw_end = master_max;