Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp227658lqb; Tue, 28 May 2024 13:50:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrXGcLo0Pda+Q7KLtjsYSXHDVetOg0WtD/u+JIYN1kTg2t2qPhLTYCOdj5+mH+xssWANNGEIZmkgSdA2RqAte3anhjw0TpRhqVZGPzhw== X-Google-Smtp-Source: AGHT+IFzn451K4hPJ9CSW1S+nwzJFQJKdN/n7mefx8X58CJUG4zLpW7WRRDbrGAr3sz0lnj4KHB6 X-Received: by 2002:a05:6402:214e:b0:578:63b0:5821 with SMTP id 4fb4d7f45d1cf-57863b05904mr7036437a12.25.1716929415043; Tue, 28 May 2024 13:50:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716929415; cv=pass; d=google.com; s=arc-20160816; b=WUQoh0CWmGLIhwmUO2JmH8lgswe9IGylwy6SqvBwgHf0hlfPYS+2xScRCaWoNGI781 2hS2Qz87qR/6Kk5GUPaD9LlzUyhsu6oNXLe14pO9tTrrP311kyuMw0OApLQd1gpHGHMp 95jQG7lL2ZsS06n/O4arhCC/XTNy/ZAeAlj9aJeGnfqICoSMN1vqQoMLfR/V2M4Y9XiF G+MmjxkyTg8mMpuotsEJB5Rcp4yK5dTzAzIvfzxzZLkDB7lgq8P6HLXSa1yLg/74Dhy1 j+prp59FV5zkblPmyzSkWKal4oakBB/v6Nd2OmLed8EMfOsaQ+IAAtoSMnKzrvfoyMCB m0zA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=Hpk5WF3fBlOFgzw+1dpUyIelI8tfyqNS40822E06XGM=; fh=VE5ZfoJWem8it6OrnlM5ov49ej/hHjarqyIgnpICDoo=; b=F9dr3q9MkY1/ICU6sG3Ih5MxmRqzap7/OvqWITQ4oetX8BIPg6chiRYNDQdDZTrzJy 0lu0IgGt/LyJ+blZTzP5JAk68DPzjOmypXo4J7hS9iLe9S4RFv6sNKtQCHu24ne0HQ2M TwvU4489HLbWRTWCE/DiTw+YAODPSZu9OBJoaBTFwArcccKNbv1IlS9xaSIEC63iSmEj lDWbhNoT4SL/7yZUpgxsSmkedGhXR6OsbS1IMX7eKOeDDHZ7jSpEgGPXQSNYk6iG2Ouh vuc21QMbH+1ROM0GeURaEGZw3loQJb/AmqoV2zRW9tMY13ppmTIQvz/nnKoo1D1pA2dB wJjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=SZC3uMbY; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-193070-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193070-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-579c9424b26si3431947a12.28.2024.05.28.13.50.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 13:50:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193070-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=SZC3uMbY; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-193070-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193070-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B86301F21DF7 for ; Tue, 28 May 2024 20:50:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3262D17BB2C; Tue, 28 May 2024 20:49:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="SZC3uMbY" Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E6B671753; Tue, 28 May 2024 20:49:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716929363; cv=none; b=SHHoXR6YkyMrQnZFaujOMHCc3Zw3ZqEWQrn7cgNbRX/2BVE2fuI5rIHeD2CIjNjOb61xLLDuMvFInH2zb1ZbD93w5ea0W2WzycBx+lPNd4TAjz3X2JPujjL53+FTom9Uz1SiRia7u0FpGk/yE/dTPFN4SsBca64EbyLGhFij3QI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716929363; c=relaxed/simple; bh=cd/SbaQnWmAq08MyAtXZ8t1qjAc7VyezJTSklhCEWbI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BFa1HAacjk033FiJXH94pIg+8SxfIMlWAQ/oUW3112wF8FVFvC03Wi/tojskG5AErvpTVtC3Ndv6sFAI6n4MLlhbQOa2FCEtnCKfb62ZLlOO73IcLNATQgwABEwKwpTxAiOEfTbmOSJqS4ZCc716Z94W1AztNMaSscuCEbILGDs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b=SZC3uMbY; arc=none smtp.client-ip=212.227.17.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1716929350; x=1717534150; i=w_armin@gmx.de; bh=Hpk5WF3fBlOFgzw+1dpUyIelI8tfyqNS40822E06XGM=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=SZC3uMbYBs6x5oiXHLHfM0iwLrzsRr8ZG8oMDaFhWIb5fiwokvvJeZ1w7auYSGDW BaexouWpjObywthVDMN9FExkOcJBFePrO+0JoNhNZQcr0VjBSeRH0pK5tL76kQnQS xZhAbroe69b2ja7m3rdo4qTofwCiyAQXfGLVXcv+J1xHig7vagH/keOdPamq86qJI S6Oiuuvm6B+FYpI+LhFqxyK8RPqFi9s6XF1c8bj6bPxk4iw1kJQEW8eujZGR1/Hxu EN5ilQwh3yUGcvVgjEC5n/5FDLlq9v8ySI3VKeB0y45BRYqpPAXyYSwb9Bbw15bsi gAlD6jsBKl7xq6xpcw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MTiTt-1s4c1r39tF-00QT5R; Tue, 28 May 2024 22:49:10 +0200 From: Armin Wolf To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] platform/x86: dell-smbios: Simplify error handling Date: Tue, 28 May 2024 22:49:03 +0200 Message-Id: <20240528204903.445546-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240528204903.445546-1-W_Armin@gmx.de> References: <20240528204903.445546-1-W_Armin@gmx.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:+UIIXA77L1iidDRteJr97oG5jSONXoEfxxwv8Sc7Sqyg2sOT6bK +CDe82mMUFq1flfWdR6Z9xrDhji4iQjLCvqsWVTIZ6HeLnlwnt9dZeZg7u91M8gJcznlcTS FTFDpSKNf9ZGho/2FoWVF1KI94FWINvg+yyNqR460N2rOo7TbvZsSYlez7Vhed/cMRZUjqC WvMTzTc2gXyyRtKlL0SYQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:FogjPxr2wa8=;hd8yRzrswIPSCQ+KJkOZU38R25L X0r3J75YxvTyvuzR7DBPYpf4umYmpAUhOjQW9i1FP8n5ROJ15+dlwgNbmrQT1qmqIvQrzVmGb LbBGj+P8coJdKZPLzZ0Xjyga3QoWBuVWcftz91pihotC3W9H0hfsolfjgJF4bGDFgc2JbbINS G4dUjziG1VHUQyBvU1BV4vbAOnlWMDTJuWNX44qzwZ1FWG8kftVQbSX0s6/hsSCyr0V6ll0uB zTzAerIaQF2j6qP+0VZz0ELzDRHlIdrGGuKBZkPIwLqtQK6BCPu5hBMnQwhyOCuaePQceiclP DWPb9PzWEVejZGJgql5TNivqGzRV0D7FtVM2enw23fML8NzBNNCrnoKEpOhaE824rjRijqBVy wq8sRinYJdjusXfRkdE8mpN+1fPc+K3jhVS4vwmAjpzVSKcqS/lYK1c7OGinToNQRheTvwTJ/ ZA0AtusQ5HQy1P+6+p3HOZemZ9hwtb0CWsn0uJ5mKE7ObNIRDijv4qOWHLQ1y3z6l52j516RT JR4tiAYdk5HMyM/bnrkm5DBLaGFiJ6fPGLBy1vMFAuW7YyZiajaa95xfjhSlzT+7piXe8sUsl uJV0LTgXNkW9Xxpoa8L7hITpRiHfXDEvo2Ur6hjC56PjczD0pcDeqfRkJw/0SusMFUBIAoIz0 X8gig856l0EqPWXDVEo9YjYuNWcdF0LOsS9OGogTu2P6ia/OFVDuBzvoxpQMyio746K37VH0i otjJn4yHQMzGtIAuVQAvPuf6jiUXeXqoq5oK9tEgduirzqF4bZvvPlf7M5uTzEfafwnBue4eb KkeQ2RwNmhv8aIWeZY9HAo12gwd7vQ4yV7uHsO4jjWjNA= When the allocation of value_name fails, the error handling code uses two gotos for error handling, which is not necessary. Simplify the error handling in this case by only using a single goto. Tested on a Dell Inspiron 3505. Signed-off-by: Armin Wolf =2D-- Changes since v1: - add patch =2D-- drivers/platform/x86/dell/dell-smbios-base.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/platform/x86/dell/dell-smbios-base.c b/drivers/platfo= rm/x86/dell/dell-smbios-base.c index 86b95206cb1b..b562ed99ec4e 100644 =2D-- a/drivers/platform/x86/dell/dell-smbios-base.c +++ b/drivers/platform/x86/dell/dell-smbios-base.c @@ -492,19 +492,16 @@ static int build_tokens_sysfs(struct platform_device= *dev) /* add value */ value_name =3D kasprintf(GFP_KERNEL, "%04x_value", da_tokens[i].tokenID); - if (value_name =3D=3D NULL) - goto loop_fail_create_value; + if (!value_name) { + kfree(location_name); + goto out_unwind_strings; + } sysfs_attr_init(&token_entries[i].value_attr.attr); token_entries[i].value_attr.attr.name =3D value_name; token_entries[i].value_attr.attr.mode =3D 0444; token_entries[i].value_attr.show =3D value_show; token_attrs[j++] =3D &token_entries[i].value_attr.attr; - continue; - -loop_fail_create_value: - kfree(location_name); - goto out_unwind_strings; } smbios_attribute_group.attrs =3D token_attrs; =2D- 2.39.2