From patchwork Mon Jan 11 10:20:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hariprasad S X-Patchwork-Id: 8001081 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E82B3BEEE5 for ; Mon, 11 Jan 2016 10:19:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 152AC20219 for ; Mon, 11 Jan 2016 10:19:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35BA92022D for ; Mon, 11 Jan 2016 10:19:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753750AbcAKKTq (ORCPT ); Mon, 11 Jan 2016 05:19:46 -0500 Received: from stargate.chelsio.com ([12.32.117.8]:5093 "EHLO stargate3.asicdesigners.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758922AbcAKKTq (ORCPT ); Mon, 11 Jan 2016 05:19:46 -0500 Received: from gill.asicdesigners.com.com ([10.193.186.211]) by stargate3.asicdesigners.com (8.13.8/8.13.8) with ESMTP id u0BAJE3U017399; Mon, 11 Jan 2016 02:19:19 -0800 From: Hariprasad Shenai To: linux-rdma@vger.kernel.org Cc: dledford@redhat.com, leedom@chelsio.com, nirranjan@chelsio.com, Hariprasad Shenai Subject: [PATCH for-4.5 1/2] iw_cxgb4: Fix static checker warning in c4iw_rdev_open() Date: Mon, 11 Jan 2016 15:50:59 +0530 Message-Id: <1452507660-27441-2-git-send-email-hariprasad@chelsio.com> X-Mailer: git-send-email 2.3.4 In-Reply-To: <1452507660-27441-1-git-send-email-hariprasad@chelsio.com> References: <1452507660-27441-1-git-send-email-hariprasad@chelsio.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,BIGNUM_EMAILS, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The commit c5dfb000b904 ("iw_cxgb4: Pass qid range to user space driver") from Dec 11, 2015, leads to the following static checker warning: drivers/infiniband/hw/cxgb4/device.c:857 c4iw_rdev_open() warn: variable dereferenced before check 'rdev->status_page' Fixing it. Reported-by: Dan Carpenter Signed-off-by: Hariprasad Shenai --- drivers/infiniband/hw/cxgb4/device.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index bf15538..2b67743 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c @@ -850,14 +850,14 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) } rdev->status_page = (struct t4_dev_status_page *) __get_free_page(GFP_KERNEL); + if (!rdev->status_page) { + pr_err(MOD "error allocating status page\n"); + goto destroy_ocqp_pool; + } rdev->status_page->qp_start = rdev->lldi.vr->qp.start; rdev->status_page->qp_size = rdev->lldi.vr->qp.size; rdev->status_page->cq_start = rdev->lldi.vr->cq.start; rdev->status_page->cq_size = rdev->lldi.vr->cq.size; - if (!rdev->status_page) { - pr_err(MOD "error allocating status page\n"); - goto err4; - } if (c4iw_wr_log) { rdev->wr_log = kzalloc((1 << c4iw_wr_log_size_order) * @@ -873,6 +873,8 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) rdev->status_page->db_off = 0; return 0; +destroy_ocqp_pool: + c4iw_ocqp_pool_destroy(rdev); err4: c4iw_rqtpool_destroy(rdev); err3: