From patchwork Fri Oct 13 12:45:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 10004679 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 7238960360 for ; Fri, 13 Oct 2017 13:03:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64AE428FD0 for ; Fri, 13 Oct 2017 13:03:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5995329029; Fri, 13 Oct 2017 13:03:34 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable 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 C607628FD0 for ; Fri, 13 Oct 2017 13:03:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758168AbdJMNDE (ORCPT ); Fri, 13 Oct 2017 09:03:04 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51282 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758034AbdJMMrM (ORCPT ); Fri, 13 Oct 2017 08:47:12 -0400 Received: by mail-wm0-f68.google.com with SMTP id f4so21572804wme.0 for ; Fri, 13 Oct 2017 05:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9mCGm6JMVeftRbnCeaxiw8TUgbhJ+MCsg+8ilryl0ds=; b=smAA91ii9Kx3AqPQpnNhnVKaAjfKr/KqoZ6jTlvLaGAq57tT3oW5lFLhYhoTsG4hRb YEx9jeAbXH0c+uJ9SIHGtB0rZgOxpRV4ewkROPd3OsbJSgaYtQ1rTCJ3FPNceKLVEl6Y OzzprujECweSjhghp5eWGT5S3VleyYfEAMH/k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9mCGm6JMVeftRbnCeaxiw8TUgbhJ+MCsg+8ilryl0ds=; b=hsm36+9mpmld08Ws7D/kEbz5Odk+eNL2HCC2GP9/FcDcJdSP3iyePd4vuLDVsy4yAI xFWmaJAu0SCxS6J2YAnE07xTxRrpTVZaYvkTWMboyessArP/DMaWMFje+f6A48zlit1i I5zq2b0xFA4tR03hXdyyu3NhcZKnUqU2p0GwqMZRjQv4UD8qHfEVpjkmgUkr5M4goWyz eAT7RHVx/x0oEOvDIYdTUVABv5fFCUS8Rax1iefp/bEvUxVvW/y1A6uEo+rT+JRWHg1H glmZC9+ZROZYM+NJ3hHEuna+66bJqcnDIug+eTh6KYinmL4TLXjaSV6sDjKyzi48Q42o guOw== X-Gm-Message-State: AMCzsaXF2oYeZ9+i1JlQnusgICBi/A7DdTNMKZMGSbVaJO0T21Hsh1hX HdX8WBhtV/fgmBJfO+4Qt8eQfQ== X-Google-Smtp-Source: AOwi7QD8A5MGeCt1QQvcrV2P+CrsUCp8asKG3XA3/PRgP4VcMwU10ODI+FNOCBGZaLiO1a3tpaZ6uQ== X-Received: by 10.80.177.27 with SMTP id k27mr2004815edd.159.1507898831303; Fri, 13 Oct 2017 05:47:11 -0700 (PDT) Received: from skyninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id p91sm735012edp.69.2017.10.13.05.47.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 05:47:10 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Rakesh Pandit , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 05/58] lightnvm: pblk: fix error path in pblk_lines_alloc_metadata Date: Fri, 13 Oct 2017 14:45:54 +0200 Message-Id: <20171013124647.32668-6-m@bjorling.me> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171013124647.32668-1-m@bjorling.me> References: <20171013124647.32668-1-m@bjorling.me> MIME-Version: 1.0 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 From: Rakesh Pandit Use appropriate memory free calls based on allocation type used and also fix number of times free is called if kmalloc fails. Signed-off-by: Rakesh Pandit Reviewed-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 6df65d1..05665a7 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -630,7 +630,10 @@ static int pblk_lines_alloc_metadata(struct pblk *pblk) fail_free_emeta: while (--i >= 0) { - vfree(l_mg->eline_meta[i]->buf); + if (l_mg->emeta_alloc_type == PBLK_VMALLOC_META) + vfree(l_mg->eline_meta[i]->buf); + else + kfree(l_mg->eline_meta[i]->buf); kfree(l_mg->eline_meta[i]); }