[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1445535518-13406-3-git-send-email-atull@opensource.altera.com>
Date: Thu, 22 Oct 2015 12:38:38 -0500
From: <atull@...nsource.altera.com>
To: <gregkh@...uxfoundation.org>
CC: Josh Cartwright <joshc@...com>,
Moritz Fischer <moritz.fischer@...us.com>,
<linux-kernel@...r.kernel.org>, <delicious.quinoa@...il.com>,
<dinguyen@...nsource.altera.com>,
Alan Tull <atull@...nsource.altera.com>
Subject: [PATCH 2/2] fpga manager: remove unnecessary null pointer checks
From: Alan Tull <atull@...nsource.altera.com>
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@...nsource.altera.com>
---
drivers/fpga/fpga-mgr.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index 68d7b41..a24f5cb 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -38,7 +38,8 @@ static struct class *fpga_mgr_class;
*
* Step the low level fpga manager through the device-specific steps of getting
* an FPGA ready to be configured, writing the image to it, then doing whatever
- * post-configuration steps necessary.
+ * post-configuration steps necessary. This code assumes the caller got the
+ * mgr pointer from of_fpga_mgr_get() and checked that it is not an error code.
*
* Return: 0 on success, negative error code otherwise.
*/
@@ -48,9 +49,6 @@ int fpga_mgr_buf_load(struct fpga_manager *mgr, u32 flags, const char *buf,
struct device *dev = &mgr->dev;
int ret;
- if (!mgr)
- return -ENODEV;
-
/*
* Call the low level driver's write_init function. This will do the
* device-specific things to get the FPGA into the state where it is
@@ -100,7 +98,8 @@ EXPORT_SYMBOL_GPL(fpga_mgr_buf_load);
*
* Request an FPGA image using the firmware class, then write out to the FPGA.
* Update the state before each step to provide info on what step failed if
- * there is a failure.
+ * there is a failure. This code assumes the caller got the mgr pointer
+ * from of_fpga_mgr_get() and checked that it is not an error code.
*
* Return: 0 on success, negative error code otherwise.
*/
@@ -111,9 +110,6 @@ int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
const struct firmware *fw;
int ret;
- if (!mgr)
- return -ENODEV;
-
dev_info(dev, "writing %s to %s\n", image_name, mgr->name);
mgr->state = FPGA_MGR_STATE_FIRMWARE_REQ;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists