From patchwork Wed Oct 18 07:42:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10013917 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84C6160215 for ; Wed, 18 Oct 2017 07:43:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7590128ABD for ; Wed, 18 Oct 2017 07:43:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 687C228AFC; Wed, 18 Oct 2017 07:43:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7A7828ABD for ; Wed, 18 Oct 2017 07:43:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762357AbdJRHnD (ORCPT ); Wed, 18 Oct 2017 03:43:03 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:39829 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762102AbdJRHnC (ORCPT ); Wed, 18 Oct 2017 03:43:02 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9I7gvYJ005674 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Oct 2017 07:42:57 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v9I7gv3I003595 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Oct 2017 07:42:57 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v9I7gu0v032018; Wed, 18 Oct 2017 07:42:56 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Oct 2017 00:42:55 -0700 Date: Wed, 18 Oct 2017 10:42:46 +0300 From: Dan Carpenter To: Matias Bjorling , Javier =?iso-8859-1?Q?Gonz=E1lez?= Cc: linux-block@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] lightnvm: pblk: fix error codes in pblk_submit_read_gc() Message-ID: <20171018074246.nmi75jmrpuu5g74y@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170609 (1.8.3) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a missing error code if pblk_bio_map_addr() fails. This function used to return NVM_IO_ERR on error and it still returns NVM_IO_OK (which is zero) on success, but now it returns negative error codes on failure. I decided to use a standard error code and remove the reference to NVM_IO_OK so that no one was confused. Fixes: d340121eb770 ("lightnvm: pblk: simplify data validity check on GC") Signed-off-by: Dan Carpenter Reviewed-by: Javier González diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c index ca79d8fb3e60..c26f527dbf86 100644 --- a/drivers/lightnvm/pblk-read.c +++ b/drivers/lightnvm/pblk-read.c @@ -528,7 +528,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq) struct bio *bio; struct nvm_rq rqd; int data_len; - int ret = NVM_IO_OK; + int ret; memset(&rqd, 0, sizeof(struct nvm_rq)); @@ -561,6 +561,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq) PBLK_VMALLOC_META, GFP_KERNEL); if (IS_ERR(bio)) { pr_err("pblk: could not allocate GC bio (%lu)\n", PTR_ERR(bio)); + ret = PTR_ERR(bio); goto err_free_dma; } @@ -595,7 +596,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq) out: nvm_dev_dma_free(dev->parent, rqd.meta_list, rqd.dma_meta_list); - return ret; + return 0; err_free_bio: bio_put(bio);