From patchwork Tue Jun 29 14:11:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 468534 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,MIME_NO_TEXT, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D53F1C11F66 for ; Tue, 29 Jun 2021 14:07:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB6CA61DC4 for ; Tue, 29 Jun 2021 14:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232607AbhF2OJ1 (ORCPT ); Tue, 29 Jun 2021 10:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230100AbhF2OJ1 (ORCPT ); Tue, 29 Jun 2021 10:09:27 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE986C061760 for ; Tue, 29 Jun 2021 07:06:59 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id cs1-20020a17090af501b0290170856e1a8aso2002963pjb.3 for ; Tue, 29 Jun 2021 07:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:mime-version; bh=I3RV+HCCvCJQGx+A+5XaTlwpVAyTU6lqpa5nVvBNC5I=; b=Bbads9/drsy/6BWcTebG162aH0bJpFsx711zbtoFZ6Y6X3lplmNogqhhgsf+u9g1dM 285wineIXefVdjkMezYn0tWzQrhiEE073HtGWhKCrEzdVMTRlRCbazqqaOgdeOgbDAfi MafvPTR1PGwsUheV81tdJtDfoZ8kzDxk33Tns= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=I3RV+HCCvCJQGx+A+5XaTlwpVAyTU6lqpa5nVvBNC5I=; b=asMrMWNAyiwrSl5ojd9Cn7tY/Knw6rxymXtLHv5amJ0Oi9shO5Q5lzi6YISpME8tPd 4h2PhQKn3ixyv3Y+SgQRDiw05q/365e1qlP4yTLJ/fj4iPRsCGoV6o63DZwtm4zlOKfg AGQH3lFWIfxSjiR+EASX9Oj5osYuRjPMfB1CzjUiJO4CzVgWUB6dMVEt8JCtMjh+8PwO 6qAPDGyqMBonVjvVWe3/bRdmGTZufm3jsroI8LySD/95Uj7XYD1OSnTFoagvrJGUknxh 76ybnXC741vZRme2KTpIGhf5VNJcwpxBV+jRpX8iBAJsMp1VeClKe6Y4+2Rn3mfw/sBN Qg6w== X-Gm-Message-State: AOAM532QEHt++BXeSsp4jatHCzaBkncpBCkSl8ReK/Bqe5pkJ8ZF/eRZ vfbXdOg1KCdnzLFgF2EPAAPUjd3RqZYScDASNt7AEQEd+aXKE6AAMJtpwcKXeAdX88f69j5OxSt xCqg/qaQn5Q8xXaZRFAufEHgGo0wZmd0YBj0UlNjToe6ze0g6Vc5QqypdfgRItZ3g9LLE2JQHwD kQJPOt36HfJew= X-Google-Smtp-Source: ABdhPJx31QqrGP9AHdMtyL0X5WzL5Vhb1J7IXcfDwIgcFQE/VpxOegJFFmgY/BWSEHv1mebD5BpR0Q== X-Received: by 2002:a17:902:968a:b029:11d:6448:1352 with SMTP id n10-20020a170902968ab029011d64481352mr27746332plp.59.1624975618788; Tue, 29 Jun 2021 07:06:58 -0700 (PDT) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id a187sm18629535pfb.66.2021.06.29.07.06.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 07:06:58 -0700 (PDT) From: Sreekanth Reddy To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: jejb@linux.ibm.com, mpi3mr-linuxdrv.pdl@broadcom.com, kashyap.desai@broadcom.com, sathya.prakash@broadcom.com, Sreekanth Reddy , kernel test robot , Dan Carpenter Subject: [PATCH] mpi3mr: Fix warnings reported by smatch Date: Tue, 29 Jun 2021 19:41:53 +0530 Message-Id: <20210629141153.3158-1-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Fix below warning reported by static analysis tool named smatch, smatch warnings: drivers/scsi/mpi3mr/mpi3mr_os.c:873 mpi3mr_update_tgtdev() error: we previously assumed 'mrioc->shost' could be null (see line 870 Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpi3mr/mpi3mr_os.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 40676155e62d..24ac7ddec749 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -867,8 +867,9 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, if ((dev_info & MPI3_DEVICE0_PCIE_DEVICE_INFO_TYPE_MASK) != MPI3_DEVICE0_PCIE_DEVICE_INFO_TYPE_NVME_DEVICE) tgtdev->is_hidden = 1; - if (mrioc->shost) - prot_mask = scsi_host_get_prot(mrioc->shost); + if (!mrioc->shost) + break; + prot_mask = scsi_host_get_prot(mrioc->shost); if (prot_mask & SHOST_DIX_TYPE0_PROTECTION) { scsi_host_set_prot(mrioc->shost, prot_mask & 0x77); ioc_info(mrioc,