Commit c1f25dc7 authored by David S. Miller's avatar David S. Miller Committed by Arnaldo Carvalho de Melo

[NET]: Do not let GCC reload pointers after NULL checks.

parent 43062f4f
...@@ -149,10 +149,12 @@ static __inline__ void net_family_bug(int family) ...@@ -149,10 +149,12 @@ static __inline__ void net_family_bug(int family)
int net_family_get(int family) int net_family_get(int family)
{ {
struct net_proto_family *prot = net_families[family];
int rc = 1; int rc = 1;
if (likely(net_families[family] != NULL)) barrier();
rc = try_module_get(net_families[family]->owner); if (likely(prot != NULL))
rc = try_module_get(prot->owner);
else else
net_family_bug(family); net_family_bug(family);
return rc; return rc;
...@@ -160,8 +162,11 @@ int net_family_get(int family) ...@@ -160,8 +162,11 @@ int net_family_get(int family)
void net_family_put(int family) void net_family_put(int family)
{ {
if (likely(net_families[family] != NULL)) struct net_proto_family *prot = net_families[family];
module_put(net_families[family]->owner);
barrier();
if (likely(prot != NULL))
module_put(prot->owner);
else else
net_family_bug(family); net_family_bug(family);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment