From patchwork Thu Apr 25 19:52:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 162885 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2364247jan; Thu, 25 Apr 2019 12:55:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2jj1PUBCSx/xSJzvrQhBPEC5qvrd1xTR/mRk0cYgZHwG4VEWRklG/UBk6hQxeruw9T3pp X-Received: by 2002:a17:902:f81:: with SMTP id 1mr41402862plz.216.1556222142682; Thu, 25 Apr 2019 12:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556222142; cv=none; d=google.com; s=arc-20160816; b=pkQdzBeatGJE2DWKiENxDSOMMVC/vQ6oMR/QxbCmKPhzbh0c+JQPbFuhieQMhBr8ZU yQoXUCfrqJPgELb7rL7aSKMsDVkH1OTt9TxSfGAFKK9SVWeRjyVjxnnvpGiF56JGb1Rk dD27TcdKfdVF0AB4zAtU+lHhzRmqmgZTnbX8mce67Uki3r23O0aVfewy4mbsHNBgtvEs TT8blvDjmbZhQMngivpzh815YISmN8JpG/MTQJsFKFcx49gzkAvyaG2aRNGnXpxjUhiy J35pYO9ZKOEUpV31jW0nFN5ryw7Hb9yDaoczF+GKNpsoh7hBt2x6OoT4rN7D6+lubqet 2Y0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=5yAsUfu+K0x94KW8zQO1OsJicC/LEblGvw0y+dUj4Gg=; b=Kn1svbBrbFzgvuhjeaL8MsSarc7V7Mzu6oXDfzTNMWZ0f1+uolhwCDMCS6zEntzImZ MWuZWpAHCLq1N3e6nTx30ar4iTR9w0gL8OAhdSoVt6AvmPhWtIwwFDTwj54KKLGVm+g9 elZRVWxZJlpySrfXsAg+/zDt3h0Ku3sdAgyCxQSFsJMXLfyAlsMMzjUW0Fl4mMl/4SNH 5eCWHivMwkqRbmZ1/88xtV1JCmb+ZnwKn3STB92wQ3F5GvMaR4WdVug/znX7ntJeTqk6 T9dBPhEBLbOGYEy2KN+tCsxOdgBulvFwapDT5DPQmWW5zdiUeZqlhcRYCc1f+0tnggOZ cA4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DnXhnAXb; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m184si4673024pfb.166.2019.04.25.12.55.42; Thu, 25 Apr 2019 12:55:42 -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=@linaro.org header.s=google header.b=DnXhnAXb; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387688AbfDYTxZ (ORCPT + 30 others); Thu, 25 Apr 2019 15:53:25 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34124 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387624AbfDYTxS (ORCPT ); Thu, 25 Apr 2019 15:53:18 -0400 Received: by mail-pg1-f195.google.com with SMTP id v12so380343pgq.1 for ; Thu, 25 Apr 2019 12:53:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5yAsUfu+K0x94KW8zQO1OsJicC/LEblGvw0y+dUj4Gg=; b=DnXhnAXbcovRu+0CGBkzzuPQh8eObKGQ/MdhX2PDaWFiTCyXJWeNBG4RJ8AzlgTaxr h7iAWDzE4abnil4zP6q3qsL0JqrtQ3J6pB7x8t0yRGQ677PO7czUL1Hdi3AmgK2jJM0D wtQLCvSnbU9A2DTxkt8Wymt8JQnInZvkgEP1Jqp9Lw9mLwUZ4idXPF9jIv70oildctTV uu1AbSPFKpNZYwN0Xt+1NZw+TLuR2ko9q3RI26Gw+d4vVPfzH1Ku6kXVpiR7yRw5C6+y v1/c40qGLX0ynv+tKaWspUoOKa1wuYOiPN/c9A/AickIMqAGpAdHj+ot/hUH7TRM/7PQ S1zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5yAsUfu+K0x94KW8zQO1OsJicC/LEblGvw0y+dUj4Gg=; b=W1zNeCn/3Z9Q7cTHIXY9GAMWNrKcgdWPBEm/ruYZTJ4q738x1UHz8O2Srlfvdioaip 69t52V2HwEEm45gmCaCXs+ywoqC5pjHMqTiVndmbBGMaNXRITWWTgCUbNhBBKfsXX5cH EBnvOjVj8l53ED0v4YsTm7xLPBJvlIIKJ9xTnMPRWP56gv2/2zIay5f9CYgReTjeYt2j nO+cA8aiwCJ4tJeb0GJehxiK/E1yQ2AT57Dz2Kai4CrgTdoOqGUr33hkndDONsWymIj8 1ekD0tJ2Ou5CkTox+O2BCBd19D/+Dbhw/C+eSot0d6GL1oPffE2N+FgXKYjvFGeCQ4FC IDoQ== X-Gm-Message-State: APjAAAWH612+J8DgumuDvtDkoSxCY6L2oYOR6vKXg7NENfn0CovEnJ1E bWZlqKaTZEHFfUCTUdaCKbhLPQ== X-Received: by 2002:a63:5715:: with SMTP id l21mr11462755pgb.279.1556221997713; Thu, 25 Apr 2019 12:53:17 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id t64sm47261961pfa.86.2019.04.25.12.53.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 12:53:17 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/32] coresight: dynamic-replicator: Clean up error handling Date: Thu, 25 Apr 2019 13:52:42 -0600 Message-Id: <20190425195310.31562-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190425195310.31562-1-mathieu.poirier@linaro.org> References: <20190425195310.31562-1-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose We fail to disable the clock in case of a failure during the probe. Clean this up. Also, we are supposed to drop the pm reference only when the probing is successful. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- .../coresight/coresight-dynamic-replicator.c | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/hwtracing/coresight/coresight-dynamic-replicator.c b/drivers/hwtracing/coresight/coresight-dynamic-replicator.c index 299667b887fc..fe176b987685 100644 --- a/drivers/hwtracing/coresight/coresight-dynamic-replicator.c +++ b/drivers/hwtracing/coresight/coresight-dynamic-replicator.c @@ -150,7 +150,7 @@ static const struct attribute_group *replicator_groups[] = { static int replicator_probe(struct amba_device *adev, const struct amba_id *id) { - int ret; + int ret = 0; struct device *dev = &adev->dev; struct resource *res = &adev->res; struct coresight_platform_data *pdata = NULL; @@ -180,12 +180,13 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) /* Validity for the resource is already checked by the AMBA core */ base = devm_ioremap_resource(dev, res); - if (IS_ERR(base)) - return PTR_ERR(base); + if (IS_ERR(base)) { + ret = PTR_ERR(base); + goto out_disable_clk; + } drvdata->base = base; dev_set_drvdata(dev, drvdata); - pm_runtime_put(&adev->dev); desc.type = CORESIGHT_DEV_TYPE_LINK; desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT; @@ -195,11 +196,18 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) desc.groups = replicator_groups; drvdata->csdev = coresight_register(&desc); - if (!IS_ERR(drvdata->csdev)) { - replicator_reset(drvdata); - return 0; + if (IS_ERR(drvdata->csdev)) { + ret = PTR_ERR(drvdata->csdev); + goto out_disable_clk; } - return PTR_ERR(drvdata->csdev); + + replicator_reset(drvdata); + pm_runtime_put(&adev->dev); + +out_disable_clk: + if (ret && !IS_ERR_OR_NULL(drvdata->atclk)) + clk_disable_unprepare(drvdata->atclk); + return ret; } #ifdef CONFIG_PM