2013-06-05 08:28:38

by Herbert Xu

[permalink] [raw]
Subject: Re: [cryptodev:master 2/13] lib/crc-t10dif.c:42:1-3: WARNING: PTR_RET can be used

On Mon, May 20, 2013 at 08:55:21PM +0800, kbuild test robot wrote:
> tree: git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
> head: 52188b6c27199e9b8fca6f7753464137a042efa1
> commit: 2d31e518a42828df7877bca23a958627d60408bc [2/13] crypto: crct10dif - Wrap crc_t10dif function all to use crypto transform framework
>
>
> coccinelle warnings: (new ones prefixed by >>)
>
> >> lib/crc-t10dif.c:42:1-3: WARNING: PTR_RET can be used
>
> Please consider folding the attached diff :-)
>
> ---
> 0-DAY kernel build testing backend Open Source Technology Center
> http://lists.01.org/mailman/listinfo/kbuild Intel Corporation

> [PATCH] crypto: fix coccinelle warnings
> TO: Herbert Xu <[email protected]>
> CC: Tim Chen <[email protected]>
> CC: [email protected]
>
> lib/crc-t10dif.c:42:1-3: WARNING: PTR_RET can be used
>
>
> Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR
>
> Generated by: coccinelle/api/ptr_ret.cocci
>
> Reported-by: Fengguang Wu <[email protected]>
> ---
>
> cocci-output-56141-45a4f6-crc-t10dif.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> --- a/lib/crc-t10dif.c
> +++ b/lib/crc-t10dif.c
> @@ -39,9 +39,7 @@ EXPORT_SYMBOL(crc_t10dif);
> static int __init crc_t10dif_mod_init(void)
> {
> crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0);
> - if (IS_ERR(crct10dif_tfm))
> - return PTR_ERR(crct10dif_tfm);
> - return 0;
> + return PTR_RET(crct10dif_tfm);
> }
>
> static void __exit crc_t10dif_mod_fini(void)

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt