Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752349AbdLKQKU (ORCPT ); Mon, 11 Dec 2017 11:10:20 -0500 Received: from mx2.suse.de ([195.135.220.15]:46280 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751400AbdLKQKS (ORCPT ); Mon, 11 Dec 2017 11:10:18 -0500 Date: Mon, 11 Dec 2017 17:10:17 +0100 Message-ID: From: Takashi Iwai To: Vinod Koul Cc: Greg Kroah-Hartman , LKML , ALSA , Mark , Pierre , patches.audio@intel.com, alan@linux.intel.com, Charles Keepax , Sagar Dharia , srinivas.kandagatla@linaro.org, plai@codeaurora.org, Sudheer Papothi Subject: Re: [PATCH v5 04/15] soundwire: Add MIPI DisCo property helpers In-Reply-To: <1512575231-4154-5-git-send-email-vinod.koul@intel.com> References: <1512575231-4154-1-git-send-email-vinod.koul@intel.com> <1512575231-4154-5-git-send-email-vinod.koul@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1254 Lines: 52 On Wed, 06 Dec 2017 16:47:00 +0100, Vinod Koul wrote: > > +static int sdw_slave_read_dpn(struct sdw_slave *slave, > + struct sdw_dpn_prop *dpn, int count, int ports, char *type) > +{ .... > + nval = fwnode_property_read_u32_array(node, > + "mipi-sdw-port-wordlength-configs", NULL, 0); > + if (nval > 0) > + dpn[i].num_words = nval; > + > + if (dpn[i].num_words) { > + dpn[i].words = devm_kcalloc(&slave->dev, nval, > + sizeof(*dpn[i].words), GFP_KERNEL); Inconsistent checks here: nval or dpn[i].num_words. > + nval = fwnode_property_read_u32_array(node, > + "mipi-sdw-channel-number-list", NULL, 0); > + if (nval > 0) > + dpn[i].num_ch = nval; > + > + if (dpn[i].num_ch) { > + dpn[i].ch = devm_kcalloc(&slave->dev, nval, > + sizeof(*dpn[i].ch), GFP_KERNEL); Ditto. > + nval = fwnode_property_read_u32_array(node, > + "mipi-sdw-channel-combination-list", NULL, 0); > + if (nval > 0) > + dpn[i].num_ch_combinations = nval; > + > + if (dpn[i].num_ch_combinations) { > + dpn[i].ch_combinations = devm_kcalloc(&slave->dev, > + nval, sizeof(*dpn[i].ch_combinations), > + GFP_KERNEL); Ditto. > + /* TODO: Read audio mode */ > + > + i++; > + } Don't we use count argument for a sanity check? Takashi