Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp2844644pxx; Sun, 1 Nov 2020 12:09:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwD+iZGvdUKQRrsF4nhQfrB55FwI8SwbdHX0PfeD6l2Jss+dKAaFmks2ACFXFL6TTFBnJp X-Received: by 2002:aa7:cacb:: with SMTP id l11mr13069513edt.332.1604261358062; Sun, 01 Nov 2020 12:09:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604261358; cv=none; d=google.com; s=arc-20160816; b=yL2NS0/ibmIThUFM67UWqtXV6xW+QuLEz/B83NloVxmwgiBvkIFvFxbZ/6w/aWzCm8 /Z9Bzi5RlJBv/iYv5F9JJLlREBtbLTaoBax9booGh9SHH/qQaGMgznbr1QR2cRzTJLhb 7MG6kAg8QEYwUR1kj2ID3mpLkSexuVvNGs+/yjE0kFpXIM0uOvxt/8rC/gYEP7KYB/WJ gOy+hjkc1yU3wnW328u1/6yN2HszXjVXGirOxjcVvrE4F8WAv+zNiRpgSlwgKKUMHKv8 bwEPoAoTL83nP1nmbNw+CWIySlgYP+bR1hVrrzBg5n7z3EB+6l6/xyVXUCESxt5w+UYO +o0Q== 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; bh=ZWx+FeUZSplf+nRW4RowKXt6aGnaRGFjL2DvHpE28k4=; b=dbCagbiwfdILCExiXb4aBAlTW0xScZtUpkrKsGV6dZ3aBYu6kGqipEFfDcRM+oFqpx iiFd+DdROC1aBL89BbcqHHEAy/yKDEeVM06A0CoM7Vj3nDyJNLhWpcz9759pDqsKG2Vl pD5tNc+bjnWzOhGTBNfey9JVG//byGqrcaUu66Qd0XMNW33KwFdVNL88llQ7I3wGz9S5 /yO1FR83Auw5/LEncoI5PoLxFmVbxw6QU0322hQJU73ZSlKjEiICun2viCRrumjOouow 9PwDkAX5fxg23s5vottPgKnwgI0QymLOPQndtQsSIM1DOhIyexFnD1Pbta+1VJv4ETwl Z+tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si9470139edm.477.2020.11.01.12.08.43; Sun, 01 Nov 2020 12:09:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727056AbgKAUGS (ORCPT + 99 others); Sun, 1 Nov 2020 15:06:18 -0500 Received: from inva021.nxp.com ([92.121.34.21]:41210 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726848AbgKAUGR (ORCPT ); Sun, 1 Nov 2020 15:06:17 -0500 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 20CDA200E27; Sun, 1 Nov 2020 21:06:16 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 1488A2000D9; Sun, 1 Nov 2020 21:06:16 +0100 (CET) Received: from fsr-ub1864-014.ea.freescale.net (fsr-ub1864-014.ea.freescale.net [10.171.95.219]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id BA58720306; Sun, 1 Nov 2020 21:06:15 +0100 (CET) From: =?UTF-8?q?Horia=20Geant=C4=83?= To: Herbert Xu , "David S. Miller" , Aymen Sghaier Cc: Andrei Botila , linux-crypto@vger.kernel.org, NXP Linux Team , linux-kernel@vger.kernel.org Subject: [PATCH] crypto: caam - fix printing on xts fallback allocation error path Date: Sun, 1 Nov 2020 22:05:53 +0200 Message-Id: <20201101200553.25248-1-horia.geanta@nxp.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org At the time xts fallback tfm allocation fails the device struct hasn't been enabled yet in the caam xts tfm's private context. Fix this by using the device struct from xts algorithm's private context or, when not available, by replacing dev_err with pr_err. Fixes: 9d9b14dbe077 ("crypto: caam/jr - add fallback for XTS with more than 8B IV") Fixes: 83e8aa912138 ("crypto: caam/qi - add fallback for XTS with more than 8B IV") Fixes: 36e2d7cfdcf1 ("crypto: caam/qi2 - add fallback for XTS with more than 8B IV") Signed-off-by: Horia Geantă --- drivers/crypto/caam/caamalg.c | 4 ++-- drivers/crypto/caam/caamalg_qi.c | 4 ++-- drivers/crypto/caam/caamalg_qi2.c | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index cf5bd7666dfc..8697ae53b063 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -3404,8 +3404,8 @@ static int caam_cra_init(struct crypto_skcipher *tfm) fallback = crypto_alloc_skcipher(tfm_name, 0, CRYPTO_ALG_NEED_FALLBACK); if (IS_ERR(fallback)) { - dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n", - tfm_name, PTR_ERR(fallback)); + pr_err("Failed to allocate %s fallback: %ld\n", + tfm_name, PTR_ERR(fallback)); return PTR_ERR(fallback); } diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c index 66f60d78bdc8..a24ae966df4a 100644 --- a/drivers/crypto/caam/caamalg_qi.c +++ b/drivers/crypto/caam/caamalg_qi.c @@ -2502,8 +2502,8 @@ static int caam_cra_init(struct crypto_skcipher *tfm) fallback = crypto_alloc_skcipher(tfm_name, 0, CRYPTO_ALG_NEED_FALLBACK); if (IS_ERR(fallback)) { - dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n", - tfm_name, PTR_ERR(fallback)); + pr_err("Failed to allocate %s fallback: %ld\n", + tfm_name, PTR_ERR(fallback)); return PTR_ERR(fallback); } diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c index 98c1ff1744bb..a780e627838a 100644 --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -1611,7 +1611,8 @@ static int caam_cra_init_skcipher(struct crypto_skcipher *tfm) fallback = crypto_alloc_skcipher(tfm_name, 0, CRYPTO_ALG_NEED_FALLBACK); if (IS_ERR(fallback)) { - dev_err(ctx->dev, "Failed to allocate %s fallback: %ld\n", + dev_err(caam_alg->caam.dev, + "Failed to allocate %s fallback: %ld\n", tfm_name, PTR_ERR(fallback)); return PTR_ERR(fallback); } -- 2.17.1