Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3063942pxk; Mon, 21 Sep 2020 04:29:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhK9oSua/pI/pa9Xolp0rn5DAyJHBr4UY7vBt8ALqhfK6p8+LqEqSpcfto9E5B+xqWY4k2 X-Received: by 2002:a50:bf47:: with SMTP id g7mr52044559edk.26.1600687753137; Mon, 21 Sep 2020 04:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600687753; cv=none; d=google.com; s=arc-20160816; b=xQOTc+zPq+EYXzew26/W5/1F9cCKPxlUAdcpwHTf7G4nE3weRn1OvXfTsmPRQveZ+n jtUrVZDBKGtvQkIHzoc5reUb0upE0X6ySz2DE9VF9Qx5vsYDw4ymYGaPYxNXGss6sjsM UEFGaTN4sBYAVoQQoZmX2NMGnfGwYY1DKYzJEx8pMJCFtuzJRR5X4pOWr73qJ2btmUWr iOToCFDunm5Z1AKTZbCaWxv/CSq80IFy3WIHoWqaH7s0iZ00eapjdKusTA6oxwQaYkoC BCVUhGPpSnhHx6Faeu2KJMZtW9+vVmG/F67FHpy3EneZMRGYo+KSkJyOi3GH6Yw4IgbI 67yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=v1Sou+w72tlSzqO96kOc0UtE14RBkLAJu8UuHbajuxs=; b=BPeVn9iv6/vGTA/Q3AKRfUntXopu6MtJuZUobCg//d0Ml7gOfRDhQUv3pQ+sM4vBJx u1ILYp/FzALdd6znr1C60evYQdcKryBtabdpiLzieEluGbGXgksa9+Rgvq40+KKPnhSP p8cpMgASzGWe7DCTjOeCHnrJIsX5WRofBZgz6Ry0ZGUoIb/iDNOZvsoHBY1kb3eO/OBp CtNFKHWSpFaPDm9LQoprRXEE51+4TgKCDQE3dhZKd6D/egTWL61F960metEK47E2ZhWn wILr83QSVZ5WGma30iBHbu7Qg5ftzmGouJDy4896+FTwdxBVyEYGMpkndWNuYXotKoQM o2JQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w24si8178231edl.504.2020.09.21.04.28.49; Mon, 21 Sep 2020 04:29:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726753AbgIULZW (ORCPT + 99 others); Mon, 21 Sep 2020 07:25:22 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:45818 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726367AbgIULZV (ORCPT ); Mon, 21 Sep 2020 07:25:21 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 3FAAD3016D65BB5E18EA; Mon, 21 Sep 2020 19:25:18 +0800 (CST) Received: from huawei.com (10.175.113.32) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Mon, 21 Sep 2020 19:25:10 +0800 From: Liu Shixin To: Christian Brauner CC: Greg Kroah-Hartman , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Hridya Valsaraju , "Suren Baghdasaryan" , , , Liu Shixin Subject: [PATCH -next] binder: simplify the return expression of binder_mmap Date: Mon, 21 Sep 2020 19:47:34 +0800 Message-ID: <20200921114734.3272769-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200921080830.vrki7dcm64l46ppb@wittgenstein> References: <20200921080830.vrki7dcm64l46ppb@wittgenstein> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.32] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Simplify the return expression. Signed-off-by: Liu Shixin --- 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