From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 49186A04DD for ; Mon, 19 Oct 2020 11:48:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B57DC94C; Mon, 19 Oct 2020 11:48:23 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 6A65CBCBC; Mon, 19 Oct 2020 11:48:19 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 00859200119; Mon, 19 Oct 2020 11:48:19 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A8881200A35; Mon, 19 Oct 2020 11:48:16 +0200 (CEST) Received: from lsv11086.swis.cn-sha01.nxp.com (lsv11086.swis.cn-sha01.nxp.com [92.121.210.87]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 17AEF402FC; Mon, 19 Oct 2020 11:48:13 +0200 (CEST) From: Gagandeep Singh To: dev@dpdk.org, akhil.goyal@nxp.com Cc: thomas@monjalon.net, Gagandeep Singh , stable@dpdk.org Date: Mon, 19 Oct 2020 17:48:01 +0800 Message-Id: <1603100881-11504-1-git-send-email-g.singh@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-stable] [PATCH] crypto/caam_jr: fix caam sec era invalid issue X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" of_init() should be called before using any of_* APIs to retrieve information from the device tree and if reading integer value that must be converted to cpu endianness before using. Fixes: 1d678de329ab ("crypto/caam_jr: add basic job ring routines") Cc: stable@dpdk.org Signed-off-by: Gagandeep Singh --- drivers/crypto/caam_jr/caam_jr.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index c004ec4..3fb3fe0 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -2388,6 +2388,8 @@ caam_jr_dev_init(const char *name, static int cryptodev_caam_jr_probe(struct rte_vdev_device *vdev) { + int ret; + struct rte_cryptodev_pmd_init_params init_params = { "", sizeof(struct sec_job_ring_t), @@ -2404,6 +2406,12 @@ cryptodev_caam_jr_probe(struct rte_vdev_device *vdev) input_args = rte_vdev_device_args(vdev); rte_cryptodev_pmd_parse_input_args(&init_params, input_args); + ret = of_init(); + if (ret) { + RTE_LOG(ERR, PMD, + "of_init failed\n"); + return -EINVAL; + } /* if sec device version is not configured */ if (!rta_get_sec_era()) { const struct device_node *caam_node; @@ -2414,7 +2422,7 @@ cryptodev_caam_jr_probe(struct rte_vdev_device *vdev) NULL); if (prop) { rta_set_sec_era( - INTL_SEC_ERA(cpu_to_caam32(*prop))); + INTL_SEC_ERA(rte_be_to_cpu_32(*prop))); break; } } -- 2.7.4