Message ID | 20220105113104.7783-1-linmq006@gmail.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Delegated to: | Hans Verkuil |
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1n54Vc-00EWKZ-Az; Wed, 05 Jan 2022 11:31:12 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239697AbiAELbK (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Wed, 5 Jan 2022 06:31:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233838AbiAELbJ (ORCPT <rfc822;linux-media@vger.kernel.org>); Wed, 5 Jan 2022 06:31:09 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A651AC061761; Wed, 5 Jan 2022 03:31:09 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id t19so34933590pfg.9; Wed, 05 Jan 2022 03:31:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=66oKtQBJWcP3R2oSjIbdUHJLe2B+Ok04ztzTZ14ozJY=; b=iTjJFJ/pC1uamObrV/phXCXqspm8x8J+oUbdHjQxjmuwCGPa65S8XZf3mE/nZogJvH SMbeYB2FXkcGxwCXnXvVHadMEw5RP1PS3IuWMgxMtEtIQXq2sqZxJmeZWS2Swq3EWSfI N9eGvK365Gh4OYNPiIHizKiAIiSLhnfGmq9MvvKOxYbSy/KDbUE8E9lbiWZ6wPOeQAlJ flUOYvfn22ddSNWY541HnT2DNIjT3CGrTAJ2wXl+lDVgh/VNUIu84AnKeuPQLHdPYf1C U2MEsF42yo27vxdu0UkpocVsJR+D0e/Kz9siHJKd8Z7JndLx/oWZJSADqgPiVVG6f7+Y VyxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=66oKtQBJWcP3R2oSjIbdUHJLe2B+Ok04ztzTZ14ozJY=; b=Mrh1tQsoRt8E369jmh/hwwnZZSwmKHaBHnLEFCXeZXCE2XE5JT3AYimr2F1IXw3yB3 j/mMyLJQ6s/4M4UV3+NTt2T9MOoC3OX9hkV5WKSRK5UTIfVuXhIj4embSJGwIdxHmB3J D5aXrk7CPvcn4jeVMrKV+MhENLd4fLFSBMF2z6GxE50PnmdAilOZ0nVNq5KLG6gMbwOM hMXwEZ7O5p6bONUsWVb+2/bDfkUgXAvk8WvcZpuz/8OpNUgb0QR2c2AR8SpI29wFx03o 9aN2GqospyIRju0dO53hj/UQ4WLaMLEUJcYAfbsKbNa21vDnpw0aWKrQbg3SCgBRQzjx 67xg== X-Gm-Message-State: AOAM532m0IOrf+NHX8UKQxep6i6RGNPuKeudUinc3zWwk38dEpUi3/ZZ MiWG0woSBUMuS91h2IvF82Q= X-Google-Smtp-Source: ABdhPJyWlKRUUhbqI670/X0/OGjf06XnH1U9JnjKB4fTLiz98rI60u483wWbBAuk8N4PMMesSFV0ig== X-Received: by 2002:aa7:973d:0:b0:4ba:70f9:14a0 with SMTP id k29-20020aa7973d000000b004ba70f914a0mr55010892pfg.37.1641382269213; Wed, 05 Jan 2022 03:31:09 -0800 (PST) Received: from localhost.localdomain ([159.226.95.43]) by smtp.googlemail.com with ESMTPSA id ko19sm1356860pjb.16.2022.01.05.03.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 03:31:09 -0800 (PST) From: Miaoqian Lin <linmq006@gmail.com> Cc: linmq006@gmail.com, Jean-Christophe Trotin <jean-christophe.trotin@foss.st.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Peter Griffin <peter.griffin@linaro.org>, Yannick Fertre <yannick.fertre@st.com>, Hans Verkuil <hans.verkuil@cisco.com>, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: st-hva: Fix PM disable depth imbalance in hva_hw_probe Date: Wed, 5 Jan 2022 11:31:03 +0000 Message-Id: <20220105113104.7783-1-linmq006@gmail.com> X-Mailer: git-send-email 2.17.1 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.3 (--) X-LSpam-Report: No, score=-2.3 required=5.0 tests=BAYES_00=-1.9,DKIM_ADSP_CUSTOM_MED=0.001,DKIM_SIGNED=0.1,FREEMAIL_FORGED_FROMDOMAIN=0.001,FREEMAIL_FROM=0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,T_DKIM_INVALID=0.01 autolearn=ham autolearn_force=no |
Series |
media: st-hva: Fix PM disable depth imbalance in hva_hw_probe
|
|
Commit Message
Miaoqian Lin
Jan. 5, 2022, 11:31 a.m. UTC
The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().
Fixes: 57b2c06 ("[media] st-hva: multi-format video encoder V4L2 driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/media/platform/sti/hva/hva-hw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Hi Miaoqian, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on media-tree/master] [also build test WARNING on v5.16-rc8 next-20220105] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Miaoqian-Lin/media-st-hva-Fix-PM-disable-depth-imbalance-in-hva_hw_probe/20220105-193232 base: git://linuxtv.org/media_tree.git master config: riscv-randconfig-r022-20220105 (https://download.01.org/0day-ci/archive/20220106/202201060723.hf79WNhw-lkp@intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/0day-ci/linux/commit/47b1ca3ed69ff8b4ac772d1630776ec5366076c1 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Miaoqian-Lin/media-st-hva-Fix-PM-disable-depth-imbalance-in-hva_hw_probe/20220105-193232 git checkout 47b1ca3ed69ff8b4ac772d1630776ec5366076c1 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/media/platform/sti/hva/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/media/platform/sti/hva/hva-hw.c:411:1: warning: unused label 'disable_pm_runtime' [-Wunused-label] disable_pm_runtime: ^~~~~~~~~~~~~~~~~~~ 1 warning generated. vim +/disable_pm_runtime +411 drivers/media/platform/sti/hva/hva-hw.c 297 298 int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva) 299 { 300 struct device *dev = &pdev->dev; 301 struct resource *esram; 302 int ret; 303 304 WARN_ON(!hva); 305 306 /* get memory for registers */ 307 hva->regs = devm_platform_ioremap_resource(pdev, 0); 308 if (IS_ERR(hva->regs)) { 309 dev_err(dev, "%s failed to get regs\n", HVA_PREFIX); 310 return PTR_ERR(hva->regs); 311 } 312 313 /* get memory for esram */ 314 esram = platform_get_resource(pdev, IORESOURCE_MEM, 1); 315 if (!esram) { 316 dev_err(dev, "%s failed to get esram\n", HVA_PREFIX); 317 return -ENODEV; 318 } 319 hva->esram_addr = esram->start; 320 hva->esram_size = resource_size(esram); 321 322 dev_info(dev, "%s esram reserved for address: 0x%x size:%d\n", 323 HVA_PREFIX, hva->esram_addr, hva->esram_size); 324 325 /* get clock resource */ 326 hva->clk = devm_clk_get(dev, "clk_hva"); 327 if (IS_ERR(hva->clk)) { 328 dev_err(dev, "%s failed to get clock\n", HVA_PREFIX); 329 return PTR_ERR(hva->clk); 330 } 331 332 ret = clk_prepare(hva->clk); 333 if (ret < 0) { 334 dev_err(dev, "%s failed to prepare clock\n", HVA_PREFIX); 335 hva->clk = ERR_PTR(-EINVAL); 336 return ret; 337 } 338 339 /* get status interruption resource */ 340 ret = platform_get_irq(pdev, 0); 341 if (ret < 0) 342 goto err_clk; 343 hva->irq_its = ret; 344 345 ret = devm_request_threaded_irq(dev, hva->irq_its, hva_hw_its_interrupt, 346 hva_hw_its_irq_thread, 347 IRQF_ONESHOT, 348 "hva_its_irq", hva); 349 if (ret) { 350 dev_err(dev, "%s failed to install status IRQ 0x%x\n", 351 HVA_PREFIX, hva->irq_its); 352 goto err_clk; 353 } 354 disable_irq(hva->irq_its); 355 356 /* get error interruption resource */ 357 ret = platform_get_irq(pdev, 1); 358 if (ret < 0) 359 goto err_clk; 360 hva->irq_err = ret; 361 362 ret = devm_request_threaded_irq(dev, hva->irq_err, hva_hw_err_interrupt, 363 hva_hw_err_irq_thread, 364 IRQF_ONESHOT, 365 "hva_err_irq", hva); 366 if (ret) { 367 dev_err(dev, "%s failed to install error IRQ 0x%x\n", 368 HVA_PREFIX, hva->irq_err); 369 goto err_clk; 370 } 371 disable_irq(hva->irq_err); 372 373 /* initialise protection mutex */ 374 mutex_init(&hva->protect_mutex); 375 376 /* initialise completion signal */ 377 init_completion(&hva->interrupt); 378 379 /* initialise runtime power management */ 380 pm_runtime_set_autosuspend_delay(dev, AUTOSUSPEND_DELAY_MS); 381 pm_runtime_use_autosuspend(dev); 382 pm_runtime_set_suspended(dev); 383 pm_runtime_enable(dev); 384 385 ret = pm_runtime_resume_and_get(dev); 386 if (ret < 0) { 387 dev_err(dev, "%s failed to set PM\n", HVA_PREFIX); 388 goto err_disable; 389 } 390 391 /* check IP hardware version */ 392 hva->ip_version = hva_hw_get_ip_version(hva); 393 394 if (hva->ip_version == HVA_VERSION_UNKNOWN) { 395 ret = -EINVAL; 396 goto err_pm; 397 } 398 399 dev_info(dev, "%s found hva device (version 0x%lx)\n", HVA_PREFIX, 400 hva->ip_version); 401 402 return 0; 403 404 err_pm: 405 pm_runtime_put(dev); 406 err_disable: 407 pm_runtime_disable(dev); 408 err_clk: 409 if (hva->clk) 410 clk_unprepare(hva->clk); > 411 disable_pm_runtime: 412 pm_runtime_disable(dev); 413 return ret; 414 } 415 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c index 15e8f83b1b56..bef880951921 100644 --- a/drivers/media/platform/sti/hva/hva-hw.c +++ b/drivers/media/platform/sti/hva/hva-hw.c @@ -406,7 +406,8 @@ int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva) err_clk: if (hva->clk) clk_unprepare(hva->clk); - +disable_pm_runtime: + pm_runtime_disable(dev); return ret; }