[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <wzcnnfwnjkrkbg7gj64cnddwxwcc5gw3jkv6356qmedjccitt4@3gsixqytzn2i>
Date: Mon, 1 Sep 2025 18:38:21 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Qianfeng Rong <rongqianfeng@...o.com>
Cc: linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bcachefs: Use int type to store negative error codes
On Sat, Aug 30, 2025 at 09:58:33PM +0800, Qianfeng Rong wrote:
> Change the 'ret' variable in __bch2_dev_attach_bdev() from unsigned to
> int, as it needs to store either negative error codes or zero.
>
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but can be confusing. Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
>
> No effect on runtime.
>
> Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
Thanks, applied
> ---
> fs/bcachefs/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
> index 793c16fa8b09..ec20ab0ad84e 100644
> --- a/fs/bcachefs/super.c
> +++ b/fs/bcachefs/super.c
> @@ -1769,7 +1769,7 @@ static int bch2_dev_alloc(struct bch_fs *c, unsigned dev_idx)
> static int __bch2_dev_attach_bdev(struct bch_dev *ca, struct bch_sb_handle *sb,
> struct printbuf *err)
> {
> - unsigned ret;
> + int ret;
>
> if (bch2_dev_is_online(ca)) {
> prt_printf(err, "already have device online in slot %u\n",
> --
> 2.34.1
>
Powered by blists - more mailing lists