All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Rohit Chavan <roheetchavan@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib80211: Use ERR_CAST() to return
Date: Fri, 6 Sep 2024 20:08:08 +0100	[thread overview]
Message-ID: <20240906190808.GL2097826@kernel.org> (raw)
In-Reply-To: <20240906114455.730559-1-roheetchavan@gmail.com>

On Fri, Sep 06, 2024 at 05:14:55PM +0530, Rohit Chavan wrote:
> Using ERR_CAST() is more reasonable and safer, When it is necessary
> to convert the type of an error pointer and return it.
> 
> Signed-off-by: Rohit Chavan <roheetchavan@gmail.com>
> ---
>  net/wireless/lib80211.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/wireless/lib80211.c b/net/wireless/lib80211.c
> index d66a913027e0..87c0e09aa676 100644
> --- a/net/wireless/lib80211.c
> +++ b/net/wireless/lib80211.c
> @@ -227,7 +227,7 @@ EXPORT_SYMBOL(lib80211_get_crypto_ops);
>  
>  static void *lib80211_crypt_null_init(int keyidx)
>  {
> -	return (void *)1;
> +	return ERR_CAST(1);

This seems wrong to me. ERR_CAST is designed to cast a pointer
to an error pointer. But 1 is an integer, not a pointer.

>  }
>  
>  static void lib80211_crypt_null_deinit(void *priv)
> -- 
> 2.34.1
> 
> 

  parent reply	other threads:[~2024-09-06 19:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 11:44 [PATCH] lib80211: Use ERR_CAST() to return Rohit Chavan
2024-09-06 11:54 ` Johannes Berg
2024-09-06 19:08 ` Simon Horman [this message]
2024-09-07  7:47 ` kernel test robot
2024-09-07  7:47 ` kernel test robot
2024-09-07 20:08 ` Al Viro
2024-09-07 21:49 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240906190808.GL2097826@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=roheetchavan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.