From patchwork Wed Oct 19 08:23:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5345 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp295594wrs; Wed, 19 Oct 2022 05:26:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WevWT1S7UqRWD/tyZm1YqtPGrlujcGWdXtxjxy3lARJZT7Q9DTqjEw0yaclG3fDGFZZLI X-Received: by 2002:a17:906:9be2:b0:78d:957d:9efa with SMTP id de34-20020a1709069be200b0078d957d9efamr6417459ejc.411.1666182361220; Wed, 19 Oct 2022 05:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182361; cv=none; d=google.com; s=arc-20160816; b=IUUZ0IYO3tAXydO4rJ9Ca1hClfJNgf0GgAcjcnNHdsWhkITnb76kwrEYVre8vA2kV7 0EoHLHLy7sfsJ7/Urfd5mnu9gHvepsCgeRMsGc3MlvxP//Bt2tv32P5eX1SCczx0SwFJ OG+ALRFJj2JUbia0RhF/nL7bBiwn3TKEZj6v1YTrXQQu8nPUCaGCF7t/bNkHyx5UhyT0 iHcRlE6CvcTQKhv2AURehrr8b134EZe9dlPudXhG5RL/nk7noi/axwbiQ4QuDrec1Eml vZjBrgijNEq8yrz0VXbl0Ghvnq13Xrqi6INhonKIqPFcU4bI9KG3RsEj0MbRlf+mjjzc NLiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WaELeuUaIETpvupQo2MMCFvLN6d3Wv7/9CW3249WKas=; b=HlHMgwizz5QT2oWXkphukZF0sFuXHaJGgKEdVU15J2LN+l9hFk1Cy7ciKMEthNChwn O+oK82XDMvsR+CFFY/+b5ZRp9jInnpQct+DPBRE4PKAbGOf6NYcwgZ2FnxUsVgN9sdL3 CEHLSu3rSsXM+7mH87lFhezune2kW7hYfL9D9tY76Yxe6wEqX8KlJrFeQ18BYvhAMH9Q sib8AiEm80l4pxLN/c0zBgq3CjOv0FXauRQvl+5DN/21KyL8worj4XqtGLiMKVjU5xXG 5mBPDBFqQTq9ixEUG9kgPZRlyNtSN1+Vnx9+XN077DLhvHLBo/oowQbqNkoPqXk5Uiac 4k8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HEn2ioHo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a12-20020aa7cf0c000000b0045698986b50si12651164edy.511.2022.10.19.05.25.35; Wed, 19 Oct 2022 05:26:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HEn2ioHo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232912AbiJSMQa (ORCPT + 99 others); Wed, 19 Oct 2022 08:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232873AbiJSMQA (ORCPT ); Wed, 19 Oct 2022 08:16:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E22A11455; Wed, 19 Oct 2022 04:52:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 50AB6B822E5; Wed, 19 Oct 2022 08:42:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A56F9C433D6; Wed, 19 Oct 2022 08:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168948; bh=oIZz2kCGl4WXF7IUGUkjXWSCBViv/dAcbheVseTAqUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HEn2ioHoQeXIGFsV/qWEOYys4+F9NhEOvJ/9ONmPcvSqvJ0bjbbkgMQ9IbnWxqA0/ hShvEHrI/YV6/sqXqF1UPc7wVcOUhpGfBlY7uGnbp6hs8U1dilWhrNCuPlhKzU+P/e HW13g7Hzlju8Dei+1WXfIuC7LskEW2pmbDiXSYRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 6.0 105/862] slimbus: qcom-ngd: cleanup in probe error path Date: Wed, 19 Oct 2022 10:23:12 +0200 Message-Id: <20221019083254.560695838@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747118835994039167?= X-GMAIL-MSGID: =?utf-8?q?1747118835994039167?= From: Krzysztof Kozlowski commit 16f14551d0df9e7cd283545d7d748829594d912f upstream. Add proper error path in probe() to cleanup resources previously acquired/allocated to fix warnings visible during probe deferral: notifier callback qcom_slim_ngd_ssr_notify already registered WARNING: CPU: 6 PID: 70 at kernel/notifier.c:28 notifier_chain_register+0x5c/0x90 Modules linked in: CPU: 6 PID: 70 Comm: kworker/u16:1 Not tainted 6.0.0-rc3-next-20220830 #380 Call trace: notifier_chain_register+0x5c/0x90 srcu_notifier_chain_register+0x44/0x90 qcom_register_ssr_notifier+0x38/0x4c qcom_slim_ngd_ctrl_probe+0xd8/0x400 platform_probe+0x6c/0xe0 really_probe+0xbc/0x2d4 __driver_probe_device+0x78/0xe0 driver_probe_device+0x3c/0x12c __device_attach_driver+0xb8/0x120 bus_for_each_drv+0x78/0xd0 __device_attach+0xa8/0x1c0 device_initial_probe+0x18/0x24 bus_probe_device+0xa0/0xac deferred_probe_work_func+0x88/0xc0 process_one_work+0x1d4/0x320 worker_thread+0x2cc/0x44c kthread+0x110/0x114 ret_from_fork+0x10/0x20 Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support") Cc: Signed-off-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220916122910.170730-3-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/slimbus/qcom-ngd-ctrl.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1576,18 +1576,27 @@ static int qcom_slim_ngd_ctrl_probe(stru ctrl->pdr = pdr_handle_alloc(slim_pd_status, ctrl); if (IS_ERR(ctrl->pdr)) { dev_err(dev, "Failed to init PDR handle\n"); - return PTR_ERR(ctrl->pdr); + ret = PTR_ERR(ctrl->pdr); + goto err_pdr_alloc; } pds = pdr_add_lookup(ctrl->pdr, "avs/audio", "msm/adsp/audio_pd"); if (IS_ERR(pds) && PTR_ERR(pds) != -EALREADY) { ret = PTR_ERR(pds); dev_err(dev, "pdr add lookup failed: %d\n", ret); - return ret; + goto err_pdr_lookup; } platform_driver_register(&qcom_slim_ngd_driver); return of_qcom_slim_ngd_register(dev, ctrl); + +err_pdr_alloc: + qcom_unregister_ssr_notifier(ctrl->notifier, &ctrl->nb); + +err_pdr_lookup: + pdr_handle_release(ctrl->pdr); + + return ret; } static int qcom_slim_ngd_ctrl_remove(struct platform_device *pdev)