Skip to content

Commit d9c2ede

Browse files
eldadJ. Bruce Fields
authored andcommitted
sunrpc/cache.h: fix coding style
Neaten code style in get_int(). Also use sizeof() instead of hard coded number as suggested by Joe Perches <joe@perches.com>. Cc: Joe Perches <joe@perches.com> Signed-off-by: Eldad Zack <eldad@fogrefinery.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 7f2e7dc commit d9c2ede

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎include/linux/sunrpc/cache.h‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,17 @@ static inline int get_int(char **bpp, int *anint)
219219
char buf[50];
220220
char *ep;
221221
int rv;
222-
int len = qword_get(bpp, buf, 50);
223-
if (len < 0) return -EINVAL;
224-
if (len ==0) return -ENOENT;
222+
int len = qword_get(bpp, buf, sizeof(buf));
223+
224+
if (len < 0)
225+
return -EINVAL;
226+
if (len == 0)
227+
return -ENOENT;
228+
225229
rv = simple_strtol(buf, &ep, 0);
226-
if (*ep) return -EINVAL;
230+
if (*ep)
231+
return -EINVAL;
232+
227233
*anint = rv;
228234
return 0;
229235
}

0 commit comments

Comments
 (0)