Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5326411ybv; Tue, 11 Feb 2020 13:34:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwWyYobOMJriCt2s058nQBtv7bU9P/xLhyAoVjwb6r32kBYNdey1D2qHhhC1eAc61MOaCjQ X-Received: by 2002:a9d:470a:: with SMTP id a10mr6944606otf.370.1581456853977; Tue, 11 Feb 2020 13:34:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581456853; cv=none; d=google.com; s=arc-20160816; b=Ye75/PkIBEtZr06x2oP3WJsL2o/zbdhtmAkp2jh7p75AXlciktBrs++6LIVNs8QMi3 wuw/0uV4QOOwHajSKF4CPZfto9WM+HOHv/vc954kYVOOnlHO0I/0oZald9/VzRaN+Kea lXASQeK44a22AtHVzk9UZ8T2X64y2HTrDpNDiWQXFtM/blvQ5dEJhNI38mpTb4wsQpYx TZ3k6LYQpC67lywg6UtUixs5Dlg+TYdZrmMRLapmmDOliWlv8ZwsyXUcP+MQAtgyOQQb BbNeimsl+7rFK4Ybx9EwiUDbDZ2x4y3Uc1JIs9RXbJALeOS3lYAtjTgH9kh7sFyvE76f deYw== 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=RXuoHmvoNn7Wc0NnuwAzKcyhSz3r4+NEheEUvW89/Do=; b=q/348Jtb3D4SBArtBOxgE4945dJgulcL2iAt/SkQu119cXoqZlxxNS4eZvprbkO9Is xEB2sZYA9JKQedgy3KuYR8MPILMrHRCClgCpx4Yl7tsMW1RDzxX95NRCA9FxZS34238H 5/USvXyMBOpSlgAYSHWv9d10hfzV3x47yi5kQw6lh/CubL36eA5z9ZW6DtlKTGJ5/OLc yxeTHEh0lQQlEgsX+RsrhnN33fUiU0HZkkaa1ygBMO105SjZMk56druJPfXwm52mcYLD vF09ga2GzXqtKnUIGjHvYcbMKTsOKDxQVJ5U6bYead1mcj/F3mK1MY2ciTpqxA+qlSND DwMQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s143si2236315oih.251.2020.02.11.13.34.03; Tue, 11 Feb 2020 13:34:13 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730161AbgBKSUf (ORCPT + 99 others); Tue, 11 Feb 2020 13:20:35 -0500 Received: from albert.telenet-ops.be ([195.130.137.90]:60510 "EHLO albert.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731145AbgBKSTd (ORCPT ); Tue, 11 Feb 2020 13:19:33 -0500 Received: from ramsan ([84.195.182.253]) by albert.telenet-ops.be with bizsmtp id 1WKV2200M5USYZQ06WKWPC; Tue, 11 Feb 2020 19:19:30 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1j1a8A-0002pO-I2; Tue, 11 Feb 2020 19:19:30 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1j1a8A-0003zf-Gd; Tue, 11 Feb 2020 19:19:30 +0100 From: Geert Uytterhoeven To: Gilad Ben-Yossef , Herbert Xu , "David S . Miller" Cc: Greg Kroah-Hartman , "Rafael J . Wysocki" , linux-crypto@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 33/34] crypto: ccree - use devm_k[mz]alloc() for cipher data Date: Tue, 11 Feb 2020 19:19:27 +0100 Message-Id: <20200211181928.15178-34-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200211181928.15178-1-geert+renesas@glider.be> References: <20200211181928.15178-1-geert+renesas@glider.be> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org As the lifetime of the cipher data matches the lifetime of the driver, cipher data can be allocated using the managed allocators. Signed-off-by: Geert Uytterhoeven --- v2: - New. drivers/crypto/ccree/cc_cipher.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index 517d78f9931943a3..44dc8e6229062a02 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -1634,7 +1634,7 @@ static struct cc_crypto_alg *cc_create_alg(const struct cc_alg_template *tmpl, struct cc_crypto_alg *t_alg; struct skcipher_alg *alg; - t_alg = kzalloc(sizeof(*t_alg), GFP_KERNEL); + t_alg = devm_kzalloc(dev, sizeof(*t_alg), GFP_KERNEL); if (!t_alg) return ERR_PTR(-ENOMEM); @@ -1670,7 +1670,6 @@ int cc_cipher_free(struct cc_drvdata *drvdata) list_for_each_entry_safe(t_alg, n, &drvdata->alg_list, entry) { crypto_unregister_skcipher(&t_alg->skcipher_alg); list_del(&t_alg->entry); - kfree(t_alg); } return 0; } @@ -1711,7 +1710,6 @@ int cc_cipher_alloc(struct cc_drvdata *drvdata) if (rc) { dev_err(dev, "%s alg registration failed\n", t_alg->skcipher_alg.base.cra_driver_name); - kfree(t_alg); goto fail0; } -- 2.17.1