From mboxrd@z Thu Jan 1 00:00:00 1970 From: Veaceslav Falico Subject: Re: [PATCH net-next 2/9] bonding: remove __get_first_port() Date: Fri, 27 Sep 2013 16:58:25 +0200 Message-ID: <20130927145825.GA14139@redhat.com> References: <1380291125-5671-1-git-send-email-vfalico@redhat.com> <1380291125-5671-3-git-send-email-vfalico@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Cc: netdev@vger.kernel.org, nikolay@redhat.com, bhutchings@solarflare.com, Jay Vosburgh , Andy Gospodarek To: David Laight Return-path: Received: from mx1.redhat.com ([209.132.183.28]:21986 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751719Ab3I0PAo (ORCPT ); Fri, 27 Sep 2013 11:00:44 -0400 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Fri, Sep 27, 2013 at 03:50:12PM +0100, David Laight wrote: >> @@ -2104,8 +2091,11 @@ void bond_3ad_state_machine_handler(struct work_struct *work) >> >> // check if agg_select_timer timer after initialize is timed out >> if (BOND_AD_INFO(bond).agg_select_timer && !(--BOND_AD_INFO(bond).agg_select_timer)) { >> + slave = bond_first_slave(bond); >> + port = slave ? &(SLAVE_AD_INFO(slave).port) : NULL; >> + >> // select the active aggregator for the bond >> - if ((port = __get_first_port(bond))) { >> + if (port) { >> if (!port->slave) { >> pr_warning("%s: Warning: bond's first port is uninitialized\n", >> bond->dev->name); >> -- > >Looks like that could be: > slave = bond_first_slave(bond); > if (slave) { > port = SLAVE_AD_INFO(slave).port; >and I assume 'slave == port->slave' so there is no need for the latter check? I've also fallen to this trap at first - slave->port can (virtually) be NULL, and this way we'll panic on "if (!port->slave)". > > David > > >