diff mbox series

[1/2] xfs: fix uninitialized error variables

Message ID 155111649548.15126.8995811550165658297.stgit@magnolia (mailing list archive)
State Accepted, archived
Headers show
Series [1/2] xfs: fix uninitialized error variables | expand

Commit Message

Darrick J. Wong Feb. 25, 2019, 5:41 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

smatch complained about some uninitialized error returns, so fix those.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/libxfs/xfs_sb.c |    2 +-
 fs/xfs/xfs_reflink.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Allison Henderson Feb. 25, 2019, 5:53 p.m. UTC | #1
On 2/25/19 10:41 AM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> smatch complained about some uninitialized error returns, so fix those.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>   fs/xfs/libxfs/xfs_sb.c |    2 +-
>   fs/xfs/xfs_reflink.c   |    2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> index 4e5029c37966..77a3a4085de3 100644
> --- a/fs/xfs/libxfs/xfs_sb.c
> +++ b/fs/xfs/libxfs/xfs_sb.c
> @@ -877,7 +877,7 @@ xfs_initialize_perag_data(
>   	uint64_t	bfreelst = 0;
>   	uint64_t	btree = 0;
>   	uint64_t	fdblocks;
> -	int		error;
> +	int		error = 0;
>   
>   	for (index = 0; index < agcount; index++) {
>   		/*
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index d42e3ef9050e..680ae7662a78 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -261,7 +261,7 @@ xfs_reflink_convert_cow_locked(
>   	struct xfs_bmbt_irec	got;
>   	struct xfs_btree_cur	*dummy_cur = NULL;
>   	int			dummy_logflags;
> -	int			error;
> +	int			error = 0;
>   
>   	if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got))
>   		return 0;
> 

Looks fine to me. Thank you!!

Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index 4e5029c37966..77a3a4085de3 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -877,7 +877,7 @@  xfs_initialize_perag_data(
 	uint64_t	bfreelst = 0;
 	uint64_t	btree = 0;
 	uint64_t	fdblocks;
-	int		error;
+	int		error = 0;
 
 	for (index = 0; index < agcount; index++) {
 		/*
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index d42e3ef9050e..680ae7662a78 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -261,7 +261,7 @@  xfs_reflink_convert_cow_locked(
 	struct xfs_bmbt_irec	got;
 	struct xfs_btree_cur	*dummy_cur = NULL;
 	int			dummy_logflags;
-	int			error;
+	int			error = 0;
 
 	if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got))
 		return 0;