dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm-pcache: use int type to store negative error codes
@ 2025-08-29 13:37 Qianfeng Rong
  2025-09-01  6:25 ` Dongsheng Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Qianfeng Rong @ 2025-08-29 13:37 UTC (permalink / raw)
  To: Dongsheng Yang, Zheng Gu, dm-devel, linux-kernel; +Cc: Qianfeng Rong

Change the 'ret' variable from u32 to int to store negative error codes or
zero returned by cache_kset_close().

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but it's ugly. 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@vivo.com>
---
 drivers/md/dm-pcache/cache_req.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-pcache/cache_req.c b/drivers/md/dm-pcache/cache_req.c
index bd5cace7de71..27f94c1fa968 100644
--- a/drivers/md/dm-pcache/cache_req.c
+++ b/drivers/md/dm-pcache/cache_req.c
@@ -805,7 +805,8 @@ static int cache_write(struct pcache_cache *cache, struct pcache_request *pcache
 int cache_flush(struct pcache_cache *cache)
 {
 	struct pcache_cache_kset *kset;
-	u32 i, ret;
+	int ret;
+	u32 i;
 
 	for (i = 0; i < cache->n_ksets; i++) {
 		kset = get_kset(cache, i);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dm-pcache: use int type to store negative error codes
  2025-08-29 13:37 [PATCH] dm-pcache: use int type to store negative error codes Qianfeng Rong
@ 2025-09-01  6:25 ` Dongsheng Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Dongsheng Yang @ 2025-09-01  6:25 UTC (permalink / raw)
  To: Qianfeng Rong, Zheng Gu, dm-devel, linux-kernel


在 8/29/2025 9:37 PM, Qianfeng Rong 写道:
> Change the 'ret' variable from u32 to int to store negative error codes or
> zero returned by cache_kset_close().
>
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but it's ugly. 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@vivo.com>


Looks good to me.


Thanx

> ---
>   drivers/md/dm-pcache/cache_req.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm-pcache/cache_req.c b/drivers/md/dm-pcache/cache_req.c
> index bd5cace7de71..27f94c1fa968 100644
> --- a/drivers/md/dm-pcache/cache_req.c
> +++ b/drivers/md/dm-pcache/cache_req.c
> @@ -805,7 +805,8 @@ static int cache_write(struct pcache_cache *cache, struct pcache_request *pcache
>   int cache_flush(struct pcache_cache *cache)
>   {
>   	struct pcache_cache_kset *kset;
> -	u32 i, ret;
> +	int ret;
> +	u32 i;
>   
>   	for (i = 0; i < cache->n_ksets; i++) {
>   		kset = get_kset(cache, i);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-01  6:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 13:37 [PATCH] dm-pcache: use int type to store negative error codes Qianfeng Rong
2025-09-01  6:25 ` Dongsheng Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).