When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Clean up the greybus camera driver by not caring about the value of debugfs calls. This ends up removing a number of lines of code that are not needed.
Cc: Johan Hovold johan@kernel.org Cc: Alex Elder elder@kernel.org Cc: Greg Kroah-Hartman gregkh@linuxfoundation.org Cc: greybus-dev@lists.linaro.org Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org --- drivers/staging/greybus/camera.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index 07ebfb88db9b..341f729a9779 100644 --- a/drivers/staging/greybus/camera.c +++ b/drivers/staging/greybus/camera.c @@ -1174,11 +1174,6 @@ static int gb_camera_debugfs_init(struct gb_camera *gcam) gcam->bundle->id);
gcam->debugfs.root = debugfs_create_dir(dirname, gb_debugfs_get()); - if (IS_ERR(gcam->debugfs.root)) { - gcam_err(gcam, "debugfs root create failed (%ld)\n", - PTR_ERR(gcam->debugfs.root)); - return PTR_ERR(gcam->debugfs.root); - }
gcam->debugfs.buffers = vmalloc(sizeof(*gcam->debugfs.buffers) * GB_CAMERA_DEBUGFS_BUFFER_MAX); @@ -1188,18 +1183,12 @@ static int gb_camera_debugfs_init(struct gb_camera *gcam) for (i = 0; i < ARRAY_SIZE(gb_camera_debugfs_entries); ++i) { const struct gb_camera_debugfs_entry *entry = &gb_camera_debugfs_entries[i]; - struct dentry *dentry;
gcam->debugfs.buffers[i].length = 0;
- dentry = debugfs_create_file(entry->name, entry->mask, - gcam->debugfs.root, gcam, - &gb_camera_debugfs_ops); - if (IS_ERR(dentry)) { - gcam_err(gcam, - "debugfs operation %s create failed (%ld)\n", - entry->name, PTR_ERR(dentry)); - return PTR_ERR(dentry); + debugfs_create_file(entry->name, entry->mask, + gcam->debugfs.root, gcam, + &gb_camera_debugfs_ops); } }
On 29-05-18, 16:29, Greg Kroah-Hartman wrote:
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Clean up the greybus camera driver by not caring about the value of debugfs calls. This ends up removing a number of lines of code that are not needed.
Cc: Johan Hovold johan@kernel.org Cc: Alex Elder elder@kernel.org Cc: Greg Kroah-Hartman gregkh@linuxfoundation.org Cc: greybus-dev@lists.linaro.org Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
drivers/staging/greybus/camera.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index 07ebfb88db9b..341f729a9779 100644 --- a/drivers/staging/greybus/camera.c +++ b/drivers/staging/greybus/camera.c @@ -1174,11 +1174,6 @@ static int gb_camera_debugfs_init(struct gb_camera *gcam) gcam->bundle->id); gcam->debugfs.root = debugfs_create_dir(dirname, gb_debugfs_get());
- if (IS_ERR(gcam->debugfs.root)) {
gcam_err(gcam, "debugfs root create failed (%ld)\n",
PTR_ERR(gcam->debugfs.root));
return PTR_ERR(gcam->debugfs.root);
- }
gcam->debugfs.buffers = vmalloc(sizeof(*gcam->debugfs.buffers) * GB_CAMERA_DEBUGFS_BUFFER_MAX); @@ -1188,18 +1183,12 @@ static int gb_camera_debugfs_init(struct gb_camera *gcam) for (i = 0; i < ARRAY_SIZE(gb_camera_debugfs_entries); ++i) { const struct gb_camera_debugfs_entry *entry = &gb_camera_debugfs_entries[i];
struct dentry *dentry;
gcam->debugfs.buffers[i].length = 0;
dentry = debugfs_create_file(entry->name, entry->mask,
gcam->debugfs.root, gcam,
&gb_camera_debugfs_ops);
if (IS_ERR(dentry)) {
gcam_err(gcam,
"debugfs operation %s create failed (%ld)\n",
entry->name, PTR_ERR(dentry));
return PTR_ERR(dentry);
debugfs_create_file(entry->name, entry->mask,
gcam->debugfs.root, gcam,
} }&gb_camera_debugfs_ops);
Reviewed-by: Viresh Kumar viresh.kumar@linaro.org
On Wed, May 30, 2018 at 10:23:42AM +0530, Viresh Kumar wrote:
On 29-05-18, 16:29, Greg Kroah-Hartman wrote:
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Clean up the greybus camera driver by not caring about the value of debugfs calls. This ends up removing a number of lines of code that are not needed.
Cc: Johan Hovold johan@kernel.org Cc: Alex Elder elder@kernel.org Cc: Greg Kroah-Hartman gregkh@linuxfoundation.org Cc: greybus-dev@lists.linaro.org Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
drivers/staging/greybus/camera.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index 07ebfb88db9b..341f729a9779 100644 --- a/drivers/staging/greybus/camera.c +++ b/drivers/staging/greybus/camera.c @@ -1174,11 +1174,6 @@ static int gb_camera_debugfs_init(struct gb_camera *gcam) gcam->bundle->id); gcam->debugfs.root = debugfs_create_dir(dirname, gb_debugfs_get());
- if (IS_ERR(gcam->debugfs.root)) {
gcam_err(gcam, "debugfs root create failed (%ld)\n",
PTR_ERR(gcam->debugfs.root));
return PTR_ERR(gcam->debugfs.root);
- }
gcam->debugfs.buffers = vmalloc(sizeof(*gcam->debugfs.buffers) * GB_CAMERA_DEBUGFS_BUFFER_MAX); @@ -1188,18 +1183,12 @@ static int gb_camera_debugfs_init(struct gb_camera *gcam) for (i = 0; i < ARRAY_SIZE(gb_camera_debugfs_entries); ++i) { const struct gb_camera_debugfs_entry *entry = &gb_camera_debugfs_entries[i];
struct dentry *dentry;
gcam->debugfs.buffers[i].length = 0;
dentry = debugfs_create_file(entry->name, entry->mask,
gcam->debugfs.root, gcam,
&gb_camera_debugfs_ops);
if (IS_ERR(dentry)) {
gcam_err(gcam,
"debugfs operation %s create failed (%ld)\n",
entry->name, PTR_ERR(dentry));
return PTR_ERR(dentry);
debugfs_create_file(entry->name, entry->mask,
gcam->debugfs.root, gcam,
} }&gb_camera_debugfs_ops);
Reviewed-by: Viresh Kumar viresh.kumar@linaro.org
Thanks for the review.
greg k-h
On Tue, May 29, 2018 at 04:29:35PM +0200, Greg Kroah-Hartman wrote:
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Clean up the greybus camera driver by not caring about the value of debugfs calls. This ends up removing a number of lines of code that are not needed.
Cc: Johan Hovold johan@kernel.org Cc: Alex Elder elder@kernel.org Cc: Greg Kroah-Hartman gregkh@linuxfoundation.org Cc: greybus-dev@lists.linaro.org Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
Acked-by: Johan Hovold johan@kernel.org