diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-09-18 03:33:08 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-10-06 22:11:39 -0400 |
commit | c95905a6a36858122afe1c334eba64499b39d7a2 (patch) | |
tree | 1f98979430da6498536d935e52a763bdcd1262fa /drivers/dma/ste_dma40.c | |
parent | 717d818169e5d5672fb81bc7357e9bb265d1e228 (diff) |
DMA: ste_dma40: use a power of 2 check
dst_addr_width and src_addr_width should be a power of 2. Currently the
driver checks, that they both lie between 1 and 8 and that they are equal
to 1 or even. This however leaves an invalid value of 6 uncaught. Use an
explicit power of 2 check instead.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
[typo fix on changelog]
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/ste_dma40.c')
-rw-r--r-- | drivers/dma/ste_dma40.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 82d2b97ad942..3d5e4ee94f5f 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/clk.h> | 15 | #include <linux/clk.h> |
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <linux/log2.h> | ||
17 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
18 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
19 | #include <linux/err.h> | 20 | #include <linux/err.h> |
@@ -2796,8 +2797,8 @@ static int d40_set_runtime_config(struct dma_chan *chan, | |||
2796 | src_addr_width > DMA_SLAVE_BUSWIDTH_8_BYTES || | 2797 | src_addr_width > DMA_SLAVE_BUSWIDTH_8_BYTES || |
2797 | dst_addr_width <= DMA_SLAVE_BUSWIDTH_UNDEFINED || | 2798 | dst_addr_width <= DMA_SLAVE_BUSWIDTH_UNDEFINED || |
2798 | dst_addr_width > DMA_SLAVE_BUSWIDTH_8_BYTES || | 2799 | dst_addr_width > DMA_SLAVE_BUSWIDTH_8_BYTES || |
2799 | ((src_addr_width > 1) && (src_addr_width & 1)) || | 2800 | !is_power_of_2(src_addr_width) || |
2800 | ((dst_addr_width > 1) && (dst_addr_width & 1))) | 2801 | !is_power_of_2(dst_addr_width)) |
2801 | return -EINVAL; | 2802 | return -EINVAL; |
2802 | 2803 | ||
2803 | cfg->src_info.data_width = src_addr_width; | 2804 | cfg->src_info.data_width = src_addr_width; |