Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1320193pxk; Fri, 2 Oct 2020 06:49:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYTvgOIs8hh5Bvua1Ink3F6WO1DtC+BvKrZ6laINsr58PjjERQXcvkI+DM9Ez7NL9qmncL X-Received: by 2002:a17:906:3e48:: with SMTP id t8mr2337088eji.104.1601646576615; Fri, 02 Oct 2020 06:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601646576; cv=none; d=google.com; s=arc-20160816; b=omHiHHMPgcmmwf6IbcmChpqHU+JssInEKAOSXSd2dMUYS8IOEqQ/slm8KPJNWfpip+ BCrL4/q/tIab6DeJ+EzlHyxg2ioE+4yTrX3tagexoJ9A7q1vFgLVepWwJvHYGQFxvju9 0MZgFtm3PctPXgijYUoEpiW3LoA/4v9mRH6q/KbwP2XHOte6QExth5GntblpcvDqweqM /tbm1RzwrlWmwu3U+Xn/eD+OdgqbqoGiu+J6QVr5FwKK25+lMPaZIKpkBk33jMmD/+uz asLK73L3YkIAEqTaNvpFXTznoVBQOIeRkLVSmLohV5mbwtruRzY143KImhbh2XCin6jJ kUdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kOb99Db+lr33AJBJrd2/7V97PPzZGQrXCEnNbZlvUzo=; b=Xibj5sC84Y1OVCR8yEgbT0DQtOmFiQKJkuO0+qVCOQi24x1ezMiyDHIfLlIwTi+rMw GHUL85wgp+Ds+4cCTqvRVVb5XeBNGM4MVTopSqtrmcObZS/9Q4G3ZQXVwosYtxWlWZZQ pMBf4NgrOfzeoZQCdJEsZzJ6wveATgrN6bcybUlSXLT0pza5mn8HPNLUql+vHFkVK2Fn 1RGRAGjA15TEVbfD5ybS9B5kieYBmLBbPG2GZ1pG6KxwnJuTv7ibAtqMYx8aA3FjkPU/ jehQk61kedEbXglkNUgGfgLm8O7+OPXj2keq5cQmLk6ZUEv9BLb0cCOW0w0EgFlLhcv8 S4JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dJd81Bsy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m34si1129231ede.50.2020.10.02.06.49.11; Fri, 02 Oct 2020 06:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dJd81Bsy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726569AbgJBNsK (ORCPT + 99 others); Fri, 2 Oct 2020 09:48:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:44276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgJBNsK (ORCPT ); Fri, 2 Oct 2020 09:48:10 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC501206DB; Fri, 2 Oct 2020 13:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601646488; bh=On3C6AfBq5WmH6YaiAH/EGrBVGtl6dZcNpQ/eG3ByxI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dJd81BsySM3V/uiUgereBBHUniSuHI6LNzwiRtqQvVwFhVvvvmQI7PbhFu//68h8J KoWhasogTnpsuiJuRC523JF1soNGRrR1oZyMkcOJB8dR+xqeiIGYeUaVp9nW//AHGf jC52MwoE8uH6tmzC2otG80LzL5HHEc68nlRYMAwI= Date: Fri, 2 Oct 2020 15:48:07 +0200 From: Greg Kroah-Hartman To: Liu Shixin Cc: devel@driverdev.osuosl.org, Todd Kjos , Suren Baghdasaryan , linux-kernel@vger.kernel.org, Hridya Valsaraju , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Joel Fernandes , Martijn Coenen , Christian Brauner Subject: Re: [PATCH v3 -next] binder: simplify the return expression of binder_mmap Message-ID: <20201002134807.GA3427371@kroah.com> References: <20200927123538.GA292831@kroah.com> <20200929015216.1829946-1-liushixin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200929015216.1829946-1-liushixin2@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2020 at 09:52:16AM +0800, Liu Shixin wrote: > Simplify the return expression. > > Signed-off-by: Liu Shixin > --- > v3: Add the change description. > v2: Get rid of the "ret" and "failure string" variables. > v1: Simplify the return expression. > --- > drivers/android/binder.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index 37a505c41dec..49c0700816a5 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -5180,9 +5180,7 @@ static const struct vm_operations_struct binder_vm_ops = { > > static int binder_mmap(struct file *filp, struct vm_area_struct *vma) > { > - int ret; > struct binder_proc *proc = filp->private_data; > - const char *failure_string; > > if (proc->tsk != current->group_leader) > return -EINVAL; > @@ -5194,9 +5192,9 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) > (unsigned long)pgprot_val(vma->vm_page_prot)); > > if (vma->vm_flags & FORBIDDEN_MMAP_FLAGS) { > - ret = -EPERM; > - failure_string = "bad vm_flags"; > - goto err_bad_arg; > + pr_err("%s: %d %lx-%lx %s failed %d\n", __func__, > + proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM); > + return -EPERM; > } > vma->vm_flags |= VM_DONTCOPY | VM_MIXEDMAP; > vma->vm_flags &= ~VM_MAYWRITE; > @@ -5204,15 +5202,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) > vma->vm_ops = &binder_vm_ops; > vma->vm_private_data = proc; > > - ret = binder_alloc_mmap_handler(&proc->alloc, vma); > - if (ret) > - return ret; > - return 0; > - > -err_bad_arg: > - pr_err("%s: %d %lx-%lx %s failed %d\n", __func__, > - proc->pid, vma->vm_start, vma->vm_end, failure_string, ret); > - return ret; > + return binder_alloc_mmap_handler(&proc->alloc, vma); > } > > static int binder_open(struct inode *nodp, struct file *filp) > -- > 2.25.1 Todd and other Binder maintainers, what do you think of this? thanks, greg k-h