From patchwork Thu Sep 12 19:03:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13802492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7D20FEEB59D for ; Thu, 12 Sep 2024 19:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hQMBpXmFrHu0lZBKkOWtMtzvpev+htAWAEEd8xjV15g=; b=JVpq+YNb4JEWFypAGfvTCif2F0 Zl0BUbHHc1u97NiN0dOnHn1/h9O3IzoaBNnO92s/sU2All/ukLz/tInS7Q7qJthiCQyuXH2IyT2DV Eqx/2BuwJS99w86Bc9/U6kikkvBlP/F2I1JaXzU+ID7cs+PtvQ7gAvlivrp9bu2tixPD7w8SzwLrs uLyNYkoq/cEQOAeruX4tGFoKJAB2Br2zSMR/tP0CpUuBiPn62B2Ua9Bxr+D4L/7niTYqARlN1hC2o u2XVQpt4sOuDFYLDus58EWMwJ5v/QJ9dKYkWxnh56fnj3pV16o/YWs7GqKkoYofgX4eclzxTCzqWS q2eRL/6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sop8s-0000000E0C3-3mLy; Thu, 12 Sep 2024 19:06:10 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sop6f-0000000DzYh-39d2 for linux-arm-kernel@lists.infradead.org; Thu, 12 Sep 2024 19:03:54 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e1ce98dcafaso351633276.0 for ; Thu, 12 Sep 2024 12:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1726167832; x=1726772632; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=hQMBpXmFrHu0lZBKkOWtMtzvpev+htAWAEEd8xjV15g=; b=V39hRZ+a5ckQd97dkXsevIx29139NtGDoOxmATKGcLX/gynUkAsy1jCOzKosHT+H0F 98fjBZNEy5X/2Dx2DJRMgmGyxVtSam66gqADKx4DteIjLbi1n4tKUIdYDNhih2cxtpC8 3MkZhBd1DBQxSQqOQHsuzo3rRsVbr9rsXbPbng4KRGmrbr1c/dA4O0axGY9kusMYm8U/ gVRGuTJetmyVC+8UVYP3Yx95zlwir6UJHKLicrhIH/nVPOOBiQ/yyZ9H0YUPdz+UQfmh v6hJtFW6Ujwz8652lc7joP9NVQaXXmSvEoSFa4aHiH+SuyMvGkMLT41NQraWdYgz2xzd jbqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726167832; x=1726772632; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hQMBpXmFrHu0lZBKkOWtMtzvpev+htAWAEEd8xjV15g=; b=W3Y10JTzAImeCNl4CgKDIGJ6veThmkNJZw4+tIOnp3Qs2dd1YQ3UTebmV/v7xa5Zfp MsQvkidxiw0aUfqARMjam+8QBBXZNYv0xzK53vmNSMFmXpgD6wsamF5ymV9HI9avga1E 1RV/3SJ3YKJTkiVN40IaFO5qAvklxuBtilvEFN64C536uwJrAsko5BDJ3X37IaeXIm7P RscLje2kJvd7iBipYMXp5kyk9oawW8o7+e4jg0KSmXO/cNnVlan+On80SgZLJdCwzYaJ r2/NRQTCFOjA/chjgMEmOyRb65kjBGXI1Rs0Z6hP8i/eFvCFa3tRB23bD2jQgZMiqoQ3 sVwg== X-Forwarded-Encrypted: i=1; AJvYcCVpmRy11Db7n73O2L3vYUmrtv/oTpJblTaVe5GrZZplJ+GaqzZ50W78iDlYV7RiPQanrh87hu3GWgI2K+ugMLdm@lists.infradead.org X-Gm-Message-State: AOJu0YxQoLWn25wPzr+ILs0gx+QEyiX8VsLdtrGKLHXlVONpqlLjbLrn 7td36OrnV2gQT5qZHz8a9DWXxZ3Yjf6JfHDEwduj+w+j5kDRo+f/O3rEn72loXxoWT/UIvm5NBr tgq9LXg== X-Google-Smtp-Source: AGHT+IGZL/HvVahdSTWcK3oVoLbA+pDzQ5l89m9u+mrgImC94FUUrwM2wgkmYZVeutyA7IjYNfBdE82i96qy X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:cf0e:7a99:e672:3862]) (user=irogers job=sendgmr) by 2002:a25:dc4e:0:b0:e0b:a2a7:df77 with SMTP id 3f1490d57ef6-e1daff5b91emr387276.2.1726167832049; Thu, 12 Sep 2024 12:03:52 -0700 (PDT) Date: Thu, 12 Sep 2024 12:03:28 -0700 In-Reply-To: <20240912190341.919229-1-irogers@google.com> Message-Id: <20240912190341.919229-2-irogers@google.com> Mime-Version: 1.0 References: <20240912190341.919229-1-irogers@google.com> X-Mailer: git-send-email 2.46.0.662.g92d0881bb0-goog Subject: [PATCH v2 01/13] perf pmu: Simplify an asprintf error message From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Ravi Bangoria , Weilin Wang , Jing Zhang , Xu Yang , Sandipan Das , Benjamin Gray , Athira Jajeev , Howard Chu , Dominique Martinet , Yang Jihong , Colin Ian King , Veronika Molnarova , "Dr. David Alan Gilbert" , Oliver Upton , Changbin Du , Ze Gao , Andi Kleen , " =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= " , Sun Haiyong , Junhao He , Tiezhu Yang , Yicong Yang , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240912_120353_815856_6079BD77 X-CRM114-Status: GOOD ( 14.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use ifs rather than ?: to avoid a large compound statement. Signed-off-by: Ian Rogers --- tools/perf/util/pmu.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 61bdda01a05a..779db2ac06f0 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1466,13 +1466,12 @@ static int pmu_config_term(const struct perf_pmu *pmu, if (err) { char *err_str; - parse_events_error__handle(err, term->err_val, - asprintf(&err_str, - "value too big for format (%s), maximum is %llu", - format->name, (unsigned long long)max_val) < 0 - ? strdup("value too big for format") - : err_str, - NULL); + if (asprintf(&err_str, + "value too big for format (%s), maximum is %llu", + format->name, (unsigned long long)max_val) < 0) { + err_str = strdup("value too big for format"); + } + parse_events_error__handle(err, term->err_val, err_str, /*help=*/NULL); return -EINVAL; } /*