Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp732821ybc; Sat, 16 Nov 2019 07:45:12 -0800 (PST) X-Google-Smtp-Source: APXvYqyJym+XT9VomdX9YWZm2WW2ICQcenmfyqNCWy3BPY3uH7q3X7tElkIwYKB1P4qDjkLxkN6f X-Received: by 2002:a17:906:4dd5:: with SMTP id f21mr10569977ejw.203.1573919111884; Sat, 16 Nov 2019 07:45:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573919111; cv=none; d=google.com; s=arc-20160816; b=JRKbMhx8GZVVg3OMrC3b86prhF9nZ1d4K1IArhC++pKUPDiBO6Pu/iQR4m54lDCYnM idES++aGXk6LVEftPraw8LAFmjKpZls5HyG21qX83onG7lUqllUJtsyHzFVGPZYBOdqc 2l4emyJ+LdC76KouAi/9wWf4lTVz70CdxhO0sm5xWYKfd2BIhaCv3mB4hKQTZu39vp9y UjtvlzPS/vf2WEYHBk6hWraCt86ACviyJV14t7BpCPiJQoy/o5FGNDafE+1cA8+yiGxZ cRkibd5vEiYgN9gTI4CBDzoF5UUP7sf+T34wABo+t5egmOxwDvMVKLgSWRU2G1iOySe+ LVXg== 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=fNO5G4e0fhRcJ9vy3MqFX3lFT6c6JTi53Zxe/sm/4iM=; b=MpHCtJVkrXMk3v2hJaCFocnKuJKKl8weB74JfBefXIkszK4heGyr1kKFw1ioPX88FE YfqiilJchh6067dGfxT2LvxOX1YBWKnyuA0Ab7S+FzUhCBvW8Ka6ocCq+urLpjnN0tsJ CZtotP9km0xFd/o6WXu/DbQy3g090P50vteJ/VPqAv4EPt86aIIZBwO2mXuT+kXf2/xK wbd3bdCOrGjb5q+kHFXrJBSP/p6iaSr+AFH+5E1Cwt0VTZ5Z6XHF5hWP680LLkG7D+2i YneImgmfmS96UYUS9FTFCfgmq/RtgLJ1jt28ZxQAAvGnP7nSsEwaBZi6BaaGLAVZ41Oi cfBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KST8cLQv; 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 c9si8084027ejm.397.2019.11.16.07.44.46; Sat, 16 Nov 2019 07:45:11 -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=KST8cLQv; 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 S1728533AbfKPPm7 (ORCPT + 99 others); Sat, 16 Nov 2019 10:42:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:46626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfKPPmv (ORCPT ); Sat, 16 Nov 2019 10:42:51 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (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 2658620740; Sat, 16 Nov 2019 15:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573918970; bh=gjuzvXyhWRsXKjSOSgKr4qFWVX5/LvmJynn27rqTZCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KST8cLQvvEOeTaMOFk0K1Jy/FOLdYYZSfxSgNn+K3KO794RZa9ThxnmSlKoCeE+bR LSWu6d5ul6GgOhFtH4dYTkKhL0mxEHSRkAP5xFBuiPiNrxdtH2F6ywemPSbUk/4B7e uOrWAxcPirZOFuxr5jRBDCJfZpQC8L51Yolsv43A= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Thomas Richter , Hendrik Brueckner , Martin Schwidefsky , Sasha Levin , linux-s390@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 085/237] s390/perf: Return error when debug_register fails Date: Sat, 16 Nov 2019 10:38:40 -0500 Message-Id: <20191116154113.7417-85-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review 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: Thomas Richter [ Upstream commit ec0c0bb489727de0d4dca6a00be6970ab8a3b30a ] Return an error when the function debug_register() fails allocating the debug handle. Also remove the registered debug handle when the initialization fails later on. Signed-off-by: Thomas Richter Reviewed-by: Hendrik Brueckner Signed-off-by: Martin Schwidefsky Signed-off-by: Sasha Levin --- arch/s390/kernel/perf_cpum_sf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 44404836e9d11..df92c2af99b69 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c @@ -2045,14 +2045,17 @@ static int __init init_cpum_sampling_pmu(void) } sfdbg = debug_register(KMSG_COMPONENT, 2, 1, 80); - if (!sfdbg) + if (!sfdbg) { pr_err("Registering for s390dbf failed\n"); + return -ENOMEM; + } debug_register_view(sfdbg, &debug_sprintf_view); err = register_external_irq(EXT_IRQ_MEASURE_ALERT, cpumf_measurement_alert); if (err) { pr_cpumsf_err(RS_INIT_FAILURE_ALRT); + debug_unregister(sfdbg); goto out; } @@ -2061,6 +2064,7 @@ static int __init init_cpum_sampling_pmu(void) pr_cpumsf_err(RS_INIT_FAILURE_PERF); unregister_external_irq(EXT_IRQ_MEASURE_ALERT, cpumf_measurement_alert); + debug_unregister(sfdbg); goto out; } -- 2.20.1