more patches for FPGA
Subsystems (2)
cover more patches for FPGA
Hi Greg,
Please take these three patches for FPGA. They go on top of my "[PATCH v6 00/18] patches for FPGA" patch set I sent earlier today. Sorry I didn't think of sending them all together at the time.
These are fixes for FPGA that have been reviewed on the mailing list.
I had to rebase the "fpga: region: release of_parse_phandle nodes after use" patch to apply on top of my patchset.
Alan
Gustavo A. R. Silva (2):
fpga: fpga-mgr: remove unnecessary code in __fpga_mgr_get
fpga: fpga-bridge: remove unnecessary null check in of_fpga_bridge_get
Ian Abbott (1):
fpga: region: release of_parse_phandle nodes after use
drivers/fpga/fpga-bridge.c | 2 -- drivers/fpga/fpga-mgr.c | 2 -- drivers/fpga/of-fpga-region.c | 13 ++++++++++--- 3 files changed, 10 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/3 fpga: fpga-mgr: remove unnecessary code in __fpga_mgr_get
From: "Gustavo A. R. Silva" <[email protected]>
Notice that mgr = to_fpga_manager(dev); expands to:
mgr = container_of(dev, struct fpga_manager, dev);
and container_of is never null, so this null check is unnecessary.
Addresses-Coverity-ID: 1397916
--- drivers/fpga/fpga-mgr.c | 2 -- 1 file changed, 2 deletions(-)
drivers/fpga/fpga-mgr.c +0 -2
@@ -412,8 +412,6 @@ static struct fpga_manager *__fpga_mgr_get(struct device *dev)struct fpga_manager *mgr; mgr =to_fpga_manager (dev); -if (!mgr) - goto err_dev;if (!try_module_get (dev->parent->driver->owner)) goto err_dev;
Signature · 1 line
2.7.4
PATCH 2/3 fpga: fpga-bridge: remove unnecessary null check in of_fpga_bridge_get
In reply to Alan TullFrom: "Gustavo A. R. Silva" <[email protected]>
Notice that bridge = to_fpga_bridge(dev); expands to:
bridge = container_of(dev, struct fpga_bridge, dev);
and container_of is never null, so this null check is unnecessary.
Addresses-Coverity-ID: 1397912
--- drivers/fpga/fpga-bridge.c | 2 -- 1 file changed, 2 deletions(-)
drivers/fpga/fpga-bridge.c +0 -2
@@ -78,8 +78,6 @@ static struct fpga_bridge *__fpga_bridge_get(struct device *dev,int ret = -ENODEV ; bridge =to_fpga_bridge (dev); -if (!bridge) - goto err_dev; bridge->info = info;
Signature · 1 line
2.7.4
PATCH 3/3 fpga: region: release of_parse_phandle nodes after use
In reply to Alan TullFrom: Ian Abbott <[email protected]>
Both fpga_region_get_manager() and fpga_region_get_bridges() call of_parse_phandle(), but nothing calls of_node_put() on the returned struct device_node pointers. Make sure to do that to stop their reference counters getting out of whack.
--- drivers/fpga/of-fpga-region.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/fpga/of-fpga-region.c +10 -3
@@ -73,6 +73,7 @@ static struct fpga_manager *of_fpga_region_get_mgr(struct device_node *np) mgr_node =of_parse_phandle (np,"fpga-mgr" ,0 );if (mgr_node) { mgr =of_fpga_mgr_get (mgr_node); +of_node_put (mgr_node);of_node_put (np);return mgr; }
@@ -120,10 +121,13 @@ static int of_fpga_region_get_bridges(struct fpga_region *region) parent_br = region_np->parent;/* If overlay has a list of bridges, use it. */ -if (of_parse_phandle (info->overlay,"fpga-bridges" ,0 )) + br =of_parse_phandle (info->overlay,"fpga-bridges" ,0 ); +if (br) { +of_node_put (br); np = info->overlay; -else + }else { np = region_np; + }for (i =0 ; ; i++) { br =of_parse_phandle (np,"fpga-bridges" , i);
@@ -131,12 +135,15 @@ static int of_fpga_region_get_bridges(struct fpga_region *region)break ;/* If parent bridge is in list, skip it. */ -if (br == parent_br) +if (br == parent_br) { +of_node_put (br);continue ; + }/* If node is a bridge, get it and add to list */ ret =of_fpga_bridge_get_to_list (br, info, ®ion->bridge_list); +of_node_put (br);/* If any of the bridges are in use, give up */ if (ret == -EBUSY ) {
Signature · 1 line
2.7.4