[PATCH net-next 2/8] net/rds: Use max() to simplify the code
Allison Henderson
allison.henderson at oracle.com
Mon Aug 26 22:28:22 PDT 2024
On Sat, 2024-08-24 at 15:40 +0800, Hongbo Li wrote:
> The target if-else can be replaced with max().
>
> Signed-off-by: Hongbo Li <lihongbo22 at huawei.com>
Looks simple enough to me. Thanks Hongbo!
Reviewed-by: Allison Henderson <allison.henderson at oracle.com>
> ---
> net/rds/info.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/net/rds/info.c b/net/rds/info.c
> index b6b46a8214a0..8558b0a466b4 100644
> --- a/net/rds/info.c
> +++ b/net/rds/info.c
> @@ -194,10 +194,7 @@ int rds_info_getsockopt(struct socket *sock, int
> optname, char __user *optval,
> }
> ret = pin_user_pages_fast(start, nr_pages, FOLL_WRITE,
> pages);
> if (ret != nr_pages) {
> - if (ret > 0)
> - nr_pages = ret;
> - else
> - nr_pages = 0;
> + nr_pages = max(ret, 0);
> ret = -EAGAIN; /* XXX ? */
> goto out;
> }
More information about the linux-afs
mailing list