From patchwork Tue Aug 30 12:13:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 601913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E55A6ECAAD4 for ; Tue, 30 Aug 2022 12:14:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbiH3MOI (ORCPT ); Tue, 30 Aug 2022 08:14:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbiH3MOH (ORCPT ); Tue, 30 Aug 2022 08:14:07 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 691D0155A4E for ; Tue, 30 Aug 2022 05:14:05 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id by6so11137996ljb.11 for ; Tue, 30 Aug 2022 05:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=733lkI4nV8tAJya1OCGSDu4na04yzaOxs1WGC8a5e54=; b=lDRTcSWk7n5WQYwupr0VW1gI/QLldoWoLCFM2J685qNCJnlhBYp84BlmdPypYDBNo3 ouJRHsTrlaKAimiUYCJd+qaQ/TwoZ+f5yu50PoNDQJdBhrtNM6mXgmYnUXS7nLhbj44T MpvWAod1I18ESN43WrM1B/te/wjdPUxWXEFyxdUcMFaIXtH132GxxAago7aHQvXJe8gh JhfxoYsRPaG4ZZW1fJ6R9D8uCCs3sEkRncEFPzwv+K6fIpijn552jnYeSw8LnldYcbhF AK6IglZnjBtsb7493A9ttt2jRV3uqL81yUj/p+xTPFucIcU8c2MzP3O0FLZq1JaZtqd4 xImw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=733lkI4nV8tAJya1OCGSDu4na04yzaOxs1WGC8a5e54=; b=PbJ8Obx/hhUSGdCbrc1sXPQtJ+aGIwB/EDDmDBvFW2FdlB19lve675ImrNgAsAzv5t L+kd5K9K5OmK5pdQL4wuCvMdMsQNrtcg6V+pKz7z8bwdV8QpixWPT201npUc0hMFAZ8t pS2xja83oCm9sJ1WwVVhJyIw4Ls6vgBdFzmYyPJeUhC2KTq7W2XUm/kD9Ao+WEVWHvh8 xoyuUoG8pKOJClxKPqtbmUGATF7YlNkaWTsvt+RsKOXqokge4/i3Yq90OVcBA7jiWp+a doVRRuPQ1DnV/jxiZuYM2L2bmk5ohay506L3dWHLUrt+2YNk/O+ZnUhnebM/JV0abN/t hbWw== X-Gm-Message-State: ACgBeo15/snrIi2BCXhI3ZT051dTwYYLRs8t2+dX94OdScS0EwKtLt81 ks4mGosFN09Kp2xC0Rnp7MrhEw== X-Google-Smtp-Source: AA6agR6g5o6RyV4a/0s0Sj9o147r3+2K3usBGme+KNe+ujHurRQoMOnSOwQSwykKycjIsPgtrmQ2eQ== X-Received: by 2002:a2e:5005:0:b0:265:54e9:2b81 with SMTP id e5-20020a2e5005000000b0026554e92b81mr2514328ljb.309.1661861643670; Tue, 30 Aug 2022 05:14:03 -0700 (PDT) Received: from krzk-bin.. (balticom-73-99-134.balticom.lv. [109.73.99.134]) by smtp.gmail.com with ESMTPSA id e14-20020a2e984e000000b0025e57b40009sm1742436ljj.89.2022.08.30.05.14.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 05:14:03 -0700 (PDT) From: Krzysztof Kozlowski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH 1/3] slimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure Date: Tue, 30 Aug 2022 15:13:57 +0300 Message-Id: <20220830121359.634344-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use cprrect error code, instead of previous 'ret' value, when printing error from pdr_add_lookup() failure. Cc: Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support") Signed-off-by: Krzysztof Kozlowski --- drivers/slimbus/qcom-ngd-ctrl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index 0aa8408464ad..6fe6abb86061 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1581,6 +1581,7 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev) 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 PTR_ERR(pds); } From patchwork Tue Aug 30 12:13:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 601912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 188E7C0502C for ; Tue, 30 Aug 2022 12:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230284AbiH3MOK (ORCPT ); Tue, 30 Aug 2022 08:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230138AbiH3MOH (ORCPT ); Tue, 30 Aug 2022 08:14:07 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A27FF155A5C for ; Tue, 30 Aug 2022 05:14:06 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id bt10so15260480lfb.1 for ; Tue, 30 Aug 2022 05:14:06 -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; bh=oACP5OJ8E262bJyD/huCTI3+4w0pfeaLTzinloHqVMQ=; b=DmtvEIodMZpn1KTPg/BtyUYkVLXGbMytdn6Cys0esmT+9iQN0XAvFe42woLBW/vtBp ZS1w+ZFLCTH5EuI1uyUgA0d49DABrExr4Q2Q0klOa2D7g8C/pHUiq/OKTgRbbqguDN1D NCngdCsdD0KZCSIWIrET1AM4LV8HLExbZoxXgxG1+6NOaCFHmTnom4uVmGQJpskH5fJv nsvkMj/ScQUK6BKiye/dXX20Zu0TFdbUNO1AHhjektm683zwSI5abtOqnt7BC1Wq6VL0 qjmNzei4jAEl3Y8QMWf15lp97r3x9KkpHlCZYoMaaxz3tKJVq0WJbnukJYwOCFZxfAfr F1Dw== 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; bh=oACP5OJ8E262bJyD/huCTI3+4w0pfeaLTzinloHqVMQ=; b=cdFqNMgtfzrLuWClQOp4xEkzZKAhaMUtTJdTt7nRJLvKWmpEMaziynG5oTNl5g+e7C SmJ6cukfZoNH+65PjlLMZWZwZEO7M7ehVcQ9nfGgtfGKP47FzYgfyvAtiSwmD8eNlvWF JymvVUys9wjQNU1xc2kcYFw/G/PDO9gG8QIoB9JwSIDUkXsBEzpuRX/w2ArDkb8G4+KB 0rax9dhzRvywnXCpZfW3tEcsaYTL4vFMMOI38+k4G5xhtwWpZ+OP3ri/Yj9waIsYHKXo ZWV9fe4jDZ41QAoQBMAwUERR76qkZEDrz7aG8QUnAbED0KJb5jCXKqk4kCP6Ic+X70f8 PGIA== X-Gm-Message-State: ACgBeo009RQbZAEWvQTK13ZX92bNtGordzAv0F0+e5+b4GmzSoakqv4z pdH4D6chcuiNr6C4QneCHY4ZJw== X-Google-Smtp-Source: AA6agR5rB94QRjCCM1vUWb04bJnxTamAaZW4THRNYgKtwQvwdbklXgkZdG0aKFaLfkcqxqu5JMSPqg== X-Received: by 2002:a05:6512:38b2:b0:493:9a:ac2e with SMTP id o18-20020a05651238b200b00493009aac2emr7333228lft.126.1661861644793; Tue, 30 Aug 2022 05:14:04 -0700 (PDT) Received: from krzk-bin.. (balticom-73-99-134.balticom.lv. [109.73.99.134]) by smtp.gmail.com with ESMTPSA id e14-20020a2e984e000000b0025e57b40009sm1742436ljj.89.2022.08.30.05.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 05:14:04 -0700 (PDT) From: Krzysztof Kozlowski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH 2/3] slimbus: qcom-ngd: cleanup in probe error path Date: Tue, 30 Aug 2022 15:13:58 +0300 Message-Id: <20220830121359.634344-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220830121359.634344-1-krzysztof.kozlowski@linaro.org> References: <20220830121359.634344-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add proper error path in probe() to cleanup resources previously acquired/allocated: 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 --- 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 6fe6abb86061..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 PTR_ERR(pds); + 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) From patchwork Tue Aug 30 12:13:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 601121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D24C5ECAAA1 for ; Tue, 30 Aug 2022 12:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbiH3MOK (ORCPT ); Tue, 30 Aug 2022 08:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbiH3MOJ (ORCPT ); Tue, 30 Aug 2022 08:14:09 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB27C155A65 for ; Tue, 30 Aug 2022 05:14:07 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id z25so15253674lfr.2 for ; Tue, 30 Aug 2022 05:14:07 -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; bh=tV1opztXSWwn25vhDNpyv3M9Wuq0qcdEHDEQPaQUNQU=; b=gvk48BAuaZbx67DTS/zy27STTJa1CiM72il9+U1fi55xMqIncbK4p4JrASXirY19eg N/Gm1b8vrMghy3M9CEGIpeZIdjeII0fITiDQIxHegJ6adLTJalEcXIwEz1ep0Lzyj8Bt EhhlDX+Wf8lThwNTjR72qy07Yf+b/MG+At8XKN36V4NbIK++56lSnWgPr4p6b/xKWhP0 /atTQucHFtYyAKtZI3Vj3+vQeo2DQX/pSfKqrAUpYbByhkPYZnbTQlqUBNBxPUI0duks Mx2ElAbBpcsJ/wwnP9ktoyd2ogCeIe6TStsJpZhyxipvUgQIie/tl7pJZzcdLM5IBbnZ oDTw== 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; bh=tV1opztXSWwn25vhDNpyv3M9Wuq0qcdEHDEQPaQUNQU=; b=72oJk9NOV6OobhnvgMJgz1VjU5fmvyKuoYFEbi5uOzgVtcks2m+PKxEun4xgEkU1xa TgFD8ef/eY2XAqBn4s7MewZhjaDvRI8GTJI3Wa6dfaok1QDM5diooj9N7KLCvAfeGQHN /3y9evFIskYGRj2ul3nb0iELhifqkQhg0PQbtVt/KWomW10PPmoc0OoI3l0VQaoZrf2Y fRGWHtfYEoqzm0JRGbu48yZMjZeD6chszo+6RFrtLwg/tn36mgNU7if2SJJYp465wP5R rc3K/YvBALdzIWAEajEJrID41ZT3ozT9oJ33LqFfl1jWKBGYu/L6X4+Ez1h87YgtWMoG w3zQ== X-Gm-Message-State: ACgBeo2SgV1MgMZB7dgsKYAfnWZJQsDfpBLxs97L2MBEw+FwcxLujdaX lJDftNdUNm+o58OMqUzVwm8SPA== X-Google-Smtp-Source: AA6agR4WYnjWeLAeGRO6Z3iE3KEFyNKY3aDbcTKotgzRbCAOOWTHqUA6Ic12LhVaqAs8aXNrydO8cg== X-Received: by 2002:ac2:4c48:0:b0:494:6dc8:3a91 with SMTP id o8-20020ac24c48000000b004946dc83a91mr2388200lfk.280.1661861646093; Tue, 30 Aug 2022 05:14:06 -0700 (PDT) Received: from krzk-bin.. (balticom-73-99-134.balticom.lv. [109.73.99.134]) by smtp.gmail.com with ESMTPSA id e14-20020a2e984e000000b0025e57b40009sm1742436ljj.89.2022.08.30.05.14.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 05:14:05 -0700 (PDT) From: Krzysztof Kozlowski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 3/3] slimbus: qcom-ngd: simplify error paths with dev_err_probe Date: Tue, 30 Aug 2022 15:13:59 +0300 Message-Id: <20220830121359.634344-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220830121359.634344-1-krzysztof.kozlowski@linaro.org> References: <20220830121359.634344-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use dev_err_probe to skip printing of deferred probe errors and to simplify error paths. Signed-off-by: Krzysztof Kozlowski --- drivers/slimbus/qcom-ngd-ctrl.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index bacc6af1d51e..cec11aa106bf 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1543,10 +1543,8 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev) ret = devm_request_irq(dev, ret, qcom_slim_ngd_interrupt, IRQF_TRIGGER_HIGH, "slim-ngd", ctrl); - if (ret) { - dev_err(&pdev->dev, "request IRQ failed\n"); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, "request IRQ failed\n"); ctrl->nb.notifier_call = qcom_slim_ngd_ssr_notify; ctrl->notifier = qcom_register_ssr_notifier("lpass", &ctrl->nb); @@ -1575,15 +1573,14 @@ 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"); - ret = PTR_ERR(ctrl->pdr); + ret = dev_err_probe(dev, PTR_ERR(ctrl->pdr), + "Failed to init PDR handle\n"); 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); + ret = dev_err_probe(dev, PTR_ERR(pds), "pdr add lookup failed\n"); goto err_pdr_lookup; }