ALSA: asihpi - Use size_t for sizeof result
[pandora-kernel.git] / sound / pci / asihpi / hpicmn.c
index b15a02e..65b7ca1 100644 (file)
@@ -57,7 +57,7 @@ u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr)
        }
 
        if (phr->function != phm->function) {
-               HPI_DEBUG_LOG(ERROR, "header type %d invalid\n",
+               HPI_DEBUG_LOG(ERROR, "header function %d invalid\n",
                        phr->function);
                return HPI_ERROR_INVALID_RESPONSE;
        }
@@ -315,8 +315,7 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
        short found = 1;
        struct hpi_control_cache_info *pI;
        struct hpi_control_cache_single *pC;
-       struct hpi_control_cache_pad *p_pad;
-
+       size_t response_size;
        if (!find_control(phm->obj_index, p_cache, &pI)) {
                HPI_DEBUG_LOG(VERBOSE,
                        "HPICMN find_control() failed for adap %d\n",
@@ -326,11 +325,15 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
 
        phr->error = 0;
 
+       /* set the default response size */
+       response_size =
+               sizeof(struct hpi_response_header) +
+               sizeof(struct hpi_control_res);
+
        /* pC is the default cached control strucure. May be cast to
           something else in the following switch statement.
         */
        pC = (struct hpi_control_cache_single *)pI;
-       p_pad = (struct hpi_control_cache_pad *)pI;
 
        switch (pI->control_type) {
 
@@ -529,9 +532,7 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
                pI->control_index, pI->control_type, phm->u.c.attribute);
 
        if (found)
-               phr->size =
-                       sizeof(struct hpi_response_header) +
-                       sizeof(struct hpi_control_res);
+               phr->size = (u16)response_size;
 
        return found;
 }
@@ -682,7 +683,7 @@ static void subsys_message(struct hpi_message *phm, struct hpi_response *phr)
 void HPI_COMMON(struct hpi_message *phm, struct hpi_response *phr)
 {
        switch (phm->type) {
-       case HPI_TYPE_MESSAGE:
+       case HPI_TYPE_REQUEST:
                switch (phm->object) {
                case HPI_OBJ_SUBSYSTEM:
                        subsys_message(phm, phr);