Selaa lähdekoodia

qcacld-3.0: Refine hdd_parse_user_params()

Currently hdd_parse_user_params() has a few places where it is not
compliant with the Linux coding style, so refine the code.

Change-Id: Ic18e1dfd82e4a8d820fb871801ead464bc146d04
CRs-Fixed: 2407327
Jeff Johnson 6 vuotta sitten
vanhempi
sitoutus
76e335b13b
1 muutettua tiedostoa jossa 15 lisäystä ja 12 poistoa
  1. 15 12
      core/hdd/src/wlan_hdd_ioctl.c

+ 15 - 12
core/hdd/src/wlan_hdd_ioctl.c

@@ -2417,35 +2417,38 @@ static void hdd_tx_fail_ind_callback(uint8_t *MacAddr, uint8_t seqNo)
 /**
  * hdd_parse_user_params() - return a pointer to the next argument
  * @command: Input argument string
- * @ppArg: Output pointer to the next argument
+ * @arg: Output pointer to the next argument
  *
  * This function parses argument stream and finds the pointer
  * to the next argument
  *
  * Return: 0 if the next argument found; -EINVAL otherwise
  */
-static int hdd_parse_user_params(uint8_t *command, uint8_t **ppArg)
+static int hdd_parse_user_params(uint8_t *command, uint8_t **arg)
 {
-	uint8_t *pVal;
+	uint8_t *cursor;
 
-	pVal = strnchr(command, strlen(command), ' ');
+	cursor = strnchr(command, strlen(command), SPACE_ASCII_VALUE);
 
-	if (NULL == pVal) /* no argument remains */
+	/* no argument remains ? */
+	if (!cursor)
 		return -EINVAL;
-	else if (SPACE_ASCII_VALUE != *pVal)/* no space after the current arg */
+
+	/* no space after the current arg ? */
+	if (SPACE_ASCII_VALUE != *cursor)
 		return -EINVAL;
 
-	pVal++;
+	cursor++;
 
 	/* remove empty spaces */
-	while ((SPACE_ASCII_VALUE == *pVal) && ('\0' != *pVal))
-		pVal++;
+	while (SPACE_ASCII_VALUE == *cursor)
+		cursor++;
 
-	/* no argument followed by spaces */
-	if ('\0' == *pVal)
+	/* no argument after the spaces ? */
+	if ('\0' == *cursor)
 		return -EINVAL;
 
-	*ppArg = pVal;
+	*arg = cursor;
 
 	return 0;
 }