From patchwork Tue Jun 11 18:58:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 166478 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2722373ilk; Tue, 11 Jun 2019 12:02:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9Lyj5TWFBItv+nAEnWabVyQNta5bjLmco0KfAbv7OgVEJDzxyxai7gjDl6XjXxui/J9IG X-Received: by 2002:a17:902:2869:: with SMTP id e96mr74569984plb.203.1560279753708; Tue, 11 Jun 2019 12:02:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560279753; cv=none; d=google.com; s=arc-20160816; b=hmuVSWpQ3hE3Z4d0R/WxWZMGiMsRBkCSs56iuKUbWeCV+C0RHrhJQd6f40EnDjZOn/ 8KYUZ9O+erzb/7AZNM6UQfjB1YLuIEBAIjNKMhePFZEFcr6tleISSv2MTfF45DwE4gtE hdMOOq8fZg4zVZ/fuFCoRmVo4KrJ34FBt/AqB1dvEpnXaWjHFkSBJoieXGPsmFjOfZCo Bau/jmPuA9LhMFt3ZHKDUSd6skKfyN8SB7hKVxyxpFYnQHHWZ7Vmf6EdqgzkdE88uBfa V+TD6NJb5ZJKVDpCTKpPfFBuVega5dJfOo5syVF8+gImeHD33kfh0wCDowL6JgIK49CO pR6Q== 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=gGHfFja/nVIoFRL/EOelXguBR4U0mXCRFidQuzzNOM0=; b=du+vhCLf0oUKu+B6sdhar2cgB8vR/FSddKjWE9nSVn7UrpIVX6UolNVXic69SwCeqk 97YGWB6pxfTLN1viLE0s1sv2w+ZJqYCUYutLYVfWk4I/WbTjBoJfAvC784n2VxEE8rQ2 ob5j0fQg+tC8j0sFFZ8Vz5sOSHaXgxBCpQD25MfgDB9+CQCk/B6SVm6U6d2y13j2L/9X ruRJ/gle2B2y5dkVzqHG2ZNQ3BAcqselo07k8/0yTg8nbDp20leCh4H6u+aaMJ2ycJUO VhGmHteWK2FYX/BtXnlku/4bzxbxF//V8lTJnSVQRh3M0DaC54XlG0xOmfQVOFBqBLD8 9Byg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ExMlfIt3; 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 a11si4077367pgb.408.2019.06.11.12.02.33; Tue, 11 Jun 2019 12:02:33 -0700 (PDT) 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=ExMlfIt3; 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 S2405220AbfFKTCc (ORCPT + 30 others); Tue, 11 Jun 2019 15:02:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:38702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391889AbfFKTCb (ORCPT ); Tue, 11 Jun 2019 15:02:31 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.35.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06306217D6; Tue, 11 Jun 2019 19:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560279750; bh=+3ubRWRo1wANoyVrgfncqjZE7VEfMBb3KeSEqdxH6rU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ExMlfIt3QoITULHe4q0+ptcJ+ndHcQu9C3zLHimFpdxh7BGdJHyqEPooj9wKCMfTD mSU4JfEUzw0Iq5/CNm7Na9tUVGmUdCzXO+WiwS6iYpMxSH++oAj+EAoABxSpBV9TFx +uLijHyRPLciFm4X93h5ZmM77g1J3nZVTzKOLl8g= From: Arnaldo Carvalho de Melo To: Ingo Molnar , Thomas Gleixner Cc: Jiri Olsa , Namhyung Kim , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Mathieu Poirier , Leo Yan , Alexander Shishkin , Jiri Olsa , Peter Zijlstra , Suzuki Poulouse , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 42/85] perf cs-etm: Refactor error path in cs_etm_decoder__new() Date: Tue, 11 Jun 2019 15:58:28 -0300 Message-Id: <20190611185911.11645-43-acme@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611185911.11645-1-acme@kernel.org> References: <20190611185911.11645-1-acme@kernel.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathieu Poirier There is no point in having two different error goto statement since the openCSD API to free a decoder handles NULL pointers. As such function cs_etm_decoder__free() can be called to deal with all aspect of freeing decoder memory. Signed-off-by: Mathieu Poirier Tested-by: Leo Yan Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Suzuki Poulouse Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20190524173508.29044-7-mathieu.poirier@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index 39fe21e1cf93..5dafec421b0d 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -577,7 +577,7 @@ cs_etm_decoder__new(int num_cpu, struct cs_etm_decoder_params *d_params, /* init library print logging support */ ret = cs_etm_decoder__init_def_logger_printing(d_params, decoder); if (ret != 0) - goto err_free_decoder_tree; + goto err_free_decoder; /* init raw frame logging if required */ cs_etm_decoder__init_raw_frame_logging(d_params, decoder); @@ -587,15 +587,13 @@ cs_etm_decoder__new(int num_cpu, struct cs_etm_decoder_params *d_params, &t_params[i], decoder); if (ret != 0) - goto err_free_decoder_tree; + goto err_free_decoder; } return decoder; -err_free_decoder_tree: - ocsd_destroy_dcd_tree(decoder->dcd_tree); err_free_decoder: - free(decoder); + cs_etm_decoder__free(decoder); return NULL; }