From patchwork Sun Feb 19 19:27:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9581793 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 AAADF604A0 for ; Sun, 19 Feb 2017 19:39:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8764F286ED for ; Sun, 19 Feb 2017 19:39:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6886C28708; Sun, 19 Feb 2017 19:39:45 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 10664286ED for ; Sun, 19 Feb 2017 19:39:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751112AbdBSTjn (ORCPT ); Sun, 19 Feb 2017 14:39:43 -0500 Received: from smtp04.smtpout.orange.fr ([80.12.242.126]:16716 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbdBSTjn (ORCPT ); Sun, 19 Feb 2017 14:39:43 -0500 Received: from localhost.localdomain ([92.140.226.155]) by mwinf5d39 with ME id mjX21u00F3MnwYU03jX261; Sun, 19 Feb 2017 20:31:04 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 19 Feb 2017 20:31:04 +0100 X-ME-IP: 92.140.226.155 From: Christophe JAILLET To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, hch@lst.de, dan.j.williams@intel.com, axboe@fb.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] sd: Fix error handling Date: Sun, 19 Feb 2017 20:27:12 +0100 Message-Id: <20170219192712.19807-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.9.3 X-Antivirus: avast! (VPS 170219-0, 19/02/2017), Outbound message X-Antivirus-Status: Clean Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reorder 'out_free' and 'out_free_devt' error handling labels in order to match the way resources have been allocated. Fixes: 0dba1314d4f8 ("scsi, block: fix duplicate bdi name registration crashes") Signed-off-by: Christophe JAILLET --- drivers/scsi/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index cb6e68dd6df0..99e12061a6fb 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3213,10 +3213,10 @@ static int sd_probe(struct device *dev) sd_devt = NULL; out_put: put_disk(gd); - out_free: - kfree(sdkp); out_free_devt: kfree(sd_devt); + out_free: + kfree(sdkp); out: scsi_autopm_put_device(sdp); return error;