Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3440212pxk; Mon, 28 Sep 2020 18:32:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1p89PgMEJQCHUufiD8OmVhL9YIxH0s+yBMupNTS+rJL49iodzKQfD6HGq4j6gmDhaqVhx X-Received: by 2002:a17:906:6ce:: with SMTP id v14mr1426445ejb.451.1601343129395; Mon, 28 Sep 2020 18:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601343129; cv=none; d=google.com; s=arc-20160816; b=xUyASp3GCFsbQS43Qs4ds4amLPQqqZ8dEUjA4qjFXzSq9ixSbgqlgiE34Hrwt7gfWS kX4ffbHFJL7v0eE2OdXBScw+ncuy+Kh23309/tAbqERPsytLAgS7DBONQRQimbp5Bjg3 uEHpzo4kMuTbitV1n+LUjkK5g4FpvbNtazRM8YsFbxseWi79zchpJCn30+Tg/I2QYy/W s9x51hWIJAjcjMbUsxP/fsxzh/FAVei2sC3WYIjAaMDi/cD4vRL9LfAfXhwqyrwhrrb8 jL53+VW7/rLwj90ajecIr5+WTmNhSDge4Vu2yGitSP/z6GFb0C4BMJD5DMeTkOysO7CG yoYQ== 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=Qqb4rkn5vPosuF7+c1xTcWQsiqKXiD6l3BleCuECEls=; b=fhJl27FyCLBuvjtReXJoOMeq+ABMfq8PROi+JOqEj+Tx4e+FeD81uxATX5pznV4AFR jJkNndnPYEkvxxvXFdh9xJA47UEQA3U98ZSmsu8e2SwucFOhHfF842pmNwsUl7RaI+0Z LUn8n/3yH8F8Gn1I1GgCNbW49bkF50db7MWBCybBWQmvtWQWPHVZBQoIFMZiwoNsRfFB FDidoF9997GXKhe7sOTvln6WquNeyHiwUL+tNDglI2VP71T+Fk0Sb7gWt9X/cc8BFRGs o0brPKhEZAUiaFO13Vz7hxXqn4pyf0gVPK+aYrpKWuvn3v6N/g/I3+x1kNXJJov8iijt 9uiQ== 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 u10si1762198edo.419.2020.09.28.18.31.39; Mon, 28 Sep 2020 18:32:09 -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 S1727088AbgI2BaU (ORCPT + 99 others); Mon, 28 Sep 2020 21:30:20 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:36828 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726379AbgI2BaT (ORCPT ); Mon, 28 Sep 2020 21:30:19 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 0550174F066577A8B0FD; Tue, 29 Sep 2020 09:30:18 +0800 (CST) Received: from huawei.com (10.175.113.32) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Tue, 29 Sep 2020 09:30:09 +0800 From: Liu Shixin To: Greg Kroah-Hartman CC: Christian Brauner , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Hridya Valsaraju , "Suren Baghdasaryan" , , , Liu Shixin Subject: [PATCH v3 -next] binder: simplify the return expression of binder_mmap Date: Tue, 29 Sep 2020 09:52:16 +0800 Message-ID: <20200929015216.1829946-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200927123538.GA292831@kroah.com> References: <20200927123538.GA292831@kroah.com> 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 --- 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