diff options
Diffstat (limited to 'sound/pci/asihpi/hpicmn.c')
-rw-r--r-- | sound/pci/asihpi/hpicmn.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c index b15a02e91f8..bd47521b24e 100644 --- a/sound/pci/asihpi/hpicmn.c +++ b/sound/pci/asihpi/hpicmn.c | |||
@@ -57,7 +57,7 @@ u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr) | |||
57 | } | 57 | } |
58 | 58 | ||
59 | if (phr->function != phm->function) { | 59 | if (phr->function != phm->function) { |
60 | HPI_DEBUG_LOG(ERROR, "header type %d invalid\n", | 60 | HPI_DEBUG_LOG(ERROR, "header function %d invalid\n", |
61 | phr->function); | 61 | phr->function); |
62 | return HPI_ERROR_INVALID_RESPONSE; | 62 | return HPI_ERROR_INVALID_RESPONSE; |
63 | } | 63 | } |
@@ -315,8 +315,7 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, | |||
315 | short found = 1; | 315 | short found = 1; |
316 | struct hpi_control_cache_info *pI; | 316 | struct hpi_control_cache_info *pI; |
317 | struct hpi_control_cache_single *pC; | 317 | struct hpi_control_cache_single *pC; |
318 | struct hpi_control_cache_pad *p_pad; | 318 | size_t response_size; |
319 | |||
320 | if (!find_control(phm->obj_index, p_cache, &pI)) { | 319 | if (!find_control(phm->obj_index, p_cache, &pI)) { |
321 | HPI_DEBUG_LOG(VERBOSE, | 320 | HPI_DEBUG_LOG(VERBOSE, |
322 | "HPICMN find_control() failed for adap %d\n", | 321 | "HPICMN find_control() failed for adap %d\n", |
@@ -326,11 +325,15 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, | |||
326 | 325 | ||
327 | phr->error = 0; | 326 | phr->error = 0; |
328 | 327 | ||
328 | /* set the default response size */ | ||
329 | response_size = | ||
330 | sizeof(struct hpi_response_header) + | ||
331 | sizeof(struct hpi_control_res); | ||
332 | |||
329 | /* pC is the default cached control strucure. May be cast to | 333 | /* pC is the default cached control strucure. May be cast to |
330 | something else in the following switch statement. | 334 | something else in the following switch statement. |
331 | */ | 335 | */ |
332 | pC = (struct hpi_control_cache_single *)pI; | 336 | pC = (struct hpi_control_cache_single *)pI; |
333 | p_pad = (struct hpi_control_cache_pad *)pI; | ||
334 | 337 | ||
335 | switch (pI->control_type) { | 338 | switch (pI->control_type) { |
336 | 339 | ||
@@ -529,9 +532,7 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, | |||
529 | pI->control_index, pI->control_type, phm->u.c.attribute); | 532 | pI->control_index, pI->control_type, phm->u.c.attribute); |
530 | 533 | ||
531 | if (found) | 534 | if (found) |
532 | phr->size = | 535 | phr->size = (u16)response_size; |
533 | sizeof(struct hpi_response_header) + | ||
534 | sizeof(struct hpi_control_res); | ||
535 | 536 | ||
536 | return found; | 537 | return found; |
537 | } | 538 | } |
@@ -630,13 +631,12 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32 control_count, | |||
630 | if (!p_cache) | 631 | if (!p_cache) |
631 | return NULL; | 632 | return NULL; |
632 | 633 | ||
633 | p_cache->p_info = | 634 | p_cache->p_info = kzalloc(sizeof(*p_cache->p_info) * control_count, |
634 | kmalloc(sizeof(*p_cache->p_info) * control_count, GFP_KERNEL); | 635 | GFP_KERNEL); |
635 | if (!p_cache->p_info) { | 636 | if (!p_cache->p_info) { |
636 | kfree(p_cache); | 637 | kfree(p_cache); |
637 | return NULL; | 638 | return NULL; |
638 | } | 639 | } |
639 | memset(p_cache->p_info, 0, sizeof(*p_cache->p_info) * control_count); | ||
640 | p_cache->cache_size_in_bytes = size_in_bytes; | 640 | p_cache->cache_size_in_bytes = size_in_bytes; |
641 | p_cache->control_count = control_count; | 641 | p_cache->control_count = control_count; |
642 | p_cache->p_cache = p_dsp_control_buffer; | 642 | p_cache->p_cache = p_dsp_control_buffer; |
@@ -682,7 +682,7 @@ static void subsys_message(struct hpi_message *phm, struct hpi_response *phr) | |||
682 | void HPI_COMMON(struct hpi_message *phm, struct hpi_response *phr) | 682 | void HPI_COMMON(struct hpi_message *phm, struct hpi_response *phr) |
683 | { | 683 | { |
684 | switch (phm->type) { | 684 | switch (phm->type) { |
685 | case HPI_TYPE_MESSAGE: | 685 | case HPI_TYPE_REQUEST: |
686 | switch (phm->object) { | 686 | switch (phm->object) { |
687 | case HPI_OBJ_SUBSYSTEM: | 687 | case HPI_OBJ_SUBSYSTEM: |
688 | subsys_message(phm, phr); | 688 | subsys_message(phm, phr); |