* [PATCH] regmap: Remove useless check
@ 2015-08-07 17:33 Salah Triki
2015-08-07 18:27 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Salah Triki @ 2015-08-07 17:33 UTC (permalink / raw)
To: broonie, gregkh; +Cc: salah.triki, linux-kernel
lzo1x_1_do_compress always returns LZO_E_OK. Thus, the check of the
return value is useless.
Signed-off-by: Salah Triki <salah.triki@acm.org>
---
drivers/base/regmap/regcache-lzo.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c
index 2d53f6f..67245d0 100644
--- a/drivers/base/regmap/regcache-lzo.c
+++ b/drivers/base/regmap/regcache-lzo.c
@@ -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;
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] regmap: Remove useless check
2015-08-07 17:33 [PATCH] regmap: Remove useless check Salah Triki
@ 2015-08-07 18:27 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-08-07 18:27 UTC (permalink / raw)
To: Salah Triki; +Cc: gregkh, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]
On Fri, Aug 07, 2015 at 06:33:36PM +0100, Salah Triki wrote:
> 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.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-07 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-07 17:33 [PATCH] regmap: Remove useless check Salah Triki
2015-08-07 18:27 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®