Commit 5ec17b98 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul

soundwire: stream: simplify check on port range

Pass the index directly to sdw_is_valid_port_range(), this will be
useful for further simplifications.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRander Wang <rander.wang@intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220126011715.28204-4-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 823ca885
......@@ -1177,12 +1177,10 @@ static int sdw_config_stream(struct device *dev,
return 0;
}
static int sdw_is_valid_port_range(struct device *dev,
struct sdw_port_runtime *p_rt)
static int sdw_is_valid_port_range(struct device *dev, int num)
{
if (!SDW_VALID_PORT_RANGE(p_rt->num)) {
dev_err(dev,
"SoundWire: Invalid port number :%d\n", p_rt->num);
if (!SDW_VALID_PORT_RANGE(num)) {
dev_err(dev, "SoundWire: Invalid port number :%d\n", num);
return -EINVAL;
}
......@@ -1249,7 +1247,7 @@ static int sdw_slave_port_config(struct sdw_slave *slave,
* TODO: Check valid port range as defined by DisCo/
* slave
*/
ret = sdw_is_valid_port_range(&slave->dev, p_rt);
ret = sdw_is_valid_port_range(&slave->dev, port_config[i].num);
if (ret < 0) {
kfree(p_rt);
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment