diff options
author | Minghuan Lian <Minghuan.Lian@freescale.com> | 2014-10-23 12:29:39 (GMT) |
---|---|---|
committer | Matthew Weigel <Matthew.Weigel@freescale.com> | 2014-12-11 18:39:23 (GMT) |
commit | 7ac42ef158796c13dac8ff493fca8c98195bdbf3 (patch) | |
tree | 572bc59bc962e1a0d48b2040398803bff7c47dd3 /drivers/staging/fsl_rman | |
parent | cf27c2b123fe1e083df09946cb08f7dcf62c2685 (diff) | |
download | linux-fsl-qoriq-7ac42ef158796c13dac8ff493fca8c98195bdbf3.tar.xz |
fsl/RMan: Fix RMan global register initialization
If RMan dts node does not contain child node 'fsl,rman-global-cfg'
or the child node does not contain property 'reg', RMan global
register will not be initialized correctly. The patch is to fix
this issue.
Signed-off-by: Minghuan Lian <Minghuan.Lian@freescale.com>
Change-Id: Ifc781a28b3f6c59efe7fe44c37fd6f7c0e5efc1a
Reviewed-on: http://git.am.freescale.net:8181/21985
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Tiefei Zang <tie-fei.zang@freescale.com>
Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
Diffstat (limited to 'drivers/staging/fsl_rman')
-rw-r--r-- | drivers/staging/fsl_rman/rman_uio_driver.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/staging/fsl_rman/rman_uio_driver.c b/drivers/staging/fsl_rman/rman_uio_driver.c index e5c0d87..866b5bd 100644 --- a/drivers/staging/fsl_rman/rman_uio_driver.c +++ b/drivers/staging/fsl_rman/rman_uio_driver.c @@ -243,7 +243,7 @@ static int fsl_rman_probe(struct platform_device *dev) struct rman_dev *rman_dev; struct device_node *rman_node, *child; struct rman_inbound_block *ib, *tmp; - int err; + int err, global_reg_found = 0; rman_node = dev->dev.of_node; if (!rman_node) { @@ -268,16 +268,19 @@ static int fsl_rman_probe(struct platform_device *dev) fsl_rman_ib_probe(child, rman_dev); if (of_device_is_compatible(child, "fsl,rman-global-cfg")) { - err = of_address_to_resource(child, 0, ®s); - if (unlikely(err < 0)) { - dev_err(&dev->dev, - "Can't get property 'reg'\n"); - err = -EFAULT; - goto _err; - } + if (of_address_to_resource(child, 0, ®s)) + global_reg_found = 0; + else + global_reg_found = 1; } } + if (!global_reg_found) { + dev_err(&dev->dev, "Can't init global registers\n"); + err = -ENODEV; + goto _err; + } + snprintf(rman_dev->info.name, sizeof(rman_dev->info.name), "rman-uio"); rman_dev->res = devm_request_mem_region(&dev->dev, regs.start, |