Re: [PATCH] Staging: bcm: CmHost: moved and removed declarations in switch/case.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mark,

Yes, in fact it does if not for the shear fact that a declaration is
not a statement. This file as well as the rest of bcm is in working draft
state a real wart hog so to speak, and contained w/in it are developer tricks to mask over would be compiler errors that would crop up during the construction of. In this scenario the bracing added to the case lables (witch I also plan to remove) are masking over that very fact, that it is illegal to put a declaration where only a statement can be put, so...

Thanks,
-Gary Rookard

On Sun, 16 Mar 2014, Mark Einon wrote:

On Sun, Mar 16, 2014 at 01:09:49AM -0400, Gary Rookard wrote:
I moved the declarations UINT uiSearchRuleIndex = 0; and ULONG ulSFID;
from out of a switch/case statement. And also, removed useless duplicate
UINT uiSearchRuleIndex = 0; and a variant UINT uiSearchRuleIndex;.

Hi,

This looks like code churn - does it fix anything?

It's also on the rx path for the device, I'm not familiar with the device
details but it could be called with high frequency - so only initialising these
variables on the paths where they are used would be a good thing.

Cheers,

Mark


Signed-off-by: Gary Alan Rookard <garyrookard@xxxxxxxxx>

---
On branch staging-next
 drivers/staging/bcm/CmHost.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c
index cc91b5e..2d1f94d 100644
--- a/drivers/staging/bcm/CmHost.c
+++ b/drivers/staging/bcm/CmHost.c
@@ -1637,7 +1637,8 @@ bool CmControlResponseMessage(struct bcm_mini_adapter *Adapter,  /* <Pointer to
 	struct bcm_add_indication_alt *pstAddIndication = NULL;
 	struct bcm_change_indication *pstChangeIndication = NULL;
 	struct bcm_leader *pLeader = NULL;
-
+	UINT uiSearchRuleIndex = 0;
+	ULONG ulSFID;
 	/*
 	 * Otherwise the message contains a target address from where we need to
 	 * read out the rest of the service flow param structure
@@ -1685,7 +1686,6 @@ bool CmControlResponseMessage(struct bcm_mini_adapter *Adapter,  /* <Pointer to
 	} /* no break here..we should go down. */
 	case DSA_ACK:
 	{
-		UINT uiSearchRuleIndex = 0;

 		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "VCID:0x%X",
 				ntohs(pstAddIndication->u16VCID));
@@ -1794,7 +1794,6 @@ bool CmControlResponseMessage(struct bcm_mini_adapter *Adapter,  /* <Pointer to
 	}
 	case DSC_ACK:
 	{
-		UINT uiSearchRuleIndex = 0;

 		pstChangeIndication = (struct bcm_change_indication *)pstAddIndication;
 		uiSearchRuleIndex = SearchSfid(Adapter, ntohl(pstChangeIndication->sfActiveSet.u32SFID));
@@ -1853,8 +1852,6 @@ bool CmControlResponseMessage(struct bcm_mini_adapter *Adapter,  /* <Pointer to
 	break;
 	case DSD_REQ:
 	{
-		UINT uiSearchRuleIndex;
-		ULONG ulSFID;

 		pLeader->PLength = sizeof(struct bcm_del_indication);
 		*((struct bcm_del_indication *)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *((struct bcm_del_indication *)pstAddIndication);
--
1.9.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux