Skip to contentSkip to conversation

zram: Remove useless check

PATCH In review Salah Triki 2 participants 3 messages Aug 7, 2015 – Aug 10, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover zram: Remove useless check

The previous versions of this patch contain spelling errors and cryptic messages, please ignore them. The patch removes the check of the return value of lzo1x_1_compress, since it returns always LZO_E_OK.

Salah Triki (1):
zram: Remove useless check

 drivers/block/zram/zcomp_lzo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/1 zram: Remove useless check

lzo1x_1_compress always returns LZO_E_OK that is equal to 0. Thus, the check of the return value is useless.

---
 drivers/block/zram/zcomp_lzo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/block/zram/zcomp_lzo.c +1 -2
index da1bc47..3cf30c9 100644
@@ -26,8 +26,7 @@ static void lzo_destroy(void *private)
 static int lzo_compress(const unsigned char *src, unsigned char *dst,
 		size_t *dst_len, void *private)
 {
-	int ret = lzo1x_1_compress(src, PAGE_SIZE, dst, dst_len, private);
-	return ret == LZO_E_OK ? 0 : ret;
+	return lzo1x_1_compress(src, PAGE_SIZE, dst, dst_len, private);
 }
 
 static int lzo_decompress(const unsigned char *src, size_t src_len,
Signature · 1 line
1.9.1
#2 lore raw
Quoted 20 lines · Salah Triki

Date: Fri, 7 Aug 2015 19:06:42 +0100
From: Salah Triki <[email protected]>
To: [email protected], [email protected], [email protected]
Cc: [email protected], [email protected]
Subject: [PATCH V3 1/1] zram: Remove useless check
X-Mailer: git-send-email 1.9.1

lzo1x_1_compress always returns LZO_E_OK that is equal to 0. Thus, the check of the return value is useless.

---
 drivers/block/zram/zcomp_lzo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/block/zram/zcomp_lzo.c +0 -0
index da1bc47..3cf30c9 100644

drivers/block/zram/zcomp_lzo.c static void lzo_destroy(void *private) · line 30

Quoted 7 lines
drivers/block/zram/zcomp_lzo.c +1 -2
@@ -26,8 +26,7 @@ static void lzo_destroy(void *private)
 static int lzo_compress(const unsigned char *src, unsigned char *dst,
 		size_t *dst_len, void *private)
 {
-	int ret = lzo1x_1_compress(src, PAGE_SIZE, dst, dst_len, private);
-	return ret == LZO_E_OK ? 0 : ret;
+	return lzo1x_1_compress(src, PAGE_SIZE, dst, dst_len, private);
 }

NACK. it may change someday, we don't control it.
the check must stay.

	-ss