Message ID | 1405564839-28702-2-git-send-email-guihc.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Hi Gui, (2014/07/17 11:40), Gui Hecheng wrote: > The scrub_read_file function is always on a branch, > which has (fd >= 0), so there is not need to judgment > the pasted in arg. > > Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> > --- > cmds-scrub.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/cmds-scrub.c b/cmds-scrub.c > index f9e2b40..a604b25 100644 > --- a/cmds-scrub.c > +++ b/cmds-scrub.c > @@ -474,9 +474,6 @@ static struct scrub_file_record **scrub_read_file(int fd, int report_errors) > char empty_uuid[BTRFS_FSID_SIZE] = {0}; > struct scrub_file_record **p = NULL; > > - if (fd < 0) > - return ERR_PTR(-EINVAL); > - It's correct. In addition, adding "'fd' should point to a opened file" like comment is better for potential users of this function. Thanks, Satoru > again: > old_avail = avail - i; > BUG_ON(old_avail < 0); > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/cmds-scrub.c b/cmds-scrub.c index f9e2b40..a604b25 100644 --- a/cmds-scrub.c +++ b/cmds-scrub.c @@ -474,9 +474,6 @@ static struct scrub_file_record **scrub_read_file(int fd, int report_errors) char empty_uuid[BTRFS_FSID_SIZE] = {0}; struct scrub_file_record **p = NULL; - if (fd < 0) - return ERR_PTR(-EINVAL); - again: old_avail = avail - i; BUG_ON(old_avail < 0);
The scrub_read_file function is always on a branch, which has (fd >= 0), so there is not need to judgment the pasted in arg. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> --- cmds-scrub.c | 3 --- 1 file changed, 3 deletions(-)