Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp604467yba; Thu, 18 Apr 2019 06:42:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLefsVrS5mPIsUNn+VVvNI0u6k7+TL0MoRfkMEEQCpppbtTm+77EhKKETcUZVL8BPJf9fD X-Received: by 2002:a62:204b:: with SMTP id g72mr94161030pfg.51.1555594954385; Thu, 18 Apr 2019 06:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555594954; cv=none; d=google.com; s=arc-20160816; b=UksaNQ4+N42rbTM67OKssH9QPQOvttgPEsIS1dThF1Q7v+z7X8MFs2bGPvc9Yugw1s mtKW+KmcG0+VybBuGp5gDFO9620/X/JWRmy/WqlASPbCuUdGZxNo7RfOuGt/DQ0IXwZO jVoR8J/3WZ2EkjRclkcrU0QVUjzPEXjWHa5f2SpSwye8h11GCSxSfmrnKr5atHWETqIF +zTsX98cUFp5WmycWIDzYpG7lvdG3/qMHJDk4nY5Ambm9kihygidZCXeD3v/iySSZYLY ZZsSOmTSM6EbUFc8TN79cNIXHxliTDhhjn4updHLMhHJf5WhfSkCNuyZqzF4rIf3RJNh hQPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DEeL4kqOlQdCGEDS1Y3gLgOCqfsf5wtlpuGx+ew5ttQ=; b=0JbWBopXKG+zHeO2PuVZaCFHnj7UW7G4WVLrcZv5oYkP/55vJyGpsDHH35+8cLXVaY fuqyj+RtBr3h532BlQXK0SdULZ2R7uflc42VKmtcM43IpUadRFK7EqTbJ+971PwJQ+Lr pC35TciIFknvbZOlDNH1oR+Z4HY+rL7tEBdkyzj1BfRYrFw5YvqDiaOcndzzhn3Pgj+E N9vk+POQ507FFsOUEVkzhkQPr4KNeeISMn5/Jjha71lXSs7OaUdefgpnt4lhoizzEYk/ FYtHRp6IwGdo+Ow7/XR+lJU6c/7GueMKXQMsxWHPfVdZLIwg15M+x9qbYzq6g5fC5ljQ wQKA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x8si2155212pll.207.2019.04.18.06.42.19; Thu, 18 Apr 2019 06:42:34 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389373AbfDRNky (ORCPT + 99 others); Thu, 18 Apr 2019 09:40:54 -0400 Received: from foss.arm.com ([217.140.101.70]:33620 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388301AbfDRNkx (ORCPT ); Thu, 18 Apr 2019 09:40:53 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 52B9B80D; Thu, 18 Apr 2019 06:40:53 -0700 (PDT) Received: from e110176-lin.kfn.arm.com (e110176-lin.kfn.arm.com [10.50.4.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB4663F5AF; Thu, 18 Apr 2019 06:40:51 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 16/35] crypto: ccree: use devm_kzalloc for device data Date: Thu, 18 Apr 2019 16:38:51 +0300 Message-Id: <20190418133913.9122-17-gilad@benyossef.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418133913.9122-1-gilad@benyossef.com> References: <20190418133913.9122-1-gilad@benyossef.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move some remaining device data allocation to the safer devm_* interface. Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccree/cc_fips.c | 4 +--- drivers/crypto/ccree/cc_sram_mgr.c | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/ccree/cc_fips.c b/drivers/crypto/ccree/cc_fips.c index b4d0a6d983e0..9c03ab238a75 100644 --- a/drivers/crypto/ccree/cc_fips.c +++ b/drivers/crypto/ccree/cc_fips.c @@ -49,8 +49,6 @@ void cc_fips_fini(struct cc_drvdata *drvdata) /* Kill tasklet */ tasklet_kill(&fips_h->tasklet); - - kfree(fips_h); drvdata->fips_handle = NULL; } @@ -104,7 +102,7 @@ int cc_fips_init(struct cc_drvdata *p_drvdata) if (p_drvdata->hw_rev < CC_HW_REV_712) return 0; - fips_h = kzalloc(sizeof(*fips_h), GFP_KERNEL); + fips_h = devm_kzalloc(dev, sizeof(*fips_h), GFP_KERNEL); if (!fips_h) return -ENOMEM; diff --git a/drivers/crypto/ccree/cc_sram_mgr.c b/drivers/crypto/ccree/cc_sram_mgr.c index c8c276f6dee9..86319788e390 100644 --- a/drivers/crypto/ccree/cc_sram_mgr.c +++ b/drivers/crypto/ccree/cc_sram_mgr.c @@ -19,8 +19,7 @@ struct cc_sram_ctx { */ void cc_sram_mgr_fini(struct cc_drvdata *drvdata) { - /* Free "this" context */ - kfree(drvdata->sram_mgr_handle); + /* Nothing needed */ } /** @@ -48,7 +47,7 @@ int cc_sram_mgr_init(struct cc_drvdata *drvdata) } /* Allocate "this" context */ - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; -- 2.21.0