Skip to content

Commit

Permalink
xen/xenbus: Convert to use ERR_CAST()
Browse files Browse the repository at this point in the history
Use ERR_CAST() as it is designed for casting an error pointer to
another type.

This macro utilizes the __force and __must_check modifiers, which instruct
the compiler to verify for errors at the locations where it is employed.

Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Message-ID: <20240829084710.30312-1-shenlichuan@vivo.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
  • Loading branch information
Shen Lichuan authored and Juergen Gross committed Sep 12, 2024
1 parent fbe5a6d commit 3adc73e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/xen/xenbus/xenbus_xs.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,12 @@ char **xenbus_directory(struct xenbus_transaction t,

path = join(dir, node);
if (IS_ERR(path))
return (char **)path;
return ERR_CAST(path);

strings = xs_single(t, XS_DIRECTORY, path, &len);
kfree(path);
if (IS_ERR(strings))
return (char **)strings;
return ERR_CAST(strings);

return split(strings, len, num);
}
Expand Down Expand Up @@ -465,7 +465,7 @@ void *xenbus_read(struct xenbus_transaction t,

path = join(dir, node);
if (IS_ERR(path))
return (void *)path;
return ERR_CAST(path);

ret = xs_single(t, XS_READ, path, len);
kfree(path);
Expand Down

0 comments on commit 3adc73e

Please sign in to comment.