Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4611557ybi; Tue, 30 Jul 2019 05:10:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXuhoxXJFmqOj7BwnU3eEJYHw0Ok2eWK4LlCNvaaM4borwwGPmxbaNDZLx9CjeRZ56ilPZ X-Received: by 2002:a17:902:b415:: with SMTP id x21mr30692743plr.287.1564488631362; Tue, 30 Jul 2019 05:10:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564488631; cv=none; d=google.com; s=arc-20160816; b=xfrB4EN4+6TEloJQLTCzuIDeRA0epcYjiUzulsKflpJEB8+BrzAPL2rfUCXENOdd1q mE0+kNCc/gDWeGFZ7AfbIGABUz6OHb0kWZkEvqwjEUTSJP0EqQG2iOsuXVTzFCMn4xde uJTkqmuD5Uz1o9AySCu4gj9gUix62d60yDX+qIKmw/odVQZLQHH6eclVTqWKIG1/1N1X ZsXMpJz4slrPPZXf6CVd72Oznpa+XvvNtXoxIs2G11c9AcDEDy0BY+/cN1kD/XYbf5rV dp0nMoVRDPDXgnsiMKVjrOzw4vYFmO+3hdkoHbD4+sGtuLHrPa331RSZWWG+gi0h05uB xJ6Q== 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=5mI3RzOfNTTdHbEd3WQX6/WXVrcZ56qUCKM6vtumBG4=; b=T0/N6d5tnXSB74ZM5rkLRuNFH71XVWdbjz16ZGLyjRjJBOH7hSuTUqDZwsK7KHaeg1 ULBWMZ8UlMI8WXX96P6+8BjQn6KYzBbLAJSLjxV5dWp25BEypzcuPHq0sUL6WZ48k0Nl yN969xAlo1EqH7qbEuOozMUVrhwr9MUo1+z+NSGRkff1P04tK34CxHpFpvz6H/ZuXJNT xsh5voyEG9BIPdV152GOord5+dBDz1SOvYdSvT2vqFcQbCjFzb/8pRoFenwzEpsz75cO lZrxUgYcG0e16FlNhc604RiHw+o6jd/WgkEDpW4T5sAGqw66z4LBvr8QZhbydgcdgPB6 oHOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id g1si29683365pfh.47.2019.07.30.05.10.17; Tue, 30 Jul 2019 05:10:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 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 S1727848AbfG3LHf (ORCPT + 99 others); Tue, 30 Jul 2019 07:07:35 -0400 Received: from inva021.nxp.com ([92.121.34.21]:55662 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730310AbfG3LGz (ORCPT ); Tue, 30 Jul 2019 07:06:55 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 1EE9F20066A; Tue, 30 Jul 2019 13:06:54 +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 1282B20065E; Tue, 30 Jul 2019 13:06:54 +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 98221204D6; Tue, 30 Jul 2019 13:06:53 +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 v4 11/14] crypto: caam - free resources in case caam_rng registration failed Date: Tue, 30 Jul 2019 14:06:42 +0300 Message-Id: <1564484805-28735-12-git-send-email-iuliana.prodan@nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1564484805-28735-1-git-send-email-iuliana.prodan@nxp.com> References: <1564484805-28735-1-git-send-email-iuliana.prodan@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Check the return value of the hardware registration for caam_rng and free resources in case of failure. Fixes: e24f7c9e87d4 ("crypto: caam - hwrng support") Signed-off-by: Iuliana Prodan Reviewed-by: Horia Geanta --- Changes since v3: - update Fixes tag with 12 characters of the SHA1. --- 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