From patchwork Mon Oct 17 16:35:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9379919 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 F3D4B607D4 for ; Mon, 17 Oct 2016 16:35:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E267B268AE for ; Mon, 17 Oct 2016 16:35:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D25EA28D4D; Mon, 17 Oct 2016 16:35:58 +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=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 934CA268AE for ; Mon, 17 Oct 2016 16:35:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 26BA31A1E30; Mon, 17 Oct 2016 09:35:57 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 62A3A1A1E30 for ; Mon, 17 Oct 2016 09:35:56 -0700 (PDT) Received: by mail-pf0-x244.google.com with SMTP id r16so13087644pfg.3 for ; Mon, 17 Oct 2016 09:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kvi37dSmPhNQH7gQKjUPeS7X9pcsPl5L6Mdm4jqt8K8=; b=kW4/ltTJ+afSgdErSO+zOJS2sAvo7FFhYDr0V5els3PBmk81juJEd+Y4kL3o/y7SQp ib99vh8VqVpmQNvRNQiGAidch/zYoKxf3gh+Z60+eRG9jXJ/74YarLUkTug7ZbxkQH16 qqDKJ/jGTXAr1fofaj8NuSyYrKKbuxOoU7MzcAaKDODWBfaTPGSDFKd1kdEIhMIsCijL Z3JjcUDLUujYGGJVoW+n2w8z2HOd3UbY7562Kv+O5+OIDL2ThbIYMS7xcAO8oU/R6I+y Y2eecbH1GQ+Pn7ewWJk6IMtHMQk9087Wo2hGv0peuJoa038DlTafD1/m7oyIbi1Ma4K1 BSoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kvi37dSmPhNQH7gQKjUPeS7X9pcsPl5L6Mdm4jqt8K8=; b=WFR5Pl7JjIK2Iocg2kCfL7woO6KybPsA8cLO07WJ+40LpD9Fir+Cy/1kyTo4K3JX2k JGyzur0ndZ0osohwKCORUIusyqmV5/kAiI8VBIm5AOstf65A7O9EeEWlxc45p2OcGfxY YmwRGUqhyJiA0cOdI5hpATyQZ6/p6XmA4G87BhfLpK/wSJys2TL64VeU8Li3TIAH0LW/ zaf7gdxEYMOd3Y+SQeBmbrkxwf5VzmNyD/AJ8fFqVvBmAvxfuzVq7TQWckBvfVNE1yuS v/vPO3fcicZCG0yFudSZEItdwKTSUaOkjd/7KLzdPB1n3f9bUAcscDozVa5oaaJVzPCQ xTJg== X-Gm-Message-State: AA6/9Rmf1CubtWkK8N1N5rn/hTzKv+lt340wsyboV8p10b2Ofy1rd4sGg3KEvMyTCrPsdA== X-Received: by 10.99.53.135 with SMTP id c129mr32438100pga.180.1476722156007; Mon, 17 Oct 2016 09:35:56 -0700 (PDT) Received: from 192.168.0.37 (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id b139sm27257833pfb.8.2016.10.17.09.35.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2016 09:35:55 -0700 (PDT) From: Wei Yongjun To: Dan Williams Subject: [PATCH -next] libnvdimm: fix error return code in __blk_label_update() Date: Mon, 17 Oct 2016 16:35:48 +0000 Message-Id: <1476722148-22795-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wei Yongjun , linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun Fix to return error code -ENXIO from the nd_label_alloc_slot() error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun --- drivers/nvdimm/label.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c index fac7cab..ab2927c 100644 --- a/drivers/nvdimm/label.c +++ b/drivers/nvdimm/label.c @@ -710,8 +710,10 @@ static int __blk_label_update(struct nd_region *nd_region, if (is_old_resource(res, old_res_list, old_num_resources)) continue; /* carry-over */ slot = nd_label_alloc_slot(ndd); - if (slot == UINT_MAX) + if (slot == UINT_MAX) { + rc = -ENXIO; goto abort; + } dev_dbg(ndd->dev, "%s: allocated: %d\n", __func__, slot); nd_label = nd_label_base(ndd) + slot;