fpga: zynqmp-fpga: Correctly handle error pointer
Subsystems (2)
Moritz Fischer
maintainerPATCH 1/1 fpga: zynqmp-fpga: Correctly handle error pointer
Fixes the following static checker error:
drivers/fpga/zynqmp-fpga.c:50 zynqmp_fpga_ops_write()
error: 'eemi_ops' dereferencing possible ERR_PTR()
Note: This does not handle the EPROBE_DEFER value in a
special manner.
Fixes commit c09f7471127e ("fpga manager: Adding FPGA Manager support for Xilinx zynqmp")
--- drivers/fpga/zynqmp-fpga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/zynqmp-fpga.c +1 -1
@@ -47,7 +47,7 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,char *kbuf;int ret; -if (!eemi_ops || !eemi_ops->fpga_load) +if (IS_ERR_OR_NULL (eemi_ops) || !eemi_ops->fpga_load)return -ENXIO ; priv = mgr->priv;
Signature · 1 line
2.21.0
On Tue, May 7, 2019 at 12:03 PM Moritz Fischer <[email protected]> wrote:
Hi Moritz,
Quoted 22 lines
Fixes the following static checker error:
drivers/fpga/zynqmp-fpga.c:50zynqmp_fpga_ops_write()
error: 'eemi_ops' dereferencing possibleERR_PTR()Note: This does not handle the
EPROBE_DEFERvalue in a
special manner.Fixes commit
c09f7471127e("fpga manager: Adding FPGA Manager support for Xilinx zynqmp")Reported-by Dan Carpenter <[email protected]>Signed-off-by Moritz Fischer <[email protected]>--- drivers/fpga/zynqmp-fpga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/fpga/zynqmp-fpga.c +0
-0
drivers/fpga/zynqmp-fpga.c static int zynqmp_fpga_ops_write(struct fpga_manager *mgr, · line 50
Quoted 5 lines
drivers/fpga/zynqmp-fpga.c +1
-1@@ -47,7 +47,7 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,char *kbuf;int ret; -if (!eemi_ops || !eemi_ops->fpga_load) +if (IS_ERR_OR_NULL (eemi_ops) || !eemi_ops->fpga_load)
This if statement also happens in fpga_mgr_states zynqmp_fpga_ops_state(), so we'll need this fix there also.
Quoted 6 lines
drivers/fpga/zynqmp-fpga.c +0
-1return -ENXIO ; priv = mgr->priv; --2.21.0
Alan
Moritz Fischer
maintainerAlan,
Quoted 29 lines · Alan Tull
On Tue, May 7, 2019 at 12:03 PM Moritz Fischer <[email protected]> wrote:
Hi Moritz,
Quoted 25 lines
Fixes the following static checker error:
drivers/fpga/zynqmp-fpga.c:50zynqmp_fpga_ops_write()
error: 'eemi_ops' dereferencing possibleERR_PTR()Note: This does not handle the
EPROBE_DEFERvalue in a
special manner.Fixes commit
c09f7471127e("fpga manager: Adding FPGA Manager support for Xilinx zynqmp")Reported-by Dan Carpenter <[email protected]>Signed-off-by Moritz Fischer <[email protected]>--- drivers/fpga/zynqmp-fpga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/fpga/zynqmp-fpga.c +0
-0@@ -47,7 +47,7 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,char *kbuf;int ret;
Quoted 5 lines
drivers/fpga/zynqmp-fpga.c static int zynqmp_fpga_ops_write(struct fpga_manager *mgr, · line 50
Quoted 2 lines
drivers/fpga/zynqmp-fpga.c +1
-1-if (!eemi_ops || !eemi_ops->fpga_load) +if (IS_ERR_OR_NULL (eemi_ops) || !eemi_ops->fpga_load)This if statement also happens in
fpga_mgr_stateszynqmp_fpga_ops_state(), so we'll need this fix there also.
Good catch, will fix in v2.
Thanks
Moritz