From patchwork Thu May 10 11:45:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 10391727 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 7B51D6028E for ; Thu, 10 May 2018 11:45:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A1CE28A62 for ; Thu, 10 May 2018 11:45:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E5D528A67; Thu, 10 May 2018 11:45:51 +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=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D8B1B28A62 for ; Thu, 10 May 2018 11:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757189AbeEJLpu (ORCPT ); Thu, 10 May 2018 07:45:50 -0400 Received: from smtp03.smtpout.orange.fr ([80.12.242.125]:40297 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757185AbeEJLpt (ORCPT ); Thu, 10 May 2018 07:45:49 -0400 Received: from ubuntu-CJ.home ([86.244.116.1]) by mwinf5d58 with ME id kbln1x00501t9Ri03blns4; Thu, 10 May 2018 13:45:47 +0200 X-ME-Helo: ubuntu-CJ.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 10 May 2018 13:45:47 +0200 X-ME-IP: 86.244.116.1 From: Christophe JAILLET To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] scsi: qlogicpti: Fix an error handling path in 'qpti_sbus_probe()' Date: Thu, 10 May 2018 13:45:58 +0200 Message-Id: <20180510114558.20769-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.17.0 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 The 'free_irq()' call is not at the right place in the error handling path. The changed order has been introduced in commit 3d4253d9afab ("[SCSI] qlogicpti: Convert to new SBUS device framework.") Fixes: 3d4253d9afab ("[SCSI] qlogicpti: Convert to new SBUS device framework.") Signed-off-by: Christophe JAILLET Reviewed-by: Dan Carpenter --- Please review carefully. This patch is proposed because it triggers one of my coccinelle scripts. I'm not 100% sure if correct. The script tries to spot wrongly ordered error handling path. It is: @@ identifier l1, l2; @@ if (...) { ... * goto l1; } ... if (...) { ... * goto l2; } ... *l1: ... *l2: ... --- drivers/scsi/qlogicpti.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index cec9a14982e6..8578e566ab41 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c @@ -1385,6 +1385,9 @@ static int qpti_sbus_probe(struct platform_device *op) qpti->req_cpu, qpti->req_dvma); #undef QSIZE +fail_free_irq: + free_irq(qpti->irq, qpti); + fail_unmap_regs: of_iounmap(&op->resource[0], qpti->qregs, resource_size(&op->resource[0])); @@ -1392,9 +1395,6 @@ static int qpti_sbus_probe(struct platform_device *op) of_iounmap(&op->resource[0], qpti->sreg, sizeof(unsigned char)); -fail_free_irq: - free_irq(qpti->irq, qpti); - fail_unlink: scsi_host_put(host);