From patchwork Sun Dec 17 00:05:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10117585 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 0B2EC6019C for ; Sun, 17 Dec 2017 00:05:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E99112909A for ; Sun, 17 Dec 2017 00:05:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAE1729247; Sun, 17 Dec 2017 00:05:17 +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,DKIM_SIGNED, DKIM_VALID,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 9CB322909A for ; Sun, 17 Dec 2017 00:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756929AbdLQAFO (ORCPT ); Sat, 16 Dec 2017 19:05:14 -0500 Received: from mail-bl2nam02on0058.outbound.protection.outlook.com ([104.47.38.58]:26560 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751512AbdLQAFN (ORCPT ); Sat, 16 Dec 2017 19:05:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=p4V+JCiZVcgqPkLC2zMY6O0KcH+CGUwxgirN6LoCm98=; b=hj6Hm9yq1VPxqfmPL31FHH9jozkx0BUa38Zv8ZndEWqvOYX6CKgv+S/TDVUfN04O9CBaTgLbSb721/xf8su7yPlzDrQVa6P5NOmSsBxU0K5RH7cZ1FxnOXL83q85+pPcFg/zxFY55pxmB2ldRMp3QmnoySf8GK5EMsTYarqDFzw= Received: from DM5PR07CA0038.namprd07.prod.outlook.com (10.168.109.24) by CY1PR07MB2522.namprd07.prod.outlook.com (10.167.16.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Sun, 17 Dec 2017 00:05:11 +0000 Received: from BY2FFO11FD020.protection.gbl (2a01:111:f400:7c0c::197) by DM5PR07CA0038.outlook.office365.com (2603:10b6:3:16::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.323.15 via Frontend Transport; Sun, 17 Dec 2017 00:05:11 +0000 Authentication-Results: spf=permerror (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: PermError (protection.outlook.com: domain of cavium.com used an invalid SPF mechanism) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BY2FFO11FD020.mail.protection.outlook.com (10.1.14.137) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Sun, 17 Dec 2017 00:05:01 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Sat, 16 Dec 2017 16:05:09 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id vBH059gf006164; Sat, 16 Dec 2017 16:05:09 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBH059Gr006163; Sat, 16 Dec 2017 16:05:09 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH] qla2xxx: Fix smatch warning in qla25xx_delete_{rsp|req}_que Date: Sat, 16 Dec 2017 16:05:09 -0800 Message-ID: <20171217000509.6129-1-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(346002)(39850400004)(396003)(2980300002)(448002)(199004)(189003)(48376002)(478600001)(47776003)(51416003)(87636003)(86362001)(316002)(85326001)(1076002)(106466001)(72206003)(50226002)(4326008)(2906002)(42186006)(16586007)(8936002)(69596002)(54906003)(356003)(5660300001)(36756003)(110136005)(80596001)(81166006)(50466002)(8676002)(305945005)(59450400001)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2522; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD020; 1:GsHNZhMupRTPT6RgBymwwUedrfdQbcSlkvNug3gfm32M3PV5wcDl/iP4d1KCugXZC95+/4pEuYDQBlUsGsEqdHQA1+7jhTjR6LnV2pQ1+tGhMXVOFu8iQvHBlyoGS3pg X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b447832-4a45-4a5d-ce6a-08d544e1d14f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307); SRVR:CY1PR07MB2522; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2522; 3:rRKZLBx32EWMYs9jdz45F3cJcAYDbgCYJqa3gLYCjotZOJgF5qIKHY2upxg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CnHvY/FLR2wmlvreNwkdR3Y5ysubBhbxwo0iZofnBXBuqaRI72OIfHy6ZxNwWY8pXD/I3zDE216QWA0LnuzrudOqvPcROG8S2s5dx7V+/7NIryn1sCHCEHfovfRkq0ys0yLiVYfakLeXtYgHahhwyciMvMBvVY6NGUslg3yK0T6X0CXU8snSE1FiPHU9wx91hgwxtK4Kp8S1MSVzvG6qlJlhHiskYZiXzrKCjqgYOrl5PXaEg4oZQAb1E2NY5XfIzxE4ErXNl6qTFqW+dSiCoGf7UY7vnhoJCXjx7qJarwNpfRWKpCOKfdcUzCKKmpnssLEwXbEbdPlOc2EFFLREOF8/5UchQnqkhsZYrLGJbMk6ZiW/JBUzesgrzmz3B660f2Hi/UQnn90XJuqwq1U3esoYfGXP9JoAZ0Q/e3nIbBK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(146099531331640); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231023)(6041248)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123564025)(6072148)(201708071742011); SRVR:CY1PR07MB2522; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR07MB2522; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2522; 4:OAibG/N9RumiZMjLWBWx9RF5ccH/SkNXm+NqzW0OnFBJTt3QfLXUskQI9waz7RTsKiMs29WhDyKrocIyf3eFK6ktAwbgo7RUv3DJAHR/Aa1OYyLJZ90lujL0fj+2avbjz/a9e/HtQRWmDTvGjZkl+DDq8g4J+ViY+zhz6fVqfRtO4BG+zVEmWERMMy1BmjAm7jIkJGdURMxkqtZDNoz2O/zIwKV+kfUEmyYtVvJkI22+OHMat/TcIiznKG/EFFlSRg5HlO/gj55zu0zW/JkQFtxyi3gD/jTR178bNaGvndi2c+fTztKxyhLOfkbONZC8 X-Forefront-PRVS: 05245CA661 X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2522; 23:Qtq4OP2nsXpJfAAeqzBt2OVjvXw2hvvJuF21zFiis0gqWlBZwttoFAIIt2HUhGWZX3sTwN7SH2MGx0EnpnpsmA3ZAxQVSUft1yN2EYnssYnWWloqrAOZ+ru5GHISASC7/InGdTojVQr6zpj/3HwqnIytiQuDyyx58ISo4THFMlFQTB/fdcsMNwKit+lUNAk2cFOtEyi9hFAsIIFLW+uKVffjXF08VA3CNN6/H/8sH6RBPPyus1/s4mrTYNIkH/UqquVHrVGwXZVaPQmHap0ruMji3VpN7l+YGnBsIdoLgK4XltIw6i0M7G1imCl7/xyY9zAuquGII7mAv1QrntN985Zb97pNYwrIZkYFZg3xNc+DukFcKnBGuwKFR6Sb9A4IxWDbdqXUj48VUutKSu1Z1/fnHaMP59gKDeYjFOZfBLC318eZkU4lbUKOGAu6QqHpurQHjs/xpmY/wS7z9G9dmbBvC57ZwdqAQKLKy1xzfDZj4vSiAloHTVIutAaquw1WxmoPkBu2YUdJQnzGvOp27ER47TBUahl4uA2rFwQVOqpcdZ4AXxkJOg+hYjHtf47xVMdr7LlJKXcJkkYTzloatW+klTsznInHMl89Wkuqn4HetZV8B7FJUyS72GyjPUlntOxcDtC9T+8x1hYOJawUC0VtxUNeXcb5Cnp7flARMwrxstjbY53EEx70jjFFYyUGCCgM7NqSc8Mdej/gMwr95hfp1IhrV9livhkg4d7C8p8bJVOO7DKk6PyKSqXN07fCz5nOfdtuMVF0+JTY+wWUYPkIxkbzlF1FYgd47scHPqjfZQqFGwLeg1DStLcZ3oaBqmHuxmj97sF/f/may+YhWydpqaztjWmnHCbxeVcGSu3FduGH/xE4CuMoEIAc2Y5lBkZv3V7lIsgBo2rOqydrq0dkWjKaILEg7yrAoOTQO XU= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2522; 6:bPQt2s4pjMu5FxxyYoK1vExJgAeR4FJI5vcaMvsSlGKUxmUUOJ6xI+3Rpy++SQ3eXCFhCt9jTbJp+pV8sMsFhrOLlHOjWcMxGsGqTTyCh+ilx3b09jAbKqxTWR+RT1DCNw8Y1oWvLxBswqbyi6PpSrFqsG5MFgCnwv+rcgcRM+O4AqXBBAnq8zRk9l0k4w1I81MeHqdkvJiDgyuWHNlmQ/G27uxSmrr9u2kQzbi3nMy3dflzAvp+djMVTHiHDzmfmzY6bpTVK/nTLE+h8yaosZhRJUeRr/UTaj4tcwa28BYKuDIvXoMtEnxfWqdM72X4PWquhmDCHIyIAOR3dr8RU0l1XVlUi+w74FNmmAEfE/0=; 5:ox+WUqxT0iirvdBuFdsB7GlCDfFrUmRlJVU5C1U3AW7oEBmlghJEUH4P1O3+FIxT6lUZ8WtsV1WQlrnU0v83Mq6rEoVFIRiv2W9wAPE+aMqXuRXDMtvkFGYJwPB8Nvy6l3OwHJQY45E7ZHHzk4ma4CtHpDwxcDkKEG7/GD9ivdo=; 24:z/BuS2+TArG2UKisklK0XKhlkYQcdWC0ZDR4mCLUP5H/wLy5YzZLLD5WpfmYLhUuRyQ4iFNP+fs3tLFeXFgFetbzWPP+voXq0VU0LqVIi8c=; 7:lpKlWdJ22fTkMcNyRJBs2kFCSvw5vyrCyWD32HvU+xSkE+gHpuFtvX6hfuDIwfriK/VICBeJXuumHCqFxOU2Ntn8FhrZ9vjAd013Tjmvu5qpM4RlS/bHfvKf6hk2zvnxYMXCPo5MDGIQB1EJ/tF0R0nUVzRmIocbcb3o1ubjWShOqirTi0BrDW5FT2HdLP0tNhy7jgOkraWE3l6S+dDeuRjY54rL+WsUfTjjW7Ykj786up+9BzYNgbM4z6NwBK6+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2017 00:05:01.0763 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b447832-4a45-4a5d-ce6a-08d544e1d14f X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2522 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 This patch fixes following warnings reported by smatch drivers/scsi/qla2xxx/qla_mid.c:586 qla25xx_delete_req_que() error: we previously assumed 'req' could be null (see line 580) drivers/scsi/qla2xxx/qla_mid.c:602 qla25xx_delete_rsp_que() error: we previously assumed 'rsp' could be null (see line 596) Fixes: 7867b98dceb7 ("scsi: qla2xxx: Fix memory leak in dual/target mode") Reported-by: Dan Carpenter Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_mid.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index e538e6308885..522d585a1a08 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -582,8 +582,9 @@ qla25xx_delete_req_que(struct scsi_qla_host *vha, struct req_que *req) ret = qla25xx_init_req_que(vha, req); if (ret != QLA_SUCCESS) return QLA_FUNCTION_FAILED; + + qla25xx_free_req_que(vha, req); } - qla25xx_free_req_que(vha, req); return ret; } @@ -598,8 +599,9 @@ qla25xx_delete_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp) ret = qla25xx_init_rsp_que(vha, rsp); if (ret != QLA_SUCCESS) return QLA_FUNCTION_FAILED; + + qla25xx_free_rsp_que(vha, rsp); } - qla25xx_free_rsp_que(vha, rsp); return ret; }