fpga: fpga-mgr: remove unnecessary code in __fpga_mgr_get
PATCH 1/1 fpga: fpga-mgr: remove unnecessary code in __fpga_mgr_get
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
@@ -367,8 +367,6 @@ static struct fpga_manager *__fpga_mgr_get(struct device *dev)int ret = -ENODEV ; mgr =to_fpga_manager (dev); -if (!mgr) - goto err_dev;/* Get exclusive use of fpga manager */ if (!mutex_trylock (&mgr->ref_mutex)) {
Signature · 1 line
2.7.4
On Thu, Oct 26, 2017 at 6:02 PM, Gustavo A. R. Silva <[email protected]> wrote:
Hi Gustavo,
Thanks for pointing that out. There's also a similar thing in fpga-bridge.c that I need to fix.
Alan
Quoted 29 lines
Notice that mgr =
to_fpga_manager(dev); expands to:mgr =
container_of(dev, struct fpga_manager, dev);and
container_ofis never null, so this null check is unnecessary.Addresses-Coverity-ID: 1397916
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/fpga/fpga-mgr.c | 2 -- 1 file changed, 2 deletions(-)drivers/fpga/fpga-mgr.c +0
-3@@ -367,8 +367,6 @@ static struct fpga_manager *__fpga_mgr_get(struct device *dev)int ret = -ENODEV ; mgr =to_fpga_manager (dev); -if (!mgr) - goto err_dev;/* Get exclusive use of fpga manager */ if (!mutex_trylock (&mgr->ref_mutex)) { --2.7.4
Hi Alan,
Quoting Alan Tull <[email protected]>:
Quoted 8 lines
On Thu, Oct 26, 2017 at 6:02 PM, Gustavo A. R. Silva <[email protected]> wrote:
Hi Gustavo,
Thanks for pointing that out. There's also a similar thing in
fpga-bridge.cthat I need to fix.
Can you share with me what exactly are you trying to fix?
If the issue is similar I might be able to help.
Thanks
--
Gustavo A. R. Silva
Quoted 32 lines
Alan
Quoted 30 lines
Notice that mgr =
to_fpga_manager(dev); expands to:mgr =
container_of(dev, struct fpga_manager, dev);and
container_ofis never null, so this null check is unnecessary.Addresses-Coverity-ID: 1397916
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/fpga/fpga-mgr.c | 2 -- 1 file changed, 2 deletions(-)drivers/fpga/fpga-mgr.c +0
-2@@ -367,8 +367,6 @@ static struct fpga_manager *__fpga_mgr_get(struct device *dev)int ret = -ENODEV ; mgr =to_fpga_manager (dev); -if (!mgr) - goto err_dev;/* Get exclusive use of fpga manager */ if (!mutex_trylock(&mgr->ref_mutex)) {--
2.7.4
Quoted 9 lines · Gustavo A. R. Silva
Hi Alan,
Quoting Alan Tull <[email protected]>:
Quoted 5 lines
On Thu, Oct 26, 2017 at 6:02 PM, Gustavo A. R. Silva <[email protected]> wrote:
Hi Gustavo,
Quoted 7 lines
Quoted 3 lines
Thanks for pointing that out. There's also a similar thing in
fpga-bridge.cthat I need to fix.Can you share with me what exactly are you trying to fix?
If the issue is similar I might be able to help.
Same fix, but in of_fpga_bridge_get. Checks the output of to_fpga_bridge for NULL.
Thanks,
Alan
Quoted 36 lines
Thanks
--
Gustavo A. R. SilvaQuoted 31 lines
Alan
Quoted 29 lines
Notice that mgr =
to_fpga_manager(dev); expands to:mgr =
container_of(dev, struct fpga_manager, dev);and
container_ofis never null, so this null check is unnecessary.Addresses-Coverity-ID: 1397916
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/fpga/fpga-mgr.c | 2 -- 1 file changed, 2 deletions(-)drivers/fpga/fpga-mgr.c +0
-2@@ -367,8 +367,6 @@ static struct fpga_manager *__fpga_mgr_get(struct device *dev)int ret = -ENODEV ; mgr =to_fpga_manager (dev); -if (!mgr) - goto err_dev;/* Get exclusive use of fpga manager */ if (!mutex_trylock(&mgr->ref_mutex)) {--
2.7.4
Quoting Alan Tull <[email protected]>:
Quoted 15 lines
Quoted 13 lines · Gustavo A. R. Silva
Hi Alan,
Quoting Alan Tull <[email protected]>:
Quoted 8 lines
On Thu, Oct 26, 2017 at 6:02 PM, Gustavo A. R. Silva <[email protected]> wrote:
Hi Gustavo,
Thanks for pointing that out. There's also a similar thing in
fpga-bridge.cthat I need to fix.
Quoted 7 lines
Quoted 3 lines
Can you share with me what exactly are you trying to fix?
If the issue is similar I might be able to help.
Same fix, but in
of_fpga_bridge_get. Checks the output ofto_fpga_bridgefor NULL.
Oh I see now. I'll send a patch for this shortly.
Thanks!
--
Gustavo A. R. Silva