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 059C4C433F5 for ; Mon, 28 Feb 2022 10:09:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234737AbiB1KJk (ORCPT ); Mon, 28 Feb 2022 05:09:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234725AbiB1KJi (ORCPT ); Mon, 28 Feb 2022 05:09:38 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70F7738D9A for ; Mon, 28 Feb 2022 02:08:58 -0800 (PST) Received: from fraeml735-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4K6bfT6Ncsz67ykV; Mon, 28 Feb 2022 18:07:45 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml735-chm.china.huawei.com (10.206.15.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 28 Feb 2022 11:08:55 +0100 Received: from [10.47.86.223] (10.47.86.223) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.21; Mon, 28 Feb 2022 10:08:55 +0000 Message-ID: <378220ab-ffdf-460b-0c24-46722a81ea26@huawei.com> Date: Mon, 28 Feb 2022 10:08:52 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v2] scsi: libsas: cleanup sas_form_port() To: Damien Le Moal , , "Martin K . Petersen" , Dan Carpenter , "Jason Yan" References: <20220228094857.557329-1-damien.lemoal@opensource.wdc.com> From: John Garry In-Reply-To: <20220228094857.557329-1-damien.lemoal@opensource.wdc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.86.223] X-ClientProxiedBy: lhreml708-chm.china.huawei.com (10.201.108.57) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org On 28/02/2022 09:48, Damien Le Moal wrote: > Sparse throws a warning about context imbalance ("different lock > contexts for basic block") in sas_form_port() as it gets confused with > the fact that a port is locked within one of the 2 search loop and > unlocked afterward outside of the search loops once the phy is added to > the port. Since this code is not easy to follow, improve it by factoring > out the code adding the phy to the port once the port is locked into the > helper function sas_form_port_add_phy(). This helper can then be called > directly within the port search loops, avoiding confusion and clearing > the sparse warning. > > Signed-off-by: Damien Le Moal Reviewed-by: John Garry