Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933505AbcKMLTY (ORCPT ); Sun, 13 Nov 2016 06:19:24 -0500 Received: from helcar.hengli.com.au ([209.40.204.226]:43597 "EHLO helcar.hengli.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932371AbcKMLTW (ORCPT ); Sun, 13 Nov 2016 06:19:22 -0500 Date: Sun, 13 Nov 2016 19:19:10 +0800 From: Herbert Xu To: Nadim Almas Cc: davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Crypto: mv_cesa: Switch to using managed resources Message-ID: <20161113111910.GA7900@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161102115845.GA8386@gmail.com> Organization: Core X-Newsgroups: apana.lists.os.linux.cryptoapi,apana.lists.os.linux.kernel User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1066 Lines: 46 Nadim Almas wrote: > Switch to resource-managed function devm_kzalloc instead > of kzalloc and remove unneeded kfree > > Also, remove kfree in probe function and remove > function, mv_remove as it is now has nothing to do. > The Coccinelle semantic patch used to make this change is as follows: > // > @platform@ > identifier p, probefn, removefn; > @@ > struct platform_driver p = { > .probe = probefn, > .remove = removefn, > }; > > @prb@ > identifier platform.probefn, pdev; > expression e, e1, e2; > @@ > probefn(struct platform_device *pdev, ...) { > <+... > - e = kzalloc(e1, e2) > + e = devm_kzalloc(&pdev->dev, e1, e2) > ... > ?-kfree(e); > ...+> > } > @rem depends on prb@ > identifier platform.removefn; > expression prb.e; > @@ > removefn(...) { > <... > - kfree(e); > ...> > } > // > > Signed-off-by: Nadim Almas Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt