diff mbox series

[v1] cifs: convert to use ERR_CAST()

Message ID 20240829115241.3204608-1-liyuesong@vivo.com (mailing list archive)
State New, archived
Headers show
Series [v1] cifs: convert to use ERR_CAST() | expand

Commit Message

Yuesong Li Aug. 29, 2024, 11:52 a.m. UTC
Use ERR_CAST() as it is designed for casting an error pointer to
another type.

This macro uses the __force and __must_check modifiers, which are used
to tell the compiler to check for errors where this macro is used.

Signed-off-by: Yuesong Li <liyuesong@vivo.com>
---
 fs/smb/client/connect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steve French Sept. 1, 2024, 4:44 a.m. UTC | #1
tentatively merged to cifs-2.6.git for-next-next (target for 6.12-rc)
pending additional review and testing

On Thu, Aug 29, 2024 at 6:53 AM Yuesong Li <liyuesong@vivo.com> wrote:
>
> Use ERR_CAST() as it is designed for casting an error pointer to
> another type.
>
> This macro uses the __force and __must_check modifiers, which are used
> to tell the compiler to check for errors where this macro is used.
>
> Signed-off-by: Yuesong Li <liyuesong@vivo.com>
> ---
>  fs/smb/client/connect.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
> index c1c14274930a..c51b536aa9ad 100644
> --- a/fs/smb/client/connect.c
> +++ b/fs/smb/client/connect.c
> @@ -4069,7 +4069,7 @@ __cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
>
>         ses = cifs_get_smb_ses(master_tcon->ses->server, ctx);
>         if (IS_ERR(ses)) {
> -               tcon = (struct cifs_tcon *)ses;
> +               tcon = ERR_CAST(ses);
>                 cifs_put_tcp_session(master_tcon->ses->server, 0);
>                 goto out;
>         }
> --
> 2.34.1
>
>
Steve French Sept. 10, 2024, 6:31 a.m. UTC | #2
merged into cifs-2.6.git for-next

On Thu, Aug 29, 2024 at 6:53 AM Yuesong Li <liyuesong@vivo.com> wrote:
>
> Use ERR_CAST() as it is designed for casting an error pointer to
> another type.
>
> This macro uses the __force and __must_check modifiers, which are used
> to tell the compiler to check for errors where this macro is used.
>
> Signed-off-by: Yuesong Li <liyuesong@vivo.com>
> ---
>  fs/smb/client/connect.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
> index c1c14274930a..c51b536aa9ad 100644
> --- a/fs/smb/client/connect.c
> +++ b/fs/smb/client/connect.c
> @@ -4069,7 +4069,7 @@ __cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
>
>         ses = cifs_get_smb_ses(master_tcon->ses->server, ctx);
>         if (IS_ERR(ses)) {
> -               tcon = (struct cifs_tcon *)ses;
> +               tcon = ERR_CAST(ses);
>                 cifs_put_tcp_session(master_tcon->ses->server, 0);
>                 goto out;
>         }
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index c1c14274930a..c51b536aa9ad 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -4069,7 +4069,7 @@  __cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
 
 	ses = cifs_get_smb_ses(master_tcon->ses->server, ctx);
 	if (IS_ERR(ses)) {
-		tcon = (struct cifs_tcon *)ses;
+		tcon = ERR_CAST(ses);
 		cifs_put_tcp_session(master_tcon->ses->server, 0);
 		goto out;
 	}