Re: [PATCH] drm/rockchip: cdn-dp: send audio infoframe to sink

From: Doug Anderson
Date: Mon Jul 17 2017 - 16:44:37 EST


Hi,

On Mon, Jul 17, 2017 at 1:23 PM, Sean Paul <seanpaul@xxxxxxxxxxxx> wrote:
>> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
>> index 9b0b058..e59ca47 100644
>> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
>> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
>> @@ -802,6 +802,7 @@ static int cdn_dp_audio_hw_params(struct device *dev, void *data,
>> .sample_rate = params->sample_rate,
>> .channels = params->channels,
>> };
>> + u8 buffer[14];
>
> Why 14?
>
> I think you should probably have buffer[HDMI_AUDIO_INFOFRAME_SIZE +
> SDP_HEADER_SIZE] so the reader knows how you arrived at this value.
>
>> int ret;
>>
>> mutex_lock(&dp->lock);
>> @@ -823,6 +824,25 @@ static int cdn_dp_audio_hw_params(struct device *dev, void *data,
>> goto out;
>> }
>>
>> + memset(buffer, 0, sizeof(buffer));

It is less error prone (and probably makes better code) to just to do
this at init time. AKA:

u8 buffer[14] = { 0 };