Skip to contentSkip to conversation

regmap: Remove useless check

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

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

PATCH 1/1 regmap: Remove useless check

lzo1x_1_do_compress always returns LZO_E_OK. Thus, the check of the return value is useless.

---
 drivers/base/regmap/regcache-lzo.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/base/regmap/regcache-lzo.c +2 -3
index 2d53f6f..67245d0 100644
@@ -46,11 +46,10 @@ static int regcache_lzo_prepare(struct regcache_lzo_ctx *lzo_ctx)
 static int regcache_lzo_compress(struct regcache_lzo_ctx *lzo_ctx)
 {
 	size_t compress_size;
-	int ret;
 
-	ret = lzo1x_1_compress(lzo_ctx->src, lzo_ctx->src_len,
+	lzo1x_1_compress(lzo_ctx->src, lzo_ctx->src_len,
 			       lzo_ctx->dst, &compress_size, lzo_ctx->wmem);
-	if (ret != LZO_E_OK || compress_size > lzo_ctx->dst_len)
+	if (compress_size > lzo_ctx->dst_len)
 		return -EINVAL;
 	lzo_ctx->dst_len = compress_size;
 	return 0;
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 2 lines · Salah Triki

lzo1x_1_do_compress always returns LZO_E_OK. Thus, the check of the return value is useless.

No, if you want to do this then you should be fixing the LZO API to remove the returned value - if a value is being returned it's always good practice to pay attention to that, not doing that because the current implementation happens to have some behaviour just makes the code more fragile if someone comes along and changes the implementation.