Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751392AbdGQUoc (ORCPT ); Mon, 17 Jul 2017 16:44:32 -0400 Received: from mail-wr0-f175.google.com ([209.85.128.175]:33320 "EHLO mail-wr0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbdGQUoa (ORCPT ); Mon, 17 Jul 2017 16:44:30 -0400 MIME-Version: 1.0 In-Reply-To: <20170717202300.c2r7ypclqbwvqbzq@art_vandelay> References: <1500116418-4178-1-git-send-email-zyw@rock-chips.com> <20170717202300.c2r7ypclqbwvqbzq@art_vandelay> From: Doug Anderson Date: Mon, 17 Jul 2017 13:44:28 -0700 X-Google-Sender-Auth: AAwXyI2hY7qE1aL0yJuhprXjzAw Message-ID: Subject: Re: [PATCH] drm/rockchip: cdn-dp: send audio infoframe to sink To: Sean Paul Cc: Chris Zhong , "open list:ARM/Rockchip SoC..." , Brian Norris , Mark Yao , David Airlie , Heiko Stuebner , "dri-devel@lists.freedesktop.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1035 Lines: 31 Hi, On Mon, Jul 17, 2017 at 1:23 PM, Sean Paul 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 };