Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752705AbdGLNwi (ORCPT ); Wed, 12 Jul 2017 09:52:38 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:9749 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751957AbdGLNwg (ORCPT ); Wed, 12 Jul 2017 09:52:36 -0400 Subject: Re: [PATCH v3 6/7] libsas: add wait-complete support to sync discovery event To: Yijing Wang , , References: <1499670369-44143-1-git-send-email-wangyijing@huawei.com> <1499670369-44143-7-git-send-email-wangyijing@huawei.com> CC: , , , , , , , , , , , , , , , , , , Johannes Thumshirn , Linuxarm From: John Garry Message-ID: Date: Wed, 12 Jul 2017 14:51:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1499670369-44143-7-git-send-email-wangyijing@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.181.152] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.59662996.001B,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 524908bd8bb00d8ebcf5493a4f8f53bd Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 742 Lines: 23 On 10/07/2017 08:06, Yijing Wang wrote: > > static void sas_chain_event(int event, unsigned long *pending, > @@ -592,9 +596,9 @@ int sas_discover_event(struct asd_sas_port *port, enum discover_event ev) > { > struct sas_discovery *disc; > > + disc = &port->disc; > if (!port) > return 0; > - disc = &port->disc; > > BUG_ON(ev >= DISC_NUM_EVENTS); > > diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c > index 570b2cb..9d26c28 1 I was just looking through the code and I noticed this, above. Is there a specific reason to move the NULL check, or was it modified accidentally? I mean, if port is NULL I don't think we would get as far as checking it as we would have already de-referenced it.