diff mbox series

[v1,5/5] SUNRPC: Remove pointer type casts from xdr_get_next_encode_buffer()

Message ID 165445913079.1664.5467024491080755855.stgit@bazille.1015granger.net (mailing list archive)
State New, archived
Headers show
Series Fix NFSv3 READDIRPLUS failures | expand

Commit Message

Chuck Lever June 5, 2022, 7:58 p.m. UTC
To make the code easier to read, remove visual clutter by changing
the declared type of @p.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 net/sunrpc/xdr.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

NeilBrown June 7, 2022, 1:08 a.m. UTC | #1
On Mon, 06 Jun 2022, Chuck Lever wrote:
> To make the code easier to read, remove visual clutter by changing
> the declared type of @p.

Oh yes - that's much nicer!

Reviewed-by: NeilBrown <neilb@suse.de>

Thanks,
NeilBrown

> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  net/sunrpc/xdr.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
> index 89cb48931a1f..4e4cad7aeec2 100644
> --- a/net/sunrpc/xdr.c
> +++ b/net/sunrpc/xdr.c
> @@ -955,9 +955,9 @@ EXPORT_SYMBOL_GPL(xdr_commit_encode);
>  static noinline __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
>  						   size_t nbytes)
>  {
> -	__be32 *p;
>  	int space_left;
>  	int frag1bytes, frag2bytes;
> +	void *p;
>  
>  	if (nbytes > PAGE_SIZE)
>  		goto out_overflow; /* Bigger buffers require special handling */
> @@ -986,12 +986,12 @@ static noinline __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
>  	 * xdr_commit_encode() has shifted this one back:
>  	 */
>  	p = page_address(*xdr->page_ptr);
> -	xdr->p = (void *)p + frag2bytes;
> +	xdr->p = p + frag2bytes;
>  	space_left = xdr->buf->buflen - xdr->buf->len;
>  	if (space_left - nbytes >= PAGE_SIZE)
> -		xdr->end = (void *)p + PAGE_SIZE;
> +		xdr->end = p + PAGE_SIZE;
>  	else
> -		xdr->end = (void *)p + space_left - frag1bytes;
> +		xdr->end = p + space_left - frag1bytes;
>  
>  	xdr->buf->page_len += frag2bytes;
>  	xdr->buf->len += nbytes;
> 
> 
>
diff mbox series

Patch

diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 89cb48931a1f..4e4cad7aeec2 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -955,9 +955,9 @@  EXPORT_SYMBOL_GPL(xdr_commit_encode);
 static noinline __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
 						   size_t nbytes)
 {
-	__be32 *p;
 	int space_left;
 	int frag1bytes, frag2bytes;
+	void *p;
 
 	if (nbytes > PAGE_SIZE)
 		goto out_overflow; /* Bigger buffers require special handling */
@@ -986,12 +986,12 @@  static noinline __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
 	 * xdr_commit_encode() has shifted this one back:
 	 */
 	p = page_address(*xdr->page_ptr);
-	xdr->p = (void *)p + frag2bytes;
+	xdr->p = p + frag2bytes;
 	space_left = xdr->buf->buflen - xdr->buf->len;
 	if (space_left - nbytes >= PAGE_SIZE)
-		xdr->end = (void *)p + PAGE_SIZE;
+		xdr->end = p + PAGE_SIZE;
 	else
-		xdr->end = (void *)p + space_left - frag1bytes;
+		xdr->end = p + space_left - frag1bytes;
 
 	xdr->buf->page_len += frag2bytes;
 	xdr->buf->len += nbytes;