From patchwork Fri Feb 24 14:43:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 656738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09CFFC61DA4 for ; Fri, 24 Feb 2023 14:45:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230028AbjBXOpD (ORCPT ); Fri, 24 Feb 2023 09:45:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbjBXOoj (ORCPT ); Fri, 24 Feb 2023 09:44:39 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2897618ABC for ; Fri, 24 Feb 2023 06:44:34 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id q31-20020a17090a17a200b0023750b69614so2912103pja.5 for ; Fri, 24 Feb 2023 06:44:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=wu/5vBDtIt/2CwvWKiSOVVIBdqUUtck6xP0LuooJPZs=; b=SqmGg7rJvPskSLdDzftfu5PSykYmQLgQy4jU8T3W6xdhSvGlwAvGS8jAhdRIV5JYsM T2LTw7aeukH2Wva9t1YIe91eBz8C7kcMbQcANgBhlLoQS2kOA4BTdNxo5dVmvMqV0BjG BOHIosKWnd7brMbAHAhjLeRwY12kOWiL2ARpk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wu/5vBDtIt/2CwvWKiSOVVIBdqUUtck6xP0LuooJPZs=; b=y6Az/2kyKh6Sq8gQMPrzNp9sc+vwS017hG1q9o2n8TSGo0Rb20GBXaxi9EyL7V1umx nNi/rzT9giWdk7EIYdHbaUdGiRqpkYHJaWDcwlXf6eBSwlj4VRVfCnoHGoWt9XWEEFxa sHDStO7JqXsst5agJZSoj/OSBw/KuaJxviaqp/Ky6ePeaKM9NWrYM7pqDHshLzuGnQM5 ggOBACE1zd+5HUQPVxCvp63bpYFpv21l9/XjZC1YicJX2DMqBhkixDPh3xfgPrHaE6X+ +KCrAIh2dMqEoTAxc7UXUyLc1sNEb1XNm6dkZnq8IYUvjniYhn1yoiqg4+Q34RnA6QHr 9OaA== X-Gm-Message-State: AO0yUKWHz0f2gd5tDtZr8czwjW5ZaWvPFXGnTp133ige30/ZNGLHghDH 6kQLCnuB4kmHVMVR6TQyb3dxNanYZP7OxW3uyiEmKoyxOQBDSfSUhsR7/uitj01HSVViF6s1gnj Nci9pzVDp8doKheK4knm3nY1VR0qvnR2aCIDxECdux9JMrxKGp8q4MBAU4ottSl80+nC26vOcaE /PKhRrB2w= X-Google-Smtp-Source: AK7set+ma/FAcCU2xVAE6tdIoSDbng7t4r8nnsU9YfhLIrLzcrEEA3UlzmfNx7y61VEgETX+1/XxSg== X-Received: by 2002:a17:902:ea07:b0:19a:9831:c8d6 with SMTP id s7-20020a170902ea0700b0019a9831c8d6mr17145182plg.50.1677249873301; Fri, 24 Feb 2023 06:44:33 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id b5-20020a170902a9c500b00186748fe6ccsm8911549plr.214.2023.02.24.06.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 06:44:33 -0800 (PST) From: Ranjan Kumar To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: rajsekhar.chundru@broadcom.com, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, Ranjan Kumar , Sreekanth Reddy Subject: [PATCH 10/15] mpi3mr: appropriate return values for failures in firmware init path Date: Fri, 24 Feb 2023 06:43:15 -0800 Message-Id: <20230224144320.10601-11-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230224144320.10601-1-ranjan.kumar@broadcom.com> References: <20230224144320.10601-1-ranjan.kumar@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The driver is modified to return a proper non-zero return value for all the cases when the controller initialization and re-initialization fails. Signed-off-by: Ranjan Kumar Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpi3mr/mpi3mr_fw.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index 936a6edb00f4..a2998893835b 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -3856,8 +3856,10 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc) dprint_init(mrioc, "allocating config page buffers\n"); mrioc->cfg_page = dma_alloc_coherent(&mrioc->pdev->dev, MPI3MR_DEFAULT_CFG_PAGE_SZ, &mrioc->cfg_page_dma, GFP_KERNEL); - if (!mrioc->cfg_page) + if (!mrioc->cfg_page) { + retval = -1; goto out_failed_noretry; + } mrioc->cfg_page_sz = MPI3MR_DEFAULT_CFG_PAGE_SZ; @@ -3919,8 +3921,10 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc) dprint_init(mrioc, "allocating memory for throttle groups\n"); sz = sizeof(struct mpi3mr_throttle_group_info); mrioc->throttle_groups = kcalloc(mrioc->num_io_throttle_group, sz, GFP_KERNEL); - if (!mrioc->throttle_groups) + if (!mrioc->throttle_groups) { + retval = -1; goto out_failed_noretry; + } } retval = mpi3mr_enable_events(mrioc); @@ -3940,6 +3944,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc) mpi3mr_memset_buffers(mrioc); goto retry_init; } + retval = -1; out_failed_noretry: ioc_err(mrioc, "controller initialization failed\n"); mpi3mr_issue_reset(mrioc, MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT, @@ -4052,6 +4057,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume) ioc_err(mrioc, "cannot create minimum number of operational queues expected:%d created:%d\n", mrioc->shost->nr_hw_queues, mrioc->num_op_reply_q); + retval = -1; goto out_failed_noretry; } @@ -4118,6 +4124,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume) mpi3mr_memset_buffers(mrioc); goto retry_init; } + retval = -1; out_failed_noretry: ioc_err(mrioc, "controller %s is failed\n", (is_resume)?"resume":"re-initialization");