dmaengine: dw: define DW_DMA_MAX_NR_MASTERS
Instead of using magic number in the code the patch provides DW_DMA_MAX_NR_MASTERS constant. While here, restrict the reading of data width array by amount of the actual number of AHB masters. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:

committed by
Vinod Koul

parent
cfd8fef322
commit
d8ded50f8b
@@ -99,7 +99,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct dw_dma_platform_data *pdata;
|
||||
u32 tmp, arr[4];
|
||||
u32 tmp, arr[DW_DMA_MAX_NR_MASTERS];
|
||||
|
||||
if (!np) {
|
||||
dev_err(&pdev->dev, "Missing DT data\n");
|
||||
@@ -126,7 +126,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
|
||||
pdata->block_size = tmp;
|
||||
|
||||
if (!of_property_read_u32(np, "dma-masters", &tmp)) {
|
||||
if (tmp > 4)
|
||||
if (tmp > DW_DMA_MAX_NR_MASTERS)
|
||||
return NULL;
|
||||
|
||||
pdata->nr_masters = tmp;
|
||||
|
Reference in New Issue
Block a user