Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1018665rwi; Wed, 19 Oct 2022 05:54:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43w59v+4YmsjolSFQJ65Pguvo8dVHMyypNGlRYg5gH4MZFMeT2DpZiCDaaE90iaZJkIO8U X-Received: by 2002:a17:906:ef8c:b0:78d:4a00:7c7b with SMTP id ze12-20020a170906ef8c00b0078d4a007c7bmr6815757ejb.187.1666184096465; Wed, 19 Oct 2022 05:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184096; cv=none; d=google.com; s=arc-20160816; b=eOqbaZYpxue2PxlkZ0A0CfbNgz/09WfO6kyNnn2+736xVo2qqlLREawJQc3DRQnXcq L5bMqimFRQwAa6HeSr/5Iz2GAbXzrpqsU8VvmTT1XxgEhh5dAZ39w7yL1vgEzZD19Hs0 g+cA8M4qGmINiLHcZGEaBeuDoCQ7kd4/q6+EeSDniPwKRDuPdvRh53v/b1CP6xtQRYaH Zl+vXB0Onmft9LsniSLU8875AR9ByyIoKQYnPAPjiwT0ejnDLrerEW823ruDSNwuEG4e d6iOLYahD+qjoa2oHoQ9kQEGpzAhJxaE/tIu+QNzrwvLJ7+kRUk3fNJa5g96xi9xZorm pvBQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020a056402520900b0045c9313faf7si16410892edd.353.2022.10.19.05.54.30; Wed, 19 Oct 2022 05:54:56 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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)