Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2093441rwn; Fri, 16 Sep 2022 05:43:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53o4GXAq1gY7bgcpmWXUjt8mk/86Aw9Gz6ZdUe6vTdPyQwMGLRvmJiKRPCul/rvXzgFBJ2 X-Received: by 2002:a05:6402:298b:b0:44f:20a:2db2 with SMTP id eq11-20020a056402298b00b0044f020a2db2mr3880660edb.138.1663332204056; Fri, 16 Sep 2022 05:43:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663332204; cv=none; d=google.com; s=arc-20160816; b=ePlo0p02WA0PuOhoaWdonvs7XPcdmyDkeZMoB2yORIBPJ0pDfpW1pdxjDrVLZBX2A+ U1fFVqrEjjlwszWITCKLOSsPeN++MzRNhfn1mwphfj/LiMDjl/+MKyWMH3dWzpZd1BhX NxbzxjEcb1vl82PXTHB5UAJlwLJy8Xnek+hg0SGFDQ2p3gerSyAUGh6PJCoOcpwU/qvw UcZOqjMNOHFb6h0ChUVKnP07KROQtQMXkexozi5HGE2Mg0PfagAhx1BTeSkDTWcDf6mh 53Yk6khWpErzWOVfs6oOqPna4FmgEkB3jn2Pr/W3/XGd18kjRMXiiG1NglnS7R8VA/+M Ufzg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=I5+a1QqwYJyDVCXJAIa2b2pM30dX36e5vx2XWxYNEV0=; b=j7XIpLnedMGKZiOvIZimUZJDXJF/NAWTk4gfssiCQQzODctbT+0S/X7kffyQGyQwUE cJ9tGNXEAIR0tNQDbhYTvdizmaUv4F3RNGYkXdqPB0yzEJbRW9u6aTEdfEQlslFf0eF/ ER32NCcc+Q7uaaZosMOz1IhIfZqcAy8OqXZV+0ZwUa4hAIlm5KAISwPTlp4Q6RJxAVmf V6dG0ubTmOzgkdBjGyDhAmlE6j4Tk2ohpNHANsMj89+ts6EmejB7NbPik+tpOPtjpQ66 4WvrtUgbRVt17x7XvXe6wL7SX9u3rHptk+Pa+L/rsTyGqYSAxEKMiaB/uepwkfActd2L U1zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l8U22qeD; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020aa7cd41000000b0044e9f2b1df9si1983495edw.151.2022.09.16.05.42.57; Fri, 16 Sep 2022 05:43:24 -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=@linaro.org header.s=google header.b=l8U22qeD; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230182AbiIPM3t (ORCPT + 99 others); Fri, 16 Sep 2022 08:29:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbiIPM3k (ORCPT ); Fri, 16 Sep 2022 08:29:40 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CD6010FE for ; Fri, 16 Sep 2022 05:29:30 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id o20-20020a05600c4fd400b003b4a516c479so5258112wmq.1 for ; Fri, 16 Sep 2022 05:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=I5+a1QqwYJyDVCXJAIa2b2pM30dX36e5vx2XWxYNEV0=; b=l8U22qeDLoG6bQDYeGUJjpLo/DRhBjday95PJXEIzMSqXXXHiA4xaCoDfTzVfQ/CVq qU6Pfy8XwKvcfsHDCSNgrIGDB6AGGPCOlyRF0YLdG7VzRXkNcrn1B19w3xyKbupqRCS9 FPHhnbZGoW5HJbs0/yrFp670RaB9M1vUXHmabImT3ZeF+8Qkl8//PoktWo0AmIAOL0+0 VGUYCvJ+Aos7ipIj7453Q3y5srYvlMzTH0T75kw80aoiMuRuDc+SuhmeC+ruXEW8VOFi u9jk+gql0l/Dc0VZRkrHxYtIItiPFPUAXCsrJdbeHSwBWnho9W8e6Qy4c5vQOfeaB+V2 ZJ3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=I5+a1QqwYJyDVCXJAIa2b2pM30dX36e5vx2XWxYNEV0=; b=eilw6xMmk7HPyXySga5z98HsZuOG7Ig5p2ITVF6a40U6sgtuc9PCEorUHXarAKT5O+ vRUWNsGq5vSlWYt9ilHBfxfh3CURGvdpH5R3Yv8CFLo2hnQj6MPJlDkm8IIH8iVV8Yfs Vd+OkhsN2Y7ziuJ9zPoTJnBQH8Navt1zB6b3WovdSUPCpdqaa3sg7OF579Auosq+/ARz AFTZUVYjTWuh3sZ1NM2owJ7Z33H4Xdcpb/PT/BaW10YWEql9e2yeAfg+qAA2KjXgrPus 8Z1fnY8X4iyKz21Vx8kBey2VOjaK4kl2mkedJ0E106hXMtQ9XqaQxSRWLgvROjz6Jeaj W5Pw== X-Gm-Message-State: ACrzQf03FjfAiB0W6bfApEayxKgdVXInPJS5mhMTZ9cOg7yW8GzJ28qr XtYvCd1tZmFagJpMNkatnOUxTA== X-Received: by 2002:a05:600c:4ec8:b0:3b4:bdc6:9b3d with SMTP id g8-20020a05600c4ec800b003b4bdc69b3dmr1876174wmq.181.1663331368894; Fri, 16 Sep 2022 05:29:28 -0700 (PDT) Received: from srini-hackbase.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id m188-20020a1c26c5000000b003b4a68645e9sm1990825wmm.34.2022.09.16.05.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 05:29:28 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Krzysztof Kozlowski , stable@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH 2/4] slimbus: qcom-ngd: cleanup in probe error path Date: Fri, 16 Sep 2022 13:29:08 +0100 Message-Id: <20220916122910.170730-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220916122910.170730-1-srinivas.kandagatla@linaro.org> References: <20220916122910.170730-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 From: Krzysztof Kozlowski 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 Cc: Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/qcom-ngd-ctrl.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index f4f330b9fa72..bacc6af1d51e 100644 --- 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(struct platform_device *pdev) 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) -- 2.25.1