lkml.org 
[lkml]   [2017]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/6] [media] cx24116: Return directly after a failed kmalloc() in cx24116_writeregN()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 30 Aug 2017 07:55:49 +0200

* Return directly after a call of the function "kmalloc" failed
at the beginning.

* Delete the jump target "error" which became unnecessary
with this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/dvb-frontends/cx24116.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/media/dvb-frontends/cx24116.c b/drivers/media/dvb-frontends/cx24116.c
index 96af4ffba0f9..69c156443b50 100644
--- a/drivers/media/dvb-frontends/cx24116.c
+++ b/drivers/media/dvb-frontends/cx24116.c
@@ -226,10 +226,8 @@ static int cx24116_writeregN(struct cx24116_state *state, int reg,
u8 *buf;

buf = kmalloc(len + 1, GFP_KERNEL);
- if (buf == NULL) {
- ret = -ENOMEM;
- goto error;
- }
+ if (!buf)
+ return -ENOMEM;

*(buf) = reg;
memcpy(buf + 1, data, len);
@@ -250,7 +248,6 @@ static int cx24116_writeregN(struct cx24116_state *state, int reg,
ret = -EREMOTEIO;
}

-error:
kfree(buf);

return ret;
--
2.14.1
\
 
 \ /
  Last update: 2017-08-30 09:21    [W:0.047 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site