Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5348768imm; Tue, 31 Jul 2018 09:26:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcm4d1YmJc0czCsmlYVgq/Q9KKin2CReV5tEDTHaPg3bFeQpqVd+xs1oyrAHpFFq8nCGbDN X-Received: by 2002:a17:902:1665:: with SMTP id g92-v6mr21191943plg.293.1533054362851; Tue, 31 Jul 2018 09:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533054362; cv=none; d=google.com; s=arc-20160816; b=j6ECU7iXwkAyr7BJ5z/JlZw69XWcGBvwuCNkObBXhtEKLWvBESGEppl95PRnEKdWsz cQYcu7saUTaNz0LFBYDiOMtMwiIHSujh3KQCelFMXbozCkey8/pBjYonPAfafa+E0S6N Dt+X+TpqwX/ScQ7KIGkT0IHTXrk1VYkldqUfZxMKFjUX+ButF39iFnn6FRMsQYma1Egj w8RrzAskELlJDfzunG5MXqryietd8xSEP4aEITXMO6nR74GpRJCyVx46gFWrJK8SSHSU NHIOe8BmK2JRSLGCD7jJD1Aa5e6PUv3RdQ+oH35obz2HJGkzlGrxHYEvGutprzxgCvPW mPHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=nXVfBhNSNQHdXIfvYcTgXrRqx5lLggihl5s0BOm49rI=; b=AeqkP/YLIIKhOI4NYPrhZklkJBzP+kinuT60aGIe9lUL/p806Yyr6gMoOKybeHEa9M TtMzWErGkdmDZL7nrcpu7OgOsNwH2iNafxd7Ht4fft+H+p9VkrpQNvgUT10PKFrUlnq2 unAzGbgSjvphD72vxU0dxa767Y79Bhyj/3JqjNMQrgPRUDdpsielRr3mhScUL7ljMo+H PVdb7eWjroytUQLM37QrnOcNbRRCpewuw4dzBnPkAr2BXeznFJs5WVOR1UZEiOAGNhuJ /Jv7CxCasw/twk1apVmdqP5Y53LjSC+rHWOTDs9iTdtP1qDZjTv6LufkZKoLHz5tFBeR DQYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d20-v6si12478591pls.477.2018.07.31.09.25.47; Tue, 31 Jul 2018 09:26:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732466AbeGaSGD (ORCPT + 99 others); Tue, 31 Jul 2018 14:06:03 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:50058 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728052AbeGaSGD (ORCPT ); Tue, 31 Jul 2018 14:06:03 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 256EC9F4DD96F; Wed, 1 Aug 2018 00:24:54 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Wed, 1 Aug 2018 00:24:49 +0800 From: zhong jiang To: CC: , Subject: [PATCH] block/bsg-lib: use PTR_ERR_OR_ZERO to simplify the flow path Date: Wed, 1 Aug 2018 00:13:14 +0800 Message-ID: <1533053594-35244-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Simplify the code by using the PTR_ERR_OR_ZERO, instead of the open code. It is better. Signed-off-by: zhong jiang --- block/bsg-lib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/block/bsg-lib.c b/block/bsg-lib.c index 9419def..f3501cd 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -48,9 +48,8 @@ static int bsg_transport_fill_hdr(struct request *rq, struct sg_io_v4 *hdr, job->request_len = hdr->request_len; job->request = memdup_user(uptr64(hdr->request), hdr->request_len); - if (IS_ERR(job->request)) - return PTR_ERR(job->request); - return 0; + + return PTR_ERR_OR_ZERO(job->request); } static int bsg_transport_complete_rq(struct request *rq, struct sg_io_v4 *hdr) -- 1.7.12.4