aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fpga/fpga-mgr.c
diff options
context:
space:
mode:
authorAlan Tull <atull@opensource.altera.com>2015-10-22 13:38:38 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-23 19:49:44 -0400
commit92d94a7ec552fafaa036fdb04d0894d6c444cafb (patch)
treefc240466f1bf3079934ba839c3b82656035b7e9f /drivers/fpga/fpga-mgr.c
parent654ba4cc0f3ed7c0f08bfb39f66059d8c42943ee (diff)
fpga manager: remove unnecessary null pointer checks
Remove unnecessary null pointer checks. We want the caller of these functions to do their own pointer checks. Add some comments to document this. Signed-off-by: Alan Tull <atull@opensource.altera.com> Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/fpga/fpga-mgr.c')
-rw-r--r--drivers/fpga/fpga-mgr.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index 68d7b41159cb..a24f5cb877e0 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -38,7 +38,8 @@ static struct class *fpga_mgr_class;
38 * 38 *
39 * Step the low level fpga manager through the device-specific steps of getting 39 * Step the low level fpga manager through the device-specific steps of getting
40 * an FPGA ready to be configured, writing the image to it, then doing whatever 40 * an FPGA ready to be configured, writing the image to it, then doing whatever
41 * post-configuration steps necessary. 41 * post-configuration steps necessary. This code assumes the caller got the
42 * mgr pointer from of_fpga_mgr_get() and checked that it is not an error code.
42 * 43 *
43 * Return: 0 on success, negative error code otherwise. 44 * Return: 0 on success, negative error code otherwise.
44 */ 45 */
@@ -48,9 +49,6 @@ int fpga_mgr_buf_load(struct fpga_manager *mgr, u32 flags, const char *buf,
48 struct device *dev = &mgr->dev; 49 struct device *dev = &mgr->dev;
49 int ret; 50 int ret;
50 51
51 if (!mgr)
52 return -ENODEV;
53
54 /* 52 /*
55 * Call the low level driver's write_init function. This will do the 53 * Call the low level driver's write_init function. This will do the
56 * device-specific things to get the FPGA into the state where it is 54 * device-specific things to get the FPGA into the state where it is
@@ -100,7 +98,8 @@ EXPORT_SYMBOL_GPL(fpga_mgr_buf_load);
100 * 98 *
101 * Request an FPGA image using the firmware class, then write out to the FPGA. 99 * Request an FPGA image using the firmware class, then write out to the FPGA.
102 * Update the state before each step to provide info on what step failed if 100 * Update the state before each step to provide info on what step failed if
103 * there is a failure. 101 * there is a failure. This code assumes the caller got the mgr pointer
102 * from of_fpga_mgr_get() and checked that it is not an error code.
104 * 103 *
105 * Return: 0 on success, negative error code otherwise. 104 * Return: 0 on success, negative error code otherwise.
106 */ 105 */
@@ -111,9 +110,6 @@ int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
111 const struct firmware *fw; 110 const struct firmware *fw;
112 int ret; 111 int ret;
113 112
114 if (!mgr)
115 return -ENODEV;
116
117 dev_info(dev, "writing %s to %s\n", image_name, mgr->name); 113 dev_info(dev, "writing %s to %s\n", image_name, mgr->name);
118 114
119 mgr->state = FPGA_MGR_STATE_FIRMWARE_REQ; 115 mgr->state = FPGA_MGR_STATE_FIRMWARE_REQ;