From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751858AbcF0HaN (ORCPT ); Mon, 27 Jun 2016 03:30:13 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:45309 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751510AbcF0HaL (ORCPT ); Mon, 27 Jun 2016 03:30:11 -0400 Subject: Re: [PATCH v10 03/22] IB/hns: Add initial main frame driver and get cfg info To: Leon Romanovsky References: <1466087730-54856-1-git-send-email-oulijun@huawei.com> <1466087730-54856-4-git-send-email-oulijun@huawei.com> <20160624114831.GD23995@leon.nu> <576E5D0B.7010003@huawei.com> <20160627070054.GK23995@leon.nu> CC: Lijun Ou , , , , , , , , , , , , , , , , , , From: "Wei Hu (Xavier)" Message-ID: <5770D5DC.1080200@huawei.com> Date: Mon, 27 Jun 2016 15:29:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160627070054.GK23995@leon.nu> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.115.113] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.5770D5E7.00BD,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6c700440925320fbe44d6b976b516fd7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/6/27 15:00, Leon Romanovsky wrote: > On Sat, Jun 25, 2016 at 06:29:31PM +0800, Wei Hu (Xavier) wrote: >> >> On 2016/6/24 19:48, Leon Romanovsky wrote: >>> On Thu, Jun 16, 2016 at 10:35:11PM +0800, Lijun Ou wrote: >>>> This patch mainly added the initial bare main driver. It >>>> could get the relative configure information of net node. >>>> >>>> Signed-off-by: Wei Hu >>>> Signed-off-by: Nenglong Zhao >>>> Signed-off-by: Lijun Ou >>>> --- > ... > >>>> + return -ENOMEM; >>>> + >>>> + for (i = 0; i < HNS_ROCE_MAX_PORTS; i++) { >>>> + net_node = of_parse_phandle(np, "eth-handle", i); >>>> + if (net_node) { >>>> + pdev = of_find_device_by_node(net_node); >>>> + netdev = platform_get_drvdata(pdev); >>>> + phy_port = (u8)i; >>>> + if (netdev) { >>>> + hr_dev->iboe.netdevs[port_cnt] = netdev; >>>> + hr_dev->iboe.phy_port[port_cnt] = phy_port; >>>> + } else { >>>> + return -ENODEV; >>>> + } >>>> + port_cnt++; >>>> + } >>>> + } >>> Do you want to check port_cnt value, before continue? >> Hi, Leon >> Maybe we need not to check port_cnt value. >> port_cnt can be ensured smaller than HNS_ROCE_MAX_PORTS. > You can in theory to get port_cnt == 0, in such case it is wise to > return error. I see. Thanks Wei Hu