From patchwork Mon Jun 29 05:21:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maninder Singh X-Patchwork-Id: 6687281 Return-Path: X-Original-To: patchwork-linux-scsi@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 BC20CC05AC for ; Mon, 29 Jun 2015 05:21:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA08D2055D for ; Mon, 29 Jun 2015 05:21:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B4D72055A for ; Mon, 29 Jun 2015 05:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752450AbbF2FVW (ORCPT ); Mon, 29 Jun 2015 01:21:22 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:53871 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750930AbbF2FVV (ORCPT ); Mon, 29 Jun 2015 01:21:21 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NQO00OZVXJJQ0D0@mailout3.samsung.com> for linux-scsi@vger.kernel.org; Mon, 29 Jun 2015 14:21:19 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.122]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 4C.75.20564.FC5D0955; Mon, 29 Jun 2015 14:21:19 +0900 (KST) X-AuditID: cbfee690-f796f6d000005054-c1-5590d5cf1b21 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 3D.63.05312.FC5D0955; Mon, 29 Jun 2015 14:21:19 +0900 (KST) Received: from localhost.localdomain ([107.108.92.210]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NQO00DJOXJ8WKB0@mmp2.samsung.com>; Mon, 29 Jun 2015 14:21:19 +0900 (KST) From: Maninder Singh To: anil.gurumurthy@qlogic.com, sudarsana.kalluru@qlogic.com, JBottomley@odin.com, linux-scsi@vger.kernel.org Cc: pankaj.m@samsung.com, Maninder Singh Subject: [PATCH 1/1] SCSI/bfa: Use port pointer after NULL check Date: Mon, 29 Jun 2015 10:51:03 +0530 Message-id: <1435555263-7954-1-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKLMWRmVeSWpSXmKPExsWyRsSkSvf81QmhBtOfK1p8fDqdzeL/+tss Ft3Xd7BZHJ7fxmJx781WJovNr+czOrB5HP7xg9lj3ZcT7B59W1YxenzeJBfAEsVlk5Kak1mW WqRvl8CVMW0Jd0EXR8WzKdcZGxifsnUxcnJICJhITNpwiQnCFpO4cG89UJyLQ0hgKaPEiU8T 2GGKpj37zQqRmM4osebtZqiqn4wSG5svMYJUsQnoSazatYeli5GDQ0QgX2LuCnsQk1nASWL6 Vz2QCmEBB4knP28ygYRZBFQl1u4UBwnzCrhJPJv/nR0kLCGgIDFnkg3IcAmBz2wSp7+cZQGp YREQkPg2+RALRI2sxKYDzBCXSUocXHGDZQKj4AJGhlWMoqkFyQXFSelFJnrFibnFpXnpesn5 uZsYgaF5+t+zCTsY7x2wPsQowMGoxMPbAAxZIdbEsuLK3EOMpkAbJjJLiSbnAyMgryTe0NjM yMLUxNTYyNzSTEmc97XUz2AhgfTEktTs1NSC1KL4otKc1OJDjEwcnFINjPVBknOEv/yIPXyj Jv/NirPfJa/K6erxKJezl6523n7J/FCS1Kyyh/JfZL/d3pvrN+nRhOuHUzO+XzQXu117QefM ownGMzi5JrxN3K9z0WZTyAeeI7OvnOhw2Rd7uDIrx879we+9nGpaR2uift1Rs9yVNJdPN1JO 9Ov5aSLOD0Tnxn9v2nvzoYESS3FGoqEWc1FxIgB+zxAKSAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPLMWRmVeSWpSXmKPExsVy+t9jQd3zVyeEGhyfI2nx8el0Nov/62+z WHRf38FmcXh+G4vFvTdbmSw2v57P6MDmcfjHD2aPdV9OsHv0bVnF6PF5k1wAS1QDo01GamJK apFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO0HYlhbLEnFKgUEBi cbGSvh2mCaEhbroWMI0Rur4hQXA9RgZoIGENY8a0JdwFXRwVz6ZcZ2xgfMrWxcjJISFgIjHt 2W9WCFtM4sK99UBxLg4hgemMEmveboZyfjJKbGy+xAhSxSagJ7Fq1x6WLkYODhGBfIm5K+xB TGYBJ4npX/VAKoQFHCSe/LzJBBJmEVCVWLtTHCTMK+Am8Wz+d3aQsISAgsScSTYTGLkXMDKs YhRNLUguKE5KzzXSK07MLS7NS9dLzs/dxAgO/GfSOxhXNVgcYhTgYFTi4dW4PCFUiDWxrLgy 9xCjBAezkgjv5c1AId6UxMqq1KL8+KLSnNTiQ4ymQLsnMkuJJucDozKvJN7Q2MTc1NjU0sTC xMxSSZz3ZL5PqJBAemJJanZqakFqEUwfEwenVANj7JFnRxjj5k1+9vqywaq05QdC+ZZotSW9 mPl47vwD284aPUjNVvo+fZ/jm1UMlc6Jn+4muwe8Ve5aNP197J5HgbWWKXpXT7t5Zm64e9By 4vmH1x63vX6rp6Ru9P7Toar1X/hMNq6dfXj+vm3bD5xOTLxkPf/RxclM3wzjjjuYzL1bPjOs zujL+fNKLMUZiYZazEXFiQAeYieakgIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Currently port pointer is derefrenced before NULL check. So NULL check is misleading, Thus it is better to use port pointer after NULL Check. Signed-off-by: Maninder Singh Reviewed-by: Akhilesh Kumar --- drivers/scsi/bfa/bfa_fcs_lport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index ff75ef8..542d5c6 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c @@ -5826,12 +5826,13 @@ bfa_fcs_lport_get_rport_max_speed(bfa_fcs_lport_t *port) bfa_port_speed_t max_speed = 0; struct bfa_port_attr_s port_attr; bfa_port_speed_t port_speed, rport_speed; - bfa_boolean_t trl_enabled = bfa_fcport_is_ratelim(port->fcs->bfa); + bfa_boolean_t trl_enabled; if (port == NULL) return 0; + trl_enabled = bfa_fcport_is_ratelim(port->fcs->bfa); fcs = port->fcs; /* Get Physical port's current speed */