net: fec: Fix sparse warnings with different lock contexts for basic block
authorNimrod Andy <B38611@freescale.com>
Mon, 13 Oct 2014 02:53:48 +0000 (10:53 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Oct 2014 16:53:37 +0000 (12:53 -0400)
commit5bc26726ada73264c0fd7b93ccbe7d9e78b2b2d2
treec537b4ff0ae35446eb08ea1f36284d6888241d28
parentc53fed07a03d8b2a2e3bdaba87768211fa55806c
net: fec: Fix sparse warnings with different lock contexts for basic block

reproduce:
make  ARCH=arm C=1 2>fec.txt drivers/net/ethernet/freescale/fec_main.o
cat fec.txt

sparse warnings:
drivers/net/ethernet/freescale/fec_main.c:2916:12: warning: context imbalance
in 'fec_set_features' - different lock contexts for basic block

Christopher Li suggest to change as below:
if (need_lock) {
lock();
do_something_real();
unlock();
} else {
do_something_real();
}

Reported-by: Fabio Estevam <festevam@gmail.com>
Suggested-by: Christopher Li <sparse@chrisli.org>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c