[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5hbmj5kzyu.wl-tiwai@suse.de>
Date: Mon, 11 Dec 2017 17:10:17 +0100
From: Takashi Iwai <tiwai@...e.de>
To: Vinod Koul <vinod.koul@...el.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
LKML <linux-kernel@...r.kernel.org>,
ALSA <alsa-devel@...a-project.org>, Mark <broonie@...nel.org>,
Pierre <pierre-louis.bossart@...ux.intel.com>,
patches.audio@...el.com, alan@...ux.intel.com,
Charles Keepax <ckeepax@...nsource.cirrus.com>,
Sagar Dharia <sdharia@...eaurora.org>,
srinivas.kandagatla@...aro.org, plai@...eaurora.org,
Sudheer Papothi <spapothi@...eaurora.org>
Subject: Re: [PATCH v5 04/15] soundwire: Add MIPI DisCo property helpers
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
Powered by blists - more mailing lists