From patchwork Tue Feb 28 14:08:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 13154948 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 5BBCFC64ED6 for ; Tue, 28 Feb 2023 14:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229830AbjB1OJL (ORCPT ); Tue, 28 Feb 2023 09:09:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbjB1OJG (ORCPT ); Tue, 28 Feb 2023 09:09:06 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DEB840C5 for ; Tue, 28 Feb 2023 06:09:05 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id cp7-20020a17090afb8700b0023756229427so13831699pjb.1 for ; Tue, 28 Feb 2023 06:09:05 -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=grBjESVZbPi8N4EXwWQUFkUyNL7XllQP0w9XKOIgcww=; b=bvTrIBUYvfJCMo5OHMtfoDh83s4cFfioRzxGqTiIL9H66KgANrDS7rBxeG6U/7IdhA 12xX3sGdKbfu0qCeUS5VjwZl6fhLSkn4BHjblerH7nypguJCvsvtSE1HxOLEwzSgk30L nKPrl8GJwLhez46h4y5jGq9khIiwaVZ4h+AMU= 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=grBjESVZbPi8N4EXwWQUFkUyNL7XllQP0w9XKOIgcww=; b=vPd5eRD7Ob7f3Mb7bpt6u8nDXanGn/hsAIYBsng8QnklDUcfySEZ5XTY0g/ewV5BpX IrHhWiTRmvkaLJEW49PUistVm65E8Dg9pc+fm/kVn+qrI25QcN3SXdKfkzXeUEF6pKnV H+pw3uuHxOdaMJXcfjD4xfGrVs4lpdgQTBNnGciK+wJNQoXFBbxwC+WspMqUzs8MfJC0 9fyzcyJTqskXOi3cw4vR43myIrwOyuSUSWSEhWryPUhjjAo5Whrdd67Twkvy7CjZ1Ec4 tMXaVq0oJqFcpUJsdgZCapa98o6px8eX0TB1FTfkH4sgN2j8Dl44YNBMVzwhfY5KMStA Dh3g== X-Gm-Message-State: AO0yUKWxDIGuFbpoZTzMAE3BkeRREzaVyRrMHplWBvpE7yeLu/YareUD st/67zpZPrJhwGvE+8+w11QxhLsSbDnoSWt9JBYqh1VhnYsuC1XxsoI1NwCeVvJg28SiO9hpygd DQtHKQHzqbhv5eOgCPRL/ui0Kf7lVBcVRh0a3ve/Ocdn7+6eKCGJCAGPBFmsD6tVcoVgKLBre8y b6SFR5/Aw= X-Google-Smtp-Source: AK7set8hKbtjVTUbgH1GZJmtR6KlNn1tV/jhzULwLGrEZ0oPBPaX5mZuTzV+8H33Y9JDFJF5jcQLQw== X-Received: by 2002:a17:902:cec5:b0:19a:6acc:1de2 with SMTP id d5-20020a170902cec500b0019a6acc1de2mr3186707plg.35.1677593344289; Tue, 28 Feb 2023 06:09:04 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id ji1-20020a170903324100b00198e03c3ad4sm6625465plb.278.2023.02.28.06.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 06:09:03 -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 4/6] mpi3mr: appropriate return values for failures in firmware init path Date: Tue, 28 Feb 2023 06:08:33 -0800 Message-Id: <20230228140835.4075-5-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230228140835.4075-1-ranjan.kumar@broadcom.com> References: <20230228140835.4075-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 e5c0bc6d47d5..8f20dc87bebf 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");