Subject: Re: [PATCH v1 net] af_unix: Add error handling in af_unix_init().

From: Jakub Kicinski <[email-masked]>
Date: Wed, 14 Dec 2022 12:55:53 -0800

On Wed, 14 Dec 2022 18:20:08 +0900 Kuniyuki Iwashima wrote:
>  static int __init af_unix_init(void)
>  {
> -	int i, rc = -1;
> +	int i, rc;

This is just a cleanup, right? Let's skip it, it will conflict.

>  	BUILD_BUG_ON(sizeof(struct unix_skb_parms) > sizeof_field(struct sk_buff, cb));
>  
> @@ -3730,20 +3730,25 @@ static int __init af_unix_init(void)
>  	}
>  
>  	rc = proto_register(&unix_dgram_proto, 1);
> -	if (rc != 0) {
> +	if (rc) {
>  		pr_crit("%s: Cannot create unix_sock SLAB cache!\n", __func__);

Should this message be updated?

>  		goto out;
>  	}
>  
>  	rc = proto_register(&unix_stream_proto, 1);
> -	if (rc != 0) {
> +	if (rc) {
>  		pr_crit("%s: Cannot create unix_sock SLAB cache!\n", __func__);

And this?

> -		proto_unregister(&unix_dgram_proto);
> -		goto out;
> +		goto err_proto_register;
>  	}