From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34275C4363D for ; Fri, 2 Oct 2020 13:48:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2CF5206FA for ; Fri, 2 Oct 2020 13:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601646491; bh=On3C6AfBq5WmH6YaiAH/EGrBVGtl6dZcNpQ/eG3ByxI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=DnCqW8Thu+yYVER22NbEzlh7/qPU9/wY+SNy4ESniBTQ2D73EIBvMTl/l4y7dd6Td LZcHY4q9GU4qY1GFLbiicF5sA7cCmKcwqynG2TSytWcngeYBtWVjbPSUTxwEVwG+6V 9EyEL0uoCrzgRiSWXp4myYOKhBO4RXEj+k35G6G0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387768AbgJBNsK (ORCPT ); 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6D7DC4363D for ; Fri, 2 Oct 2020 13:48:17 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 71167206E3 for ; Fri, 2 Oct 2020 13:48:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="dJd81Bsy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71167206E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9799E86722; Fri, 2 Oct 2020 13:48:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7C6qsdkDx6du; Fri, 2 Oct 2020 13:48:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id B9946866A9; Fri, 2 Oct 2020 13:48:13 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id CBB381BF2E3 for ; Fri, 2 Oct 2020 13:48:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id BCD1F2751C for ; Fri, 2 Oct 2020 13:48:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SNs8o9aztfhS for ; Fri, 2 Oct 2020 13:48:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by silver.osuosl.org (Postfix) with ESMTPS id B2C76274ED for ; Fri, 2 Oct 2020 13:48:08 +0000 (UTC) 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 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-Disposition: inline In-Reply-To: <20200929015216.1829946-1-liushixin2@huawei.com> X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, Todd Kjos , Martijn Coenen , linux-kernel@vger.kernel.org, Joel Fernandes , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Hridya Valsaraju , Suren Baghdasaryan , Christian Brauner Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" 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 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel