How about just initializing it when the rest of the struct is initialized? This is what is done for every other model.
On Fri, Jul 8, 2016 at 2:47 AM, zhuyj <zyjzyj2...@gmail.com> wrote: > Sure. setup_fc should not be null. Emil, your patch can fix it well. > > On Fri, Jul 8, 2016 at 8:18 AM, Tantilov, Emil S <emil.s.tanti...@intel.com> > wrote: >> >> >-----Original Message----- >> >From: Intel-wired-lan [mailto:intel-wired-lan-boun...@lists.osuosl.org] >> > On >> >Behalf Of Rustad, Mark D >> >Sent: Wednesday, July 06, 2016 4:01 PM >> >To: Patrick McLean <patri...@gaikai.com> >> >Cc: netdev <netdev@vger.kernel.org>; intel-wired-lan <intel-wired- >> >l...@lists.osuosl.org> >> >Subject: Re: [Intel-wired-lan] [PATCH] (resend) ixgbe: always initialize >> >setup_fc >> > >> >Patrick McLean <patri...@gaikai.com> wrote: >> > >> >> Gmail mangled my first message, sorry about that. Second attempt. >> >> >> >> In ixgbe_init_mac_link_ops_X550em, the code has a special case for >> >> backplane media type, but does not fall through to the default case, >> >> so the setup_fc never gets initialized. This causes a panic when it >> >> later tries to set up the card, and the kernel dereferences the null >> >> pointer. >> >> >> >> This patch lets the the function fall through, which initialized >> >> setup_fc properly. >> > >> >I don't think that this is the right fix. My memory is that fc autoneg is >> >> setup_fc() does not configure FC autoneg and it should always be set. >> >> I posted an alternative patch that simply sets setup_fc at the beginning >> of >> the function. The fall-through in the switch statement is not a good >> solution >> because it won't work in case we need to add another case. >> >> http://patchwork.ozlabs.org/patch/646228/ >> >> Thanks, >> Emil >> >
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c index 19b75cd..cfc814a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c @@ -2915,7 +2915,7 @@ static const struct ixgbe_mac_operations mac_ops_X550EM_x = { .acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X550em, .release_swfw_sync = &ixgbe_release_swfw_sync_X550em, .init_swfw_sync = &ixgbe_init_swfw_sync_X540, - .setup_fc = NULL, /* defined later */ + .setup_fc = ixgbe_setup_fc_x550em, .read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550, .write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550, };