Commit 4f8fc46c authored by Lee Jones's avatar Lee Jones Committed by Linus Walleij

dmaengine: ste_dma40: Rectify incorrect configuration validation checking

If we compare an event's group (dev_type / 16) with STEDMA40_DEV_DST_MEMORY
(-1), the only way we'd obtain a positive result is if we passed -16 as a
device type, which is unfeasible. Instead, it would be much more sane to
compare STEDMA40_DEV_DST_MEMORY against the raw dev_type in order to expect
the expected result.
Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 29027a1e
...@@ -1785,19 +1785,19 @@ static int d40_validate_conf(struct d40_chan *d40c, ...@@ -1785,19 +1785,19 @@ static int d40_validate_conf(struct d40_chan *d40c,
} }
if (conf->dir == STEDMA40_MEM_TO_PERIPH && if (conf->dir == STEDMA40_MEM_TO_PERIPH &&
dst_event_group == STEDMA40_DEV_DST_MEMORY) { conf->dst_dev_type == STEDMA40_DEV_DST_MEMORY) {
chan_err(d40c, "Invalid dst\n"); chan_err(d40c, "Invalid dst\n");
res = -EINVAL; res = -EINVAL;
} }
if (conf->dir == STEDMA40_PERIPH_TO_MEM && if (conf->dir == STEDMA40_PERIPH_TO_MEM &&
src_event_group == STEDMA40_DEV_SRC_MEMORY) { conf->src_dev_type == STEDMA40_DEV_SRC_MEMORY) {
chan_err(d40c, "Invalid src\n"); chan_err(d40c, "Invalid src\n");
res = -EINVAL; res = -EINVAL;
} }
if (src_event_group == STEDMA40_DEV_SRC_MEMORY && if (conf->src_dev_type == STEDMA40_DEV_SRC_MEMORY &&
dst_event_group == STEDMA40_DEV_DST_MEMORY && is_log) { conf->dst_dev_type == STEDMA40_DEV_DST_MEMORY && is_log) {
chan_err(d40c, "No event line\n"); chan_err(d40c, "No event line\n");
res = -EINVAL; res = -EINVAL;
} }
......
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