Message ID | 5898403.lOV4Wx5bFT@g550jk |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2350419wrn; Tue, 24 Jan 2023 12:09:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXuJYvafiNksFdgqjTMMVKH0/pcd3rwAQaZ9eMuaVPFjWXe7DJcxqULBnU4RG+Ck9p5IcGkg X-Received: by 2002:aa7:c9ca:0:b0:49e:28c1:936c with SMTP id i10-20020aa7c9ca000000b0049e28c1936cmr29395042edt.26.1674590945892; Tue, 24 Jan 2023 12:09:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674590945; cv=none; d=google.com; s=arc-20160816; b=D3yRRMKWlrpRmclekPH8IVyhvZzNf+JHDn9S98Jf86MHb/WGOqCwEt7YUX93xHAJ5C BoSlIVfaLeHcVq5aiQ73BQ2F3VO69qlEi2ICqPnFh9OJ8iOERuIU4gVGwU+v1A6zQSvX Ask9AZGOBHC0YvC4U0QecR99fwgPbkxpudKz75MAu+oUlRyne+ilol3Vaz1Cxe9tKhaW ObR9fut/ZrIkPl30euK6qKecW+lNgbqXUuEMIl+mSFRgqIIpJuHSf0JUWbkCSexnAb2B VNsRRNBJVamSeklWh5TUd/bT+Bt6aK3ZyLLiO/ihQJVW8a1RJM9PGroXDuMWFgvuJ8ri t+Rw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=oL6u8zybjA4cv0f+ZOatcAxgwD6YOQaL2ruOPGyss/g=; b=wPwc+5Ah8C2ckTerz5vL0UkVpW7k+TTnVKuJW7H7b/TbYdik9ApUg42wiU5Wp6Ri+b u1J1wR9cCIyUaGcWZ3Wk/B9hMgUUTt0WWHDwfwzuJl8xiIjjJZzpVRg4Lnjo1xjTDgHL 5HYQS2ofpNI2YYRoOxIFYtmLW/v6Taj1C/GnEx5iD9gFGDkOQM/wDC5ldRWIamoA1PaW un2CdNlAnHK5rj4lP6ukIujY0wsBEiB/dh0B93XsZq5bXkHBOKB3a4KHMYX2Eg2dom/5 1WdmBNSvD3wORzeE8BLiHLPACiDQuWmeCs1y1+fv5rtnU56Khx4dJUz1CU9B1BzPkv27 lgmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@z3ntu.xyz header.s=z3ntu header.b=BcxgQslt; 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=fail (p=NONE sp=NONE dis=NONE) header.from=z3ntu.xyz Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ck6-20020a0564021c0600b0049e708f0425si4136974edb.232.2023.01.24.12.08.31; Tue, 24 Jan 2023 12:09:05 -0800 (PST) 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=fail header.i=@z3ntu.xyz header.s=z3ntu header.b=BcxgQslt; 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=fail (p=NONE sp=NONE dis=NONE) header.from=z3ntu.xyz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233854AbjAXUDF (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Tue, 24 Jan 2023 15:03:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233542AbjAXUDE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 24 Jan 2023 15:03:04 -0500 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29F4E2ED75; Tue, 24 Jan 2023 12:03:03 -0800 (PST) Received: from g550jk.localnet (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 321EBCD51C; Tue, 24 Jan 2023 20:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=z3ntu.xyz; s=z3ntu; t=1674590551; bh=Y5e5JN3qUUr0oJYCMxQ/apdya4a1W97ae9pxk72RoDI=; h=From:To:Cc:Subject:Date; b=BcxgQslthYIeiZ437FZvgmeAZKwFjL4wo6oNO+BAbLAON/WDxviFSJd7XIerE7kwy Oy1bG3xxGeJd3FTXaVb03GmMJM8/VSRYpjld4ybZD/TByFqzLmaprNHOBWHHDTxefa Ao5sAetOY+IuWCJvhnTp2ZvrFWKvYxOrURaWckdo= From: Luca Weiss <luca@z3ntu.xyz> To: Todor Tomov <todor.too@gmail.com>, Robert Foss <robert.foss@linaro.org> Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: camss: Missing cleanup on probe error Date: Tue, 24 Jan 2023 21:02:30 +0100 Message-ID: <5898403.lOV4Wx5bFT@g550jk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP,SPF_HELO_NONE,SPF_PASS,T_PDS_OTHER_BAD_TLD autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755935875999060584?= X-GMAIL-MSGID: =?utf-8?q?1755935875999060584?= |
Series |
camss: Missing cleanup on probe error
|
|
Commit Message
Luca Weiss
Jan. 24, 2023, 8:02 p.m. UTC
Hi all, I hit an issue that was already fixed with upstream commit 3d658980e6da ("media: camss: Do not attach an already attached power domain on MSM8916 platform") but this showed that some error handling is missing in camss_probe. After these errors the resources aren't cleaned up and e.g. sensor drivers still try to probe but fail quite badly because some things are NULL or whatever. [ 1.979098] qcom-camss fda0ac00.camss: Failed to configure power domains: -17 [ 1.989327] qcom-camss: probe of fda0ac00.camss failed with error -17 The commit causing this (or at least part of this) is 2f6f8af67203 ("media: camss: Refactor VFE power domain toggling") I tried a bit to add some error handling but in this case it now fails at v4l2_device_unregister_subdev -> media_device_unregister_entity -> __media_device_unregister_entity -> ida_free. And I'm not really sure how to fix (and honestly not super motivated). See following patch (formatting probably messed up, sorry). Maybe someone who knows a bit more about the driver or the media subsystem can fix this, thanks! Regards Luca return ret;
Comments
On 24/01/2023 20:02, Luca Weiss wrote: > Hi all, > > I hit an issue that was already fixed with upstream commit 3d658980e6da > ("media: camss: Do not attach an already attached power domain on MSM8916 > platform") but this showed that some error handling is missing in camss_probe. > > After these errors the resources aren't cleaned up and e.g. sensor drivers > still try to probe but fail quite badly because some things are NULL or > whatever. > > [ 1.979098] qcom-camss fda0ac00.camss: Failed to configure power domains: > -17 > [ 1.989327] qcom-camss: probe of fda0ac00.camss failed with error -17 > > The commit causing this (or at least part of this) is 2f6f8af67203 ("media: > camss: Refactor VFE power domain toggling") > > I tried a bit to add some error handling but in this case it now fails at > v4l2_device_unregister_subdev -> media_device_unregister_entity -> > __media_device_unregister_entity -> ida_free. > And I'm not really sure how to fix (and honestly not super motivated). > > See following patch (formatting probably messed up, sorry). Maybe someone who > knows a bit more about the driver or the media subsystem can fix this, thanks! > > Regards > Luca > > diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/ > platform/qcom/camss/camss.c > index 16545cecc4f4..0ba3c378d241 100644 > --- a/drivers/media/platform/qcom/camss/camss.c > +++ b/drivers/media/platform/qcom/camss/camss.c > @@ -1836,21 +1836,26 @@ static int camss_probe(struct platform_device *pdev) > } > } > > - ret = camss_configure_pd(camss); > + //ret = camss_configure_pd(camss); > + ret = -17; > if (ret < 0) { > dev_err(dev, "Failed to configure power domains: %d\n", > ret); > - return ret; > + goto err_configure_pd; > } > > pm_runtime_enable(dev); > > return 0; > > +err_configure_pd: > + media_device_unregister(&camss->media_dev); > + media_device_cleanup(&camss->media_dev); > err_register_subdevs: > camss_unregister_entities(camss); > err_register_entities: > v4l2_device_unregister(&camss->v4l2_dev); > err_cleanup: > + v4l2_async_nf_unregister(&camss->notifier); > v4l2_async_nf_cleanup(&camss->notifier); > > return ret; > > > I'll take a look
On 24/01/2023 20:02, Luca Weiss wrote: > Hi all, > > I hit an issue that was already fixed with upstream commit 3d658980e6da > ("media: camss: Do not attach an already attached power domain on MSM8916 > platform") but this showed that some error handling is missing in camss_probe. > > After these errors the resources aren't cleaned up and e.g. sensor drivers > still try to probe but fail quite badly because some things are NULL or > whatever. > > [ 1.979098] qcom-camss fda0ac00.camss: Failed to configure power domains: > -17 > [ 1.989327] qcom-camss: probe of fda0ac00.camss failed with error -17 > > The commit causing this (or at least part of this) is 2f6f8af67203 ("media: > camss: Refactor VFE power domain toggling") > > I tried a bit to add some error handling but in this case it now fails at > v4l2_device_unregister_subdev -> media_device_unregister_entity -> > __media_device_unregister_entity -> ida_free. > And I'm not really sure how to fix (and honestly not super motivated). > > See following patch (formatting probably messed up, sorry). Maybe someone who > knows a bit more about the driver or the media subsystem can fix this, thanks! > > Regards > Luca > > diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/ > platform/qcom/camss/camss.c > index 16545cecc4f4..0ba3c378d241 100644 > --- a/drivers/media/platform/qcom/camss/camss.c > +++ b/drivers/media/platform/qcom/camss/camss.c > @@ -1836,21 +1836,26 @@ static int camss_probe(struct platform_device *pdev) > } > } > > - ret = camss_configure_pd(camss); > + //ret = camss_configure_pd(camss); > + ret = -17; > if (ret < 0) { > dev_err(dev, "Failed to configure power domains: %d\n", > ret); > - return ret; > + goto err_configure_pd; > } > > pm_runtime_enable(dev); > > return 0; > > +err_configure_pd: > + media_device_unregister(&camss->media_dev); > + media_device_cleanup(&camss->media_dev); > err_register_subdevs: > camss_unregister_entities(camss); > err_register_entities: > v4l2_device_unregister(&camss->v4l2_dev); > err_cleanup: > + v4l2_async_nf_unregister(&camss->notifier); > v4l2_async_nf_cleanup(&camss->notifier); > > return ret; > > > I'll take a look
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/ platform/qcom/camss/camss.c index 16545cecc4f4..0ba3c378d241 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1836,21 +1836,26 @@ static int camss_probe(struct platform_device *pdev) } } - ret = camss_configure_pd(camss); + //ret = camss_configure_pd(camss); + ret = -17; if (ret < 0) { dev_err(dev, "Failed to configure power domains: %d\n", ret); - return ret; + goto err_configure_pd; } pm_runtime_enable(dev); return 0; +err_configure_pd: + media_device_unregister(&camss->media_dev); + media_device_cleanup(&camss->media_dev); err_register_subdevs: camss_unregister_entities(camss); err_register_entities: v4l2_device_unregister(&camss->v4l2_dev); err_cleanup: + v4l2_async_nf_unregister(&camss->notifier); v4l2_async_nf_cleanup(&camss->notifier);