Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10944106ybi; Thu, 25 Jul 2019 07:25:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRTzfGFWm3DSSpgZ87YoebBGNzjmoMc4oYdslbwSgJVlERh+pRvLZILdjwHzd0/MriMLGB X-Received: by 2002:a17:902:110b:: with SMTP id d11mr95276754pla.213.1564064739392; Thu, 25 Jul 2019 07:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564064739; cv=none; d=google.com; s=arc-20160816; b=cTX45Pip0zk43aVm5MnEb2vyhfhTJ02GJ2Y1oIaHsnHcBrtJvOpo8YDq4WjlcmkrAr Wsy5QecT+6koXpzaiK5/uIfVuwz3unAUDE5eDVlWdSWSYlw5cjVpJeQMNPDEVivp61f2 Z8Aq9Yivwcp3MkOjWdWPBgwCP+nETEiR9c51r14+H8aavYDB+cwvkSLg1Dx8a/1EtNA2 dfXIh2KwY4osiMfSsplWsHcG+93l7jzhnK+3ZOc6rVH5U8PZHy4gfAjtdWBjqshrGj44 Kooo0xcMtlQyyb4IGVqSZRKw84w8p5qm3wYXR8Tp3l99EixBUrRukl2pphS/YjkvXd3a So8Q== 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; bh=ND99bMCNs38SoFP3+px2WptFozKRg7jtzIQtN6z1GjY=; b=wcW7utDEaPKOkooMZr28BhnL+s1AwikGxKs5kyKOQSBD4lmfyNRTIdN1xPQzktGcnr COYzUR7IWAb9jvMLVjzJ2i7XCrZwhdWLfwZOIeV3ySTRaKm39isI9+2nm5yo34CyHPIm QaldgpBaT/YZnMelATMZpEseCNjpvNmanz1g0S5e3nWOwnMKjPS/p8eqiT7s2uKm/FmY e4tCzyOKZXCkW3DE020/RHkDDPLlADbX4Ac4dmkPmrVZxD160LA4tVp2kzSLeRGGPjQT bJ5XY4kGvu1BbjQZFv6x6ovrCjO9WE8NQFpYmjU8NXGGqbhCaG4t40zgT/g/VjTIpYWK FrnA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2si16917058pgm.242.2019.07.25.07.25.25; Thu, 25 Jul 2019 07:25:39 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404464AbfGYN67 (ORCPT + 99 others); Thu, 25 Jul 2019 09:58:59 -0400 Received: from inva021.nxp.com ([92.121.34.21]:58444 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728088AbfGYN6m (ORCPT ); Thu, 25 Jul 2019 09:58:42 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id BD7EB200725; Thu, 25 Jul 2019 15:58:40 +0200 (CEST) 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 B069A200053; Thu, 25 Jul 2019 15:58:40 +0200 (CEST) Received: from lorenz.ea.freescale.net (lorenz.ea.freescale.net [10.171.71.5]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 5D47E205E8; Thu, 25 Jul 2019 15:58:40 +0200 (CEST) From: Iuliana Prodan To: Herbert Xu , Horia Geanta , Aymen Sghaier Cc: "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx Subject: [PATCH v3 11/14] crypto: caam - free resources in case caam_rng registration failed Date: Thu, 25 Jul 2019 16:58:23 +0300 Message-Id: <1564063106-9552-12-git-send-email-iuliana.prodan@nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1564063106-9552-1-git-send-email-iuliana.prodan@nxp.com> References: <1564063106-9552-1-git-send-email-iuliana.prodan@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check the return value of the hardware registration for caam_rng and free resources in case of failure. Fixes: e24f7c9 ("crypto: caam - hwrng support") Signed-off-by: Iuliana Prodan --- Changes since v2: - update Fixes tag. --- drivers/crypto/caam/caamrng.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index 561bcb5..54c32d5 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -333,7 +333,10 @@ int caam_rng_init(struct device *ctrldev) goto free_rng_ctx; dev_info(dev, "registering rng-caam\n"); - return hwrng_register(&caam_rng); + + err = hwrng_register(&caam_rng); + if (!err) + return err; free_rng_ctx: kfree(rng_ctx); -- 2.1.0