From patchwork Mon Jul 17 08:56:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 107874 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4255113qge; Mon, 17 Jul 2017 01:58:14 -0700 (PDT) X-Received: by 10.98.89.129 with SMTP id k1mr17934804pfj.28.1500281894277; Mon, 17 Jul 2017 01:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500281894; cv=none; d=google.com; s=arc-20160816; b=jW9j9VgBYEab3ID5ycELhf+BJU/5ndUf/LihUqt0NMZDz6OTtoB5hjuzmNO/Spw6nl +zukjkdsPLaTBHWxi1BO4Q0aW7E8ffyoOpFkY2XsmCfgN6+n7AJUr3GwuaIFLkK64V2w GSGPIpRYkvs5C7QWHPTI1z8xkgO2l9rKHsn+LUqcMoj9wmiS8AkgbHV8t2DdGgQHaWq+ fLFswyVVah+Zvno7TEqN6HNB2X/i6l+iX9zzdzSqI2lpkXh/Jrn9O7XPFdCMiUe3uueA vWc3Qy5KO2Q1zYScu1Huy7dKjfCJydWe2rkwCGd8dfepNXnIMiSrKFMS/dtaxHQbamBh XiTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ncAzAKhJAVE9N+B1EOMeWAij1NnYndfH/6XPtc+uvTI=; b=ImNW+k33CwPxEJRHve968r6SGHnSrF5c/YwPlp7kseJMZr9hWrQrpIdHlM3oXg/6D7 urej4qerOqQj+PeK2aFgvqZQcpI5YDkbbQIdV1MVLOmuGxtPhOshBX0EU/5EYu0WxMq9 0NBc8DKuOeeTyKaDNtNISGLNslx2TrxErE8G+6U4Q1CloXalpKwaj01pjzaDNVremGaa l5f4BL4JSi5zsoqJK6/z9hYfwH7awJesfbA49FSMtoRR6rJNwdEATZANcw95yUHaoLa6 CVAFQAeLsr3wtZjJ6QnA2JeREl7b3wHeuscvVPHLyXmY2lLqnHEhJLG+88/ZJx/zHmHV JItA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=aohM/D7P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f29si12144226pfe.230.2017.07.17.01.58.13; Mon, 17 Jul 2017 01:58:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=aohM/D7P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1751372AbdGQI6H (ORCPT + 25 others); Mon, 17 Jul 2017 04:58:07 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:37928 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751316AbdGQI6E (ORCPT ); Mon, 17 Jul 2017 04:58:04 -0400 Received: by mail-wm0-f51.google.com with SMTP id f67so76422101wmh.1 for ; Mon, 17 Jul 2017 01:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ncAzAKhJAVE9N+B1EOMeWAij1NnYndfH/6XPtc+uvTI=; b=aohM/D7PipgT56M1KR3CmTuWTfxb1mA9QfWYnu/fam046ziOuDU1zaF95jb7Ocm3xq JkF9MQ+cebbsTLG16Fcb2RZfXDlJ1pwTCJPJElIsV1scDWHQRiZ9b3PFmfZE6FVSItKQ LXL6C7uL+QQr9WFYlbewfkobQ1PGoJCvXMNIg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ncAzAKhJAVE9N+B1EOMeWAij1NnYndfH/6XPtc+uvTI=; b=g3ZiBnLxzZ4yE4RyRRzv7PWuKMglA2cB/3s2nBJKEEq6DKtr150hQHz/vht7dg92/X t1/bo/T3UhbCt4eKgVVrBoDlyZJKg2sdZjdZu2w50eBlpPrf+/8L80uhObkkfG5XeB0k 1AVl7HecvwFeBl79oN9GryD4vKrVl9tjvAmq1meNkM5DIExuKknRIltebf4afEfSadtf wSVN01qlqEl2xWSguxp00mC9ukK/Nvvfz+owj5TBD8lo28ZNfmOyHe70ljj3J4Rwh1Zw i2OUHcC7/3A3q6yAdkNzSWl08XX17l4LqfPTwafxjDeutK39erO/3Xo5QcVhDiJ+Pd47 vQOA== X-Gm-Message-State: AIVw111eOUTo6k+b1VhMwVyNoEi05u82tjD9HOvTaQZ58II73qrRMOIo 6LfEBrjY0d06tkGxPLIE3Q== X-Received: by 10.28.154.19 with SMTP id c19mr3237201wme.87.1500281883576; Mon, 17 Jul 2017 01:58:03 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id q17sm11558700wmd.4.2017.07.17.01.58.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 01:58:03 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab Cc: Hans Verkuil , Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 1/4] venus: mark PM functions as __maybe_unused Date: Mon, 17 Jul 2017 11:56:47 +0300 Message-Id: <20170717085650.12185-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170717085650.12185-1-stanimir.varbanov@linaro.org> References: <20170717085650.12185-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Without PM support, gcc warns about two unused functions: platform/qcom/venus/core.c:146:13: error: 'venus_clks_disable' defined but not used [-Werror=unused-function] platform/qcom/venus/core.c:126:12: error: 'venus_clks_enable' defined but not used [-Werror=unused-function] The problem as usual are incorrect #ifdefs, so the easiest fix is to do away with the #ifdef completely and mark the suspend/resume handlers as __maybe_unused, which they are. Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions") Signed-off-by: Arnd Bergmann Reviewed-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.11.0 diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 776d2bae6979..694f57a78288 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -270,8 +270,7 @@ static int venus_remove(struct platform_device *pdev) return ret; } -#ifdef CONFIG_PM -static int venus_runtime_suspend(struct device *dev) +static __maybe_unused int venus_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); int ret; @@ -283,7 +282,7 @@ static int venus_runtime_suspend(struct device *dev) return ret; } -static int venus_runtime_resume(struct device *dev) +static __maybe_unused int venus_runtime_resume(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); int ret; @@ -302,7 +301,6 @@ static int venus_runtime_resume(struct device *dev) venus_clks_disable(core); return ret; } -#endif static const struct dev_pm_ops venus_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, From patchwork Mon Jul 17 08:56:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 107875 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4255345qge; Mon, 17 Jul 2017 01:58:35 -0700 (PDT) X-Received: by 10.84.217.153 with SMTP id p25mr9253944pli.218.1500281915651; Mon, 17 Jul 2017 01:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500281915; cv=none; d=google.com; s=arc-20160816; b=Qd8ZM24XayeaBmEJVDH06RnSWpIKdt8Txd1kiAa5GzPiw61fXK6Cywo3ByL7dqqOXZ LqoaUqPBvJMYHskawojFnUPCwliGTZpDE4dt8IrHjfj28R+fxqU8tvH282n+1Gt2O6Hh 7hc319mLFFL9CwXqTmsNT9F9Oo9svY9Df4+zS6/vQQhGCKTLgYNML5nCNnRg3owsi+IF 5ULRcyYlh5QvG+dVNumStv4jzo9AgJZr6QwqmdfHLTT+NaiprhqQQ0p04S2peMWe3JdS QQ2v+izY1r0gM9QCRJL5WYA3QDcnIkP/M70O/yxDjg8rGOtfg51FSMNErSQmy7GFO9oP yfeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=qJtC2VoguUZc8bWVivXDFZ+GD3fuRnfJx2KA1C/uNBM=; b=C4WKMaX9dxkUZVYnZZjLZNMWqTq2RnYEujYR1BEa0f3JXXVf2tQY3Rd4jOuSZkTzGt alacrgy0ia+sbViYSiK4XxSkjCz349ll9vWiiiAwhFa6ei/rGCs1QT8DuBYRS/etzx2f proUiZUCMpnaZJZJUurP12qdJtJzBk3ko+0pUZ/W9iv/4OGiipA9ZR04vUg7HLVEl69D saFv/NmXFTmACNmi5bz1ebwPvfEmOIw0r+tDr9Z4UIEDYfAyyPEhACIyTKR0cjU07pKC IcpuTfSSw5B1SXD9I3mjoZ/6gtrYLVwoJU9rNidPdhOS3p0+lTvqJsJUhKJaDXBydcvQ shdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=fsHoYsoJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si12377881pln.576.2017.07.17.01.58.35; Mon, 17 Jul 2017 01:58:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=fsHoYsoJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1751402AbdGQI6d (ORCPT + 25 others); Mon, 17 Jul 2017 04:58:33 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:33618 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278AbdGQI6a (ORCPT ); Mon, 17 Jul 2017 04:58:30 -0400 Received: by mail-wm0-f51.google.com with SMTP id t70so20791151wmt.0 for ; Mon, 17 Jul 2017 01:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qJtC2VoguUZc8bWVivXDFZ+GD3fuRnfJx2KA1C/uNBM=; b=fsHoYsoJwKJi+gMmO4T/yiDp4tNASeSUq0FoFurf2BAm1bS9PROsWr4TPVTuoOAHQ9 KFDBMSKIfN1Q5AeuTfLzUrAmgJHq02qNdB6UCQJb/RmcHiy6YvLqDYc7c1eToGvLor5I TyyT1IAn8PyqWMnbe0SIGZn4gmQuylZlv0w2E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qJtC2VoguUZc8bWVivXDFZ+GD3fuRnfJx2KA1C/uNBM=; b=QvMs5x2xerD58ge6l/EzB2tvYn1KaJe4HcN57RZef9al51Hp/qWPxxxc70bpaSBD8C EsSxffPtXiAfzyBmXUkoHTTExZfK1ajT77Nb9vXCRh1O25dhfQu4khNIDe8U49mMP/GP SLgQ8ob7TXBsapCRCEA2VEcYZT2gGMmc363hkpPeaHQ3eXaP3IBnkn5azaMKKLWz9V75 EE2KenGrAxHlCaIFot+d0AG5XmPqB48BFG4yyzi0HVOHLzCM88kpFuR9X+2C7BX4aP8X Jq22S5/5IUoDMwUMl53zZ66nzEamzOIb6OWfLeFq7CHz3oUE/TV8AG+QC0dQBA/AG16A C8sQ== X-Gm-Message-State: AIVw110q5DhaTlZ820JmPP7ulUwgFKb2Msa0XG0YnUIXlqxDULPBaJms IQvc30HAXuUUI0Nn X-Received: by 10.28.189.214 with SMTP id n205mr3294452wmf.122.1500281909508; Mon, 17 Jul 2017 01:58:29 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id q17sm11558700wmd.4.2017.07.17.01.58.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 01:58:05 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab Cc: Hans Verkuil , Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stanimir Varbanov Subject: [PATCH 2/4] media: venus: don't abuse dma_alloc for non-DMA allocations Date: Mon, 17 Jul 2017 11:56:48 +0300 Message-Id: <20170717085650.12185-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170717085650.12185-1-stanimir.varbanov@linaro.org> References: <20170717085650.12185-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In venus_boot(), we pass a pointer to a phys_addr_t into dmam_alloc_coherent, which the compiler warns about: platform/qcom/venus/firmware.c: In function 'venus_boot': platform/qcom/venus/firmware.c:63:49: error: passing argument 3 of 'dmam_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types] To avoid the error refactor venus_boot function by discard dma_alloc_coherent usage because we don't want to map the memory for the device. The meaning of venus_boot is to copy the content of the firmware buffer into the reserved (and memblock removed) block of memory and pass the physical address to the remote processor. Now we parse memory-region property by hand and memremap the physical address to CPU, call mdt_load to load firmware segments into proper places and unmap reserved memory. Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions") Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.c | 10 ++-- drivers/media/platform/qcom/venus/core.h | 1 - drivers/media/platform/qcom/venus/firmware.c | 74 ++++++++++++---------------- drivers/media/platform/qcom/venus/firmware.h | 5 +- 4 files changed, 39 insertions(+), 51 deletions(-) -- 2.11.0 diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 694f57a78288..a70368cb713f 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -76,7 +76,7 @@ static void venus_sys_error_handler(struct work_struct *work) hfi_core_deinit(core, true); hfi_destroy(core); mutex_lock(&core->lock); - venus_shutdown(&core->dev_fw); + venus_shutdown(core->dev); pm_runtime_put_sync(core->dev); @@ -84,7 +84,7 @@ static void venus_sys_error_handler(struct work_struct *work) pm_runtime_get_sync(core->dev); - ret |= venus_boot(core->dev, &core->dev_fw, core->res->fwname); + ret |= venus_boot(core->dev, core->res->fwname); ret |= hfi_core_resume(core, true); @@ -207,7 +207,7 @@ static int venus_probe(struct platform_device *pdev) if (ret < 0) goto err_runtime_disable; - ret = venus_boot(dev, &core->dev_fw, core->res->fwname); + ret = venus_boot(dev, core->res->fwname); if (ret) goto err_runtime_disable; @@ -238,7 +238,7 @@ static int venus_probe(struct platform_device *pdev) err_core_deinit: hfi_core_deinit(core, false); err_venus_shutdown: - venus_shutdown(&core->dev_fw); + venus_shutdown(dev); err_runtime_disable: pm_runtime_set_suspended(dev); pm_runtime_disable(dev); @@ -259,7 +259,7 @@ static int venus_remove(struct platform_device *pdev) WARN_ON(ret); hfi_destroy(core); - venus_shutdown(&core->dev_fw); + venus_shutdown(dev); of_platform_depopulate(dev); pm_runtime_put_sync(dev); diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index e542700eee32..cba092bcb76d 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -101,7 +101,6 @@ struct venus_core { struct device *dev; struct device *dev_dec; struct device *dev_enc; - struct device dev_fw; struct mutex lock; struct list_head instances; atomic_t insts_count; diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index 1b1a4f355918..d6d9560c1c19 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -12,29 +12,27 @@ * */ -#include +#include #include #include +#include #include -#include -#include +#include #include +#include #include #include "firmware.h" #define VENUS_PAS_ID 9 -#define VENUS_FW_MEM_SIZE SZ_8M +#define VENUS_FW_MEM_SIZE (6 * SZ_1M) -static void device_release_dummy(struct device *dev) -{ - of_reserved_mem_device_release(dev); -} - -int venus_boot(struct device *parent, struct device *fw_dev, const char *fwname) +int venus_boot(struct device *dev, const char *fwname) { const struct firmware *mdt; + struct device_node *node; phys_addr_t mem_phys; + struct resource r; ssize_t fw_size; size_t mem_size; void *mem_va; @@ -43,66 +41,58 @@ int venus_boot(struct device *parent, struct device *fw_dev, const char *fwname) if (!qcom_scm_is_available()) return -EPROBE_DEFER; - fw_dev->parent = parent; - fw_dev->release = device_release_dummy; + node = of_parse_phandle(dev->of_node, "memory-region", 0); + if (!node) { + dev_err(dev, "no memory-region specified\n"); + return -EINVAL; + } - ret = dev_set_name(fw_dev, "%s:%s", dev_name(parent), "firmware"); + ret = of_address_to_resource(node, 0, &r); if (ret) return ret; - ret = device_register(fw_dev); - if (ret < 0) - return ret; + mem_phys = r.start; + mem_size = resource_size(&r); - ret = of_reserved_mem_device_init_by_idx(fw_dev, parent->of_node, 0); - if (ret) - goto err_unreg_device; + if (mem_size < VENUS_FW_MEM_SIZE) + return -EINVAL; - mem_size = VENUS_FW_MEM_SIZE; - - mem_va = dmam_alloc_coherent(fw_dev, mem_size, &mem_phys, GFP_KERNEL); + mem_va = memremap(r.start, mem_size, MEMREMAP_WC); if (!mem_va) { - ret = -ENOMEM; - goto err_unreg_device; + dev_err(dev, "unable to map memory region: %pa+%zx\n", + &r.start, mem_size); + return -ENOMEM; } - ret = request_firmware(&mdt, fwname, fw_dev); + ret = request_firmware(&mdt, fwname, dev); if (ret < 0) - goto err_unreg_device; + goto err_unmap; fw_size = qcom_mdt_get_size(mdt); if (fw_size < 0) { ret = fw_size; release_firmware(mdt); - goto err_unreg_device; + goto err_unmap; } - ret = qcom_mdt_load(fw_dev, mdt, fwname, VENUS_PAS_ID, mem_va, mem_phys, + ret = qcom_mdt_load(dev, mdt, fwname, VENUS_PAS_ID, mem_va, mem_phys, mem_size); release_firmware(mdt); if (ret) - goto err_unreg_device; + goto err_unmap; ret = qcom_scm_pas_auth_and_reset(VENUS_PAS_ID); if (ret) - goto err_unreg_device; - - return 0; + goto err_unmap; -err_unreg_device: - device_unregister(fw_dev); +err_unmap: + memunmap(mem_va); return ret; } -int venus_shutdown(struct device *fw_dev) +int venus_shutdown(struct device *dev) { - int ret; - - ret = qcom_scm_pas_shutdown(VENUS_PAS_ID); - device_unregister(fw_dev); - memset(fw_dev, 0, sizeof(*fw_dev)); - - return ret; + return qcom_scm_pas_shutdown(VENUS_PAS_ID); } diff --git a/drivers/media/platform/qcom/venus/firmware.h b/drivers/media/platform/qcom/venus/firmware.h index f81a98979798..428efb56d339 100644 --- a/drivers/media/platform/qcom/venus/firmware.h +++ b/drivers/media/platform/qcom/venus/firmware.h @@ -16,8 +16,7 @@ struct device; -int venus_boot(struct device *parent, struct device *fw_dev, - const char *fwname); -int venus_shutdown(struct device *fw_dev); +int venus_boot(struct device *dev, const char *fwname); +int venus_shutdown(struct device *dev); #endif From patchwork Mon Jul 17 08:56:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 107877 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4256296qge; Mon, 17 Jul 2017 01:59:51 -0700 (PDT) X-Received: by 10.98.50.133 with SMTP id y127mr17642649pfy.242.1500281991351; Mon, 17 Jul 2017 01:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500281991; cv=none; d=google.com; s=arc-20160816; b=Ovno7fuZeMootxTNOOfj+zhx9uKp75EEbciNxpXcPzenjzeRnoKrLdfGp9Wkyzx5vQ EI6j9Fu6TXtJm4q+E/CJVlnf3de0Z6Akv+WAvIrCyEj/QlmLsrQTSEKq2/+6kHsec5zu cwdS3dv7QteYHPxMRsHZOVXMeZGfZVNWaPqaEKfVh/PpoJflP8UWcnSkGnAHSWMFMLZq M1haPysFIrNgRIe4o2/KydFWV1gWvs48tixqFfPv2EorwfbTyrfZ6lnUl4Gcg1QOfaa/ zh0gLOHQrZmOXuWmbafPZIyd49FXmAYnKTdrj16ntTymL1g+H1Hibrywi3NAt9pzcgpT kEyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=YcM+BnKMPVyRBe1YTuZaMK13ZVTufTUYCGc+dKBUFcQ=; b=O8VH31OusF2S4QvZWy3tLjunihZ4vRcurpwU57avlh0h3E0pgxs12roy4vz4urKqsK sOcO2jKjETlr66vHnceWDU0SrGznaO/zwB1wfpK1UTqnoj4z2ps/6bE8vgIrQiqXCgi5 pp8+7Obq//3uwwwZNJIXIbWWuG7/9O1WqU/9aWv5ZwjJOf2Ury5qSblk1A43APr4pqYg FHp+m5v6Xj3NC+Ud6Yquo0EbLehCLgPXOqMeZBb5hTGZC38CQpbBeSYj2JqCeUti++aP lGWy9BZ7ytU7yDMSHYdBJXxkettDsZrgXN9rDG2EpM2Et4pzWy1gUT8KUymqQ5u8MQQO C1WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Ba/xBHyx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si12778001pln.631.2017.07.17.01.59.51; Mon, 17 Jul 2017 01:59:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=Ba/xBHyx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1751473AbdGQI7r (ORCPT + 25 others); Mon, 17 Jul 2017 04:59:47 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:35346 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751404AbdGQI6q (ORCPT ); Mon, 17 Jul 2017 04:58:46 -0400 Received: by mail-wr0-f177.google.com with SMTP id w4so18946625wrb.2 for ; Mon, 17 Jul 2017 01:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YcM+BnKMPVyRBe1YTuZaMK13ZVTufTUYCGc+dKBUFcQ=; b=Ba/xBHyxVKwLhoT2D0k3KCXbEJEv3V3apJB/4TJezNvdz9SulYxGxCvFNW4SFCj3Fm VmR2nghDw8+qVTdAhAPHjfncEJYD0ecicSi0qreVU7Jjv33SYPpD6HIGRWzE3yq3AFI3 unNiqLluA4VLzAWaPsg0WjU5nVlyE5vAk6Id0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YcM+BnKMPVyRBe1YTuZaMK13ZVTufTUYCGc+dKBUFcQ=; b=AvHEfu1wOyMlNwChKwdz3hI6mH3LINzVmb9m+dKQ4RitlxE/sEM5aAdLKQCS3kSNWr CJLx9Aifhw5uMx/nMm10WUsagQQYUeAvYaV54opfPvJfnYBVsDS+eg4aHIYzlD1uYF94 dBgiPFgea5XVlQrN7q8B7DRY+Z500jKuY9dwzSenktCL72itpI0nOoqwVHzEriLVRx1h yKr/gGtfmqGcMKm5iDsI+gUYorG7GALNXyZD1hvCOl6F/zYGQRDbZ9HLEyuJLVnlGQfO MNhhVFlLmOzKa7V7efFOE/v3UynCfugPMBSconXgwBtGFuRq5WMhljaAeVWcR6dl2wsH Ecvw== X-Gm-Message-State: AIVw110CwQ4p/G/qFVmXFQ8y4Fy8bU2bltEkADd/Z0ak36ALOWgB547y pHWu+Wa5PTKvWsz1 X-Received: by 10.223.151.82 with SMTP id r76mr10124416wrb.6.1500281925557; Mon, 17 Jul 2017 01:58:45 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id q17sm11558700wmd.4.2017.07.17.01.58.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 01:58:45 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab Cc: Hans Verkuil , Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 3/4] venus: fix compile-test build on non-qcom ARM platform Date: Mon, 17 Jul 2017 11:56:49 +0300 Message-Id: <20170717085650.12185-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170717085650.12185-1-stanimir.varbanov@linaro.org> References: <20170717085650.12185-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann If QCOM_MDT_LOADER is enabled, but ARCH_QCOM is not, we run into a build error: ERROR: "qcom_mdt_load" [drivers/media/platform/qcom/venus/venus-core.ko] undefined! ERROR: "qcom_mdt_get_size" [drivers/media/platform/qcom/venus/venus-core.ko] undefined! This changes the 'select' statement again, so we only try to enable those symbols when the drivers will actually get built, and explicitly test for QCOM_MDT_LOADER to be enabled before calling into it. Fixes: 76724b30f222 ("[media] media: venus: enable building with COMPILE_TEST") Signed-off-by: Arnd Bergmann Reviewed-by: Stanimir Varbanov --- drivers/media/platform/Kconfig | 4 ++-- drivers/media/platform/qcom/venus/firmware.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 1313cd533436..fb1fa0b82077 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -475,8 +475,8 @@ config VIDEO_QCOM_VENUS tristate "Qualcomm Venus V4L2 encoder/decoder driver" depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST - select QCOM_MDT_LOADER if (ARM || ARM64) - select QCOM_SCM if (ARM || ARM64) + select QCOM_MDT_LOADER if ARCH_QCOM + select QCOM_SCM if ARCH_QCOM select VIDEOBUF2_DMA_SG select V4L2_MEM2MEM_DEV ---help--- diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index d6d9560c1c19..521d4b36c090 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -38,7 +38,7 @@ int venus_boot(struct device *dev, const char *fwname) void *mem_va; int ret; - if (!qcom_scm_is_available()) + if (!IS_ENABLED(CONFIG_QCOM_MDT_LOADER) || !qcom_scm_is_available()) return -EPROBE_DEFER; node = of_parse_phandle(dev->of_node, "memory-region", 0); From patchwork Mon Jul 17 08:56:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 107876 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4256012qge; Mon, 17 Jul 2017 01:59:29 -0700 (PDT) X-Received: by 10.84.232.143 with SMTP id i15mr729880plk.248.1500281968934; Mon, 17 Jul 2017 01:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500281968; cv=none; d=google.com; s=arc-20160816; b=lQMKiiBbw4h4cYYkDYznJFTBz9tGgKsIdMKV5rS7zGyrpTQlB/r1K6hrT8H6Oe10EQ 6rKKffQY+T3AyH+ToWqjRsJI+ycSLRsLkJRUPCJl1woiiDOgxSvs3Ii6NfkzmI1nXjFk VOVx2/Aemm2kPN0HZBLT4tTxJ9XuEbAZmmL/374k5IigWA2sNM1hkSeeUWMscOky87o1 bKmVfKWz0/9p5GE3UlMOB87Ut7N9yWJEh9gAN2ppx4eR65C8+Rhi2vCF9UmFUK/+04nX JBMrfJiJBrGxwLN8fEJbiKRe3WdwGdwU3oBPgnlNswvun+j3YBSMaO+A5NgmSX6/9Bkr FaNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=7CvQfHGoFCdoxeXR0khXNq6p9Mu7NbcF2mM+Inr+BMg=; b=Z0u86h4DJjKL5iulsYIGgJMhQ175TU4LgDsReAVArTRL6a0acZStztvuv91XBUO8Id agwWMDGyWYmN0uD/1NDf+ARTzMUYtUDAt0GOCfHKIdi9iTKheoggQNbWCHnICiqHxBvZ zxelO2okKTiQlPjLNMrdjiCEiaTfZIK3kER43ujg1VA6Q92MQhTHEGUSnD9PKpxF4xhR KKhcoR1qt+QLaoE94c6j38eWnPNe7PTAF4RRnJ1N/ak8YCAaz3qnRiufvyvDj1WA+uSl iv3TIrH+deSpfRiHpv54xX8Df7+WcvpwTVCNv22Dun1nXYmnbIZoV3sn0gXGRRa3Su+h pD8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=E0Nj8+3I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si12986055pgw.423.2017.07.17.01.59.28; Mon, 17 Jul 2017 01:59:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=E0Nj8+3I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1751462AbdGQI70 (ORCPT + 25 others); Mon, 17 Jul 2017 04:59:26 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:34518 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbdGQI6s (ORCPT ); Mon, 17 Jul 2017 04:58:48 -0400 Received: by mail-wr0-f177.google.com with SMTP id 12so3283353wrb.1 for ; Mon, 17 Jul 2017 01:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7CvQfHGoFCdoxeXR0khXNq6p9Mu7NbcF2mM+Inr+BMg=; b=E0Nj8+3IKwqUcNcXTK0hJDZIW5vNR5qZfY8q3MfHtFfY3e/Ej3pw+IKMkypiqtH/u8 VTOAC+JFoziikYWHvF33FedJG/5J6qHrUQ8oave8mJWfyzXCaY2x8MTumjb0jzKk/EWV d0A+nl7TaNwRenAM7CTICnwBtK2x38G9BIfl0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7CvQfHGoFCdoxeXR0khXNq6p9Mu7NbcF2mM+Inr+BMg=; b=ijfapzFYQ3bfaUY5rnZGydRQa+kR6w2gBz8uRthe3qRSKHTBqBUP07IjYKWK+fV/Nv EuqpKyF7He0vSnxxsy2/bRdG0YadGelaQ78Vz5Xsf56byL/r8DbxBebUjC/+U8VbMcCs yKdYptbwKBvAnMnmFLJsMsY5mmHULWpf2Isgic02mzUGhrOSMTFR8EzwK6s7Fkn7xhXh sDxuBAZppbCClfPUjAuFkWfUlEMv+H/s1PLbjCBravEzlOsNfrfplUE2nAktZU1Qqjl6 drMscz/LNYYU4g75ntZsy5AMYeftQ1BN3snbJegWrknpyoDW0QRe7W0D0aWC9XN4I4OZ wvMg== X-Gm-Message-State: AIVw1130orEMqJvpnBnPoPvwODWBDHBBcIvSCTndjn9/FWqJdlHgAQw8 2PuqQwIYaq+UPMg1 X-Received: by 10.223.136.174 with SMTP id f43mr1328729wrf.148.1500281927270; Mon, 17 Jul 2017 01:58:47 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id q17sm11558700wmd.4.2017.07.17.01.58.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 01:58:46 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab Cc: Hans Verkuil , Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Rob Clark Subject: [PATCH 4/4] media: venus: hfi: fix error handling in hfi_sys_init_done() Date: Mon, 17 Jul 2017 11:56:50 +0300 Message-Id: <20170717085650.12185-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170717085650.12185-1-stanimir.varbanov@linaro.org> References: <20170717085650.12185-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark Not entirely sure what triggers it, but with venus build as kernel module and in initrd, we hit this crash: Unable to handle kernel paging request at virtual address ffff80003c039000 pgd = ffff00000a14f000 [ffff80003c039000] *pgd=00000000bd9f7003, *pud=00000000bd9f6003, *pmd=00000000bd9f0003, *pte=0000000000000000 Internal error: Oops: 96000007 [#1] SMP Modules linked in: qcom_wcnss_pil(E+) crc32_ce(E) qcom_common(E) venus_core(E+) remoteproc(E) snd_soc_msm8916_digital(E) virtio_ring(E) cdc_ether(E) snd_soc_lpass_apq8016(E) snd_soc_lpass_cpu(E) snd_soc_apq8016_sbc(E) snd_soc_lpass_platform(E) v4l2_mem2mem(E) virtio(E) snd_soc_core(E) ac97_bus(E) snd_pcm_dmaengine(E) snd_seq(E) leds_gpio(E) videobuf2_v4l2(E) videobuf2_core(E) snd_seq_device(E) snd_pcm(E) videodev(E) media(E) nvmem_qfprom(E) msm(E) snd_timer(E) snd(E) soundcore(E) spi_qup(E) mdt_loader(E) qcom_tsens(E) qcom_spmi_temp_alarm(E) nvmem_core(E) msm_rng(E) uas(E) usb_storage(E) dm9601(E) usbnet(E) mii(E) mmc_block(E) adv7511(E) drm_kms_helper(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) fb_sys_fops(E) qcom_spmi_vadc(E) qcom_vadc_common(PE) industrialio(E) pinctrl_spmi_mpp(E) pinctrl_spmi_gpio(E) rtc_pm8xxx(E) clk_smd_rpm(E) sdhci_msm(E) sdhci_pltfm(E) qcom_smd_regulator(E) drm(E) smd_rpm(E) qcom_spmi_pmic(E) regmap_spmi(E) ci_hdrc_msm(E) ci_hdrc(E) usb3503(E) extcon_usb_gpio(E) phy_msm_usb(E) udc_core(E) qcom_hwspinlock(E) extcon_core(E) ehci_msm(E) i2c_qup(E) sdhci(E) mmc_core(E) spmi_pmic_arb(E) spmi(E) qcom_smd(E) smsm(E) rpmsg_core(E) smp2p(E) smem(E) hwspinlock_core(E) gpio_keys(E) CPU: 2 PID: 551 Comm: irq/150-venus Tainted: P E 4.12.0+ #1625 Hardware name: qualcomm dragonboard410c/dragonboard410c, BIOS 2017.07-rc2-00144-ga97bdbdf72-dirty 07/08/2017 task: ffff800037338000 task.stack: ffff800038e00000 PC is at hfi_sys_init_done+0x64/0x140 [venus_core] LR is at hfi_process_msg_packet+0xcc/0x1e8 [venus_core] pc : [] lr : [] pstate: 20400145 sp : ffff800038e03c60 x29: ffff800038e03c60 x28: 0000000000000000 x27: 00000000000df018 x26: ffff00000118f4d0 x25: 0000000000020003 x24: ffff80003a8d3010 x23: ffff00000118f760 x22: ffff800037b40028 x21: ffff8000382981f0 x20: ffff800037b40028 x19: ffff80003c039000 x18: 0000000000000020 x17: 0000000000000000 x16: ffff800037338000 x15: ffffffffffffffff x14: 0000001000000014 x13: 0000000100001007 x12: 0000000100000020 x11: 0000100e00000000 x10: 0000000000000001 x9 : 0000000200000000 x8 : 0000001400000001 x7 : 0000000000001010 x6 : 0000000000000148 x5 : 0000000000001009 x4 : ffff80003c039000 x3 : 00000000cd770abb x2 : 0000000000000042 x1 : 0000000000000788 x0 : 0000000000000002 Process irq/150-venus (pid: 551, stack limit = 0xffff800038e00000) Call trace: [] hfi_sys_init_done+0x64/0x140 [venus_core] [] hfi_process_msg_packet+0xcc/0x1e8 [venus_core] [] venus_isr_thread+0x1b4/0x208 [venus_core] [] hfi_isr_thread+0x28/0x38 [venus_core] [] irq_thread_fn+0x30/0x70 [] irq_thread+0x14c/0x1c8 [] kthread+0x138/0x140 [] ret_from_fork+0x10/0x40 Code: 52820125 52820207 7a431820 54000249 (b9400263) ---[ end trace c963460f20a984b6 ]--- The problem is that in the error case, we've incremented the data ptr but not decremented rem_bytes, and keep reading (presumably garbage) until eventually we go beyond the end of the buffer. Instead, on first error, we should probably just bail out. Other option is to increment read_bytes by sizeof(u32) before the switch, rather than only accounting for the ptype header in the non-error case. Note that in this case it is HFI_ERR_SYS_INVALID_PARAMETER, ie. an unrecognized/unsupported parameter, so interpreting the next word as a property type would be bogus. The other error cases are due to truncated buffer, so there isn't likely to be anything valid to interpret in the remainder of the buffer. So just bailing seems like a reasonable solution. Signed-off-by: Rob Clark Reviewed-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_msgs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.11.0 diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index f8841713e417..a681ae5381d6 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -239,11 +239,12 @@ static void hfi_sys_init_done(struct venus_core *core, struct venus_inst *inst, break; } - if (!error) { - rem_bytes -= read_bytes; - data += read_bytes; - num_properties--; - } + if (error) + break; + + rem_bytes -= read_bytes; + data += read_bytes; + num_properties--; } err_no_prop: