From patchwork Tue May 23 21:41:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranav Prasad X-Patchwork-Id: 98185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2439556vqo; Tue, 23 May 2023 14:57:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7KI8rSxiCmzoKcCjnDZbcGWwP6DP10RpI3WTii4xJ22OG7arT1J0FyXA8FSmNN3Xin8CrC X-Received: by 2002:a05:6a00:198a:b0:646:b165:1b29 with SMTP id d10-20020a056a00198a00b00646b1651b29mr495436pfl.23.1684879072760; Tue, 23 May 2023 14:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684879072; cv=none; d=google.com; s=arc-20160816; b=w4J22j9wtFpTjM/jri7TLUyczpA9r+nnCVcIieF/b5EboU1lL24Yy2JHqXXYeMUosr 4GOm8xaIVKWW213ykyiN9x/KH1gngkPg7IjsYahcKJfdQt5Ym/t58itgZyxuxmMexZO8 BkooXw71kxHec6j4XfzdSC01EjvX2qivigelljkT9xVqhrqm+FJkjyhvCIpwF68t8xIZ Ty0v3Lf4sZuaSreBe6BqSo7s0he7YvpCxy90PzxdIM0bmLhchIAIMBVfu7D3B3CrTSNg 0ag9y38MeXsaegDBkgAf9zaCUATAJjDwcLLVm8kXSCjOSJd2vjDcqc81P1k+65/i8bar G5NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=/zFD/sWJ5X0Do7uK1EvSSeUTvJhq9b59SmXRDn2sIn4=; b=eNVjvF+7SQXbG2ODKmGcciZe6yj0/jyHSl/g7+z5ZXuzIwDQAxcBdKJkAYnxSR+c3E bJjls34cU1NikzFaIPTUVUA0Eb7rjAzs8OvtOqN0fJjr+TM1gKgzvzNhKCFkZP4NIc5Y FZU/7Uu7kC0rdXB6U9PHSVsvA6xiA4BKAqTFe9467NAsC/Bk+gc8el8QvyQwkb0u6t2v RmVJL/mbS+PPLTBLcucL59hLEOWIRUYdeeqSyakqfEEc32XCmWjjUJu6/uteelgHScYg TeYeaOdHGuRI5XzUfaCM0XUnw9gDN+D6WSHminjMS96WiPLXzSm8WyDPXC9/PKJtSX5c s/+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=TjM3N2YQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020aa79630000000b0064d675fc97csi4715705pfg.27.2023.05.23.14.57.38; Tue, 23 May 2023 14:57:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=TjM3N2YQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238579AbjEWVlt (ORCPT + 99 others); Tue, 23 May 2023 17:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238275AbjEWVlq (ORCPT ); Tue, 23 May 2023 17:41:46 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BAC1119 for ; Tue, 23 May 2023 14:41:45 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-561f201a646so3829587b3.1 for ; Tue, 23 May 2023 14:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684878104; x=1687470104; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=/zFD/sWJ5X0Do7uK1EvSSeUTvJhq9b59SmXRDn2sIn4=; b=TjM3N2YQOZ1c6QUEWJ2gRFeAs13Q1W9t1jDZOdVrzBU6CbUqi7nHykV1m6JwcXHVJP 5JWnTPKBI1VX76C5DYEhlVsMFIuz5LxoXP5IuEj3gCYjvlCjxityOZY23sT377bDYNzv zQ72uUFMHqWBjAEg3vu8biDuzrfuAusAdTRT71/hzPZDV8b55XErO+bgiw/uqgcrII9G skZ28g6UxTRxH6tOBABS2nFtvP0j6Yzh53KqL1x/YCA72JA6WXA0Ya8a2q9b/WZ2y1wV 4xiJiJUN8pJEpwYwKgAf0Q+XU8MMKxd1CDDGWdXqcBHzxPfowQGH/4rjgHCvQCRmR6TI DlSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684878104; x=1687470104; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/zFD/sWJ5X0Do7uK1EvSSeUTvJhq9b59SmXRDn2sIn4=; b=iKYH3AskejKWiWIewdUMuLUBupE6RiCt5uAz0n0HdhPaYmq+RsRDgrJfUJ/hCkgiPl RuC59Wyy8RLe1uHZo5NzSi8LEmkeYu3KpKZcGw4TspJ+6MkDPw5cLXwx3PkK38+caN8g tA20Q5XFDSOkHZtFbZDk75PRozPpvQD20uJrSsLOGb9no4NeOmn24uQJjoSFa8Sd5n+J NGRwZ9z0edAlJNhOguiSsDSQz/iec/MY5q1iY2KMytkl5kBnGmWTkBsv2BjHBiled3tT Vlp51KGdsn3ZFUG8H/f5XYYQsTb/u/lQU1OwWN7MVHXMrKyExUWBkswYoWAyOjKClE3z j0pQ== X-Gm-Message-State: AC+VfDzRUNgMC1akxh6RbVFTGDc0KYriN5V5tywutL84AJZPJWPHrRwu gyyzrEGTRpMdoTBWmNAzoIdZMn0pMvUHyg== X-Received: from pranav-first.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:390b]) (user=pranavpp job=sendgmr) by 2002:a81:a704:0:b0:561:bf07:ee28 with SMTP id e4-20020a81a704000000b00561bf07ee28mr9728612ywh.5.1684878104664; Tue, 23 May 2023 14:41:44 -0700 (PDT) Date: Tue, 23 May 2023 21:41:26 +0000 In-Reply-To: <20230523214127.4006891-1-pranavpp@google.com> Mime-Version: 1.0 References: <20230523214127.4006891-1-pranavpp@google.com> X-Mailer: git-send-email 2.40.1.698.g37aff9b760-goog Message-ID: <20230523214127.4006891-2-pranavpp@google.com> Subject: [PATCH 1/2] scsi: pm80xx: Add fatal error check for pm8001_phy_control() From: Pranav Prasad To: Jack Wang , "James E . J . Bottomley" , "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Changyuan Lyu , Pranav Prasad X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766723758466566428?= X-GMAIL-MSGID: =?utf-8?q?1766723758466566428?= From: Changyuan Lyu This patch adds a fatal error check for the pm8001_phy_control() function. Signed-off-by: Changyuan Lyu Signed-off-by: Pranav Prasad Acked-by: Jack Wang --- drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index e5673c774f66..b153f0966e5d 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -167,6 +167,16 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, pm8001_ha = sas_phy->ha->lldd_ha; phy = &pm8001_ha->phy[phy_id]; pm8001_ha->phy[phy_id].enable_completion = &completion; + + if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) { + /* If the controller is in fatal error state, + * we will not get a response from the controller + */ + pm8001_dbg(pm8001_ha, FAIL, + "Phy control failed due to fatal errors\n"); + return -EFAULT; + } + switch (func) { case PHY_FUNC_SET_LINK_RATE: rates = funcdata;