From patchwork Sat Oct 22 07:19:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090374wrr; Sat, 22 Oct 2022 00:46:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cW9Nm/EaAZbL4GpssQgNZ7kvGz7qOVn91MsUpqZEHyc4DpCflcmE3Jx5OyNHnN8v54Oe9 X-Received: by 2002:a17:903:3293:b0:186:867b:e24 with SMTP id jh19-20020a170903329300b00186867b0e24mr4075284plb.127.1666424809163; Sat, 22 Oct 2022 00:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424809; cv=none; d=google.com; s=arc-20160816; b=iO9ecWMq5pUTWg6B5Uq+OqMi86g7WJHJ1sO1fKV4LnvaZ0dE4I9wu0/fHrUmqB4fvx aZ9ybUXEU8RJo6zgWhPGgNYRWnL8yt8Karqas0CtBMX4O3riuqPqWRsX1bj8Jvl1KSZ7 GkXXUo3jqtyLgCHn3qtHB2kGcAdr+aN+ac91jQv29oYM2gkBs9ge34nTvcTrXXUpVrzP Iy3Zf1i+9W+x+VFVxkt5rqvUUWaxf31f7RAzE/pkYwICJnAQUTuE2mclRGJO9Yv95tct u07/cPrGtQ/IinfvqdGHmLEJ0R+2ZpnXm5aBtBF491WM/3dhEobNuA8mtD8JtKBzCPNI NIpg== 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=Akd9vC8Z1GVOrOgHwQS8kCrhgMHGummfyG+fmACWm6453NCU0LrDxB8yh88bKR029r 86rhnzaZQU/I+WFLXkrQ8ZJ4BVvsxDi6LRGh8Q8+jH6U6P1Z6/dbLIjzTKCy7yqkVkz1 F54f+5scEl1ynClwtR8IbLU/lIqY+BnUWz7A0d3NyakMURHv6f6qgHGQspsRLq0gcl1r 3bvnp7KsURqUuNAFdnKDIwr9f1Uh+iL8LLhPUYojA98R/Jd3x6n6yjBeiRSx//iygjml UcHS2FeBDgwvzI233zt162Ndql5I45VLW2T9TogAv3zvq3hL2vLM7G+OPyheZgakk0LD afeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=obv6sulY; 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 il11-20020a17090b164b00b001fb3040753fsi10706995pjb.64.2022.10.22.00.46.36; Sat, 22 Oct 2022 00:46:49 -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=obv6sulY; 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 S231444AbiJVHqT (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbiJVHoS (ORCPT ); Sat, 22 Oct 2022 03:44:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0726B62A5B; Sat, 22 Oct 2022 00:42:32 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 5DFD260AC3; Sat, 22 Oct 2022 07:38:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FE8BC433C1; Sat, 22 Oct 2022 07:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424302; bh=oIZz2kCGl4WXF7IUGUkjXWSCBViv/dAcbheVseTAqUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=obv6sulYRd84kOP2RIHSxLZo/D3VnsTHW6/hVVhD4BuxSqECPrvJVzZJbQCkTLo5m dS/D8JHiDrweiy2YX7TTT38710MUzIixD+FgKboGQlvqDG0fBxgvhngdbZtKBt68OV Ch+iTi0sh+mernHMA3rpoczfxPBF9A8lkbNS5T4A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 5.19 094/717] slimbus: qcom-ngd: cleanup in probe error path Date: Sat, 22 Oct 2022 09:19:33 +0200 Message-Id: <20221022072432.030870879@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373060539435646?= X-GMAIL-MSGID: =?utf-8?q?1747373060539435646?= 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)