Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3699680imu; Mon, 28 Jan 2019 09:15:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN6eODL0RoopTL/L3+tpMKlAXoNEZBng/vbAxdM1vVsUHiFJjxMt9DQF53zk3omsKamV2YPi X-Received: by 2002:a17:902:5a5:: with SMTP id f34mr22634771plf.161.1548695710058; Mon, 28 Jan 2019 09:15:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695710; cv=none; d=google.com; s=arc-20160816; b=B8K5CZYzMxQiiu8mTQ6elCc1NVIelz8U9LPyyJIycJK5QGo85kCnnjZgyctFljBuAJ nZAqwIY0j89Eu159qhQfGrp5O8azhHsGvV4/PgRalg+AFGLlPWJ1FKUtHV81vTdwXOiA jm+lncw69K4ZgCDlbr93pSrgxSJ85h4ofBag3Cd6vuijUaPE/X0XnydRwEoEnjFcBfv2 NS/7ZokNL42Im27msAD9wWq+Cf+j5KxPYhaCjmgMM8btWfGNjZm4kHvmZ3GTEfUoQomK +djUUUeLemWBgw+Kr35qFY/4YS5q7y2vkQSXmY8MxLnnO96Jg8x5Ap6b2kc490bocUDb Agkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dPR6FMj/0cUTX2Y+aEDw5OpC6fXKZFfM2IktVQb5cMY=; b=0L2xbzSyM5rHOiJmXSqR19wQt4mLtqOawB4DBcPh3OWHCZbi+Wizo1GwJdJsRuUHKV 7d7hgDUBHgGLYQx4k5slnNoJ+rR140UAAWgycBGHP1PmSv+SMAJxc4KsyUT3YBMoEBuU ZrFh7GzfWM5BBFBOcB+LLOcAokK9sD+iFNac9TJfm9Xuk5CxS5j9dc42YowXvTnt1KwJ XYXDzbzkbNIK73pxZKkyF783kjAa/pE8QqgDBh1Y/lP+IaLMZIAb2fn3PXSDHKB2QKp4 91dTn5oK6GUxRzjQhHS3RG71l3ZDOqhxSNeo9PTcJ3Z8XdQwmHRv3zW9pWsevBPk/i72 m70A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Icdmjwy1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5si29819823pgq.434.2019.01.28.09.14.52; Mon, 28 Jan 2019 09:15:10 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Icdmjwy1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732401AbfA1ROo (ORCPT + 99 others); Mon, 28 Jan 2019 12:14:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:58132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731802AbfA1QH1 (ORCPT ); Mon, 28 Jan 2019 11:07:27 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ACE4820989; Mon, 28 Jan 2019 16:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691646; bh=9vapgpFrn6o4u+OBhlaTL4+Vb8wemnj2+fEbsFmsjBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Icdmjwy1wkOTwn2eeWDuIScbzWA6lh8/vV/e5BvaO0A9TuorL+VN7cTopkjgrXNNb QcodGaKrNOKo/hL2YopwjqQk7RS5JfJFAdScjO73n3ffWQmRaBZx++AQOZNgMmWc+8 hNUkHcWhK17xzk8Db89nXWnA17EibBcSC8XyQvMs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michael Mueller , Christian Borntraeger , Sasha Levin , linux-s390@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 172/258] KVM: s390: unregister debug feature on failing arch init Date: Mon, 28 Jan 2019 10:57:58 -0500 Message-Id: <20190128155924.51521-172-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Mueller [ Upstream commit 308c3e6673b012beecb96ef04cc65f4a0e7cdd99 ] Make sure the debug feature and its allocated resources get released upon unsuccessful architecture initialization. A related indication of the issue will be reported as kernel message. Signed-off-by: Michael Mueller Reviewed-by: Cornelia Huck Reviewed-by: Pierre Morel Reviewed-by: David Hildenbrand Message-Id: <20181130143215.69496-2-mimu@linux.ibm.com> Signed-off-by: Christian Borntraeger Signed-off-by: Sasha Levin --- arch/s390/kvm/kvm-s390.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index ac5da6b0b862..6aacb8d3dd9e 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -416,19 +416,30 @@ static void kvm_s390_cpu_feat_init(void) int kvm_arch_init(void *opaque) { + int rc; + kvm_s390_dbf = debug_register("kvm-trace", 32, 1, 7 * sizeof(long)); if (!kvm_s390_dbf) return -ENOMEM; if (debug_register_view(kvm_s390_dbf, &debug_sprintf_view)) { - debug_unregister(kvm_s390_dbf); - return -ENOMEM; + rc = -ENOMEM; + goto out_debug_unreg; } kvm_s390_cpu_feat_init(); /* Register floating interrupt controller interface. */ - return kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC); + rc = kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC); + if (rc) { + pr_err("Failed to register FLIC rc=%d\n", rc); + goto out_debug_unreg; + } + return 0; + +out_debug_unreg: + debug_unregister(kvm_s390_dbf); + return rc; } void kvm_arch_exit(void) -- 2.19.1