Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1334842
| From | Paul Bolle <pebolle@tiscali.nl> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] ser_gigaset: bail out if gigaset_initcs() fails |
| Date | 2016-02-15 22:40 +0100 |
| Message-ID | <r2z29-6Jk-3@gated-at.bofh.it> (permalink) |
| References | <r2z29-6Jk-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The first substantial thing that ser_gigaset's open() operation does, is
calling gigaset_initcs(). That function is well behaved: if it fails it
cleans up after itself and returns NULL. So if we receive a NULL here we
might as well bail out directly. (Note that both the bas_gigaset driver
and the usb_gigaset driver already do that.)
Besides, in the error path tty->disc_data will be set to NULL. But
tty->disc_data hasn't been touched yet, so there's no reason to set it
to NULL.
Not-yet-signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
drivers/isdn/gigaset/ser-gigaset.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index 2a506fe0c8a4..ae69ab89c5c0 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -514,10 +514,8 @@ gigaset_tty_open(struct tty_struct *tty)
/* allocate memory for our device state and initialize it */
cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME);
- if (!cs) {
- rc = -ENODEV;
- goto error;
- }
+ if (!cs)
+ return -ENODEV;
cs->dev = &cs->hw.ser->dev.dev;
cs->hw.ser->tty = tty;
--
2.4.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
ser_gigaset: fix memory leak Paul Bolle <pebolle@tiscali.nl> - 2016-02-15 22:40 +0100 [PATCH 1/2] ser_gigaset: bail out if gigaset_initcs() fails Paul Bolle <pebolle@tiscali.nl> - 2016-02-15 22:40 +0100 [PATCH 2/2] ser_gigaset: use container_of() instead of detour Paul Bolle <pebolle@tiscali.nl> - 2016-02-15 22:40 +0100 Re: ser_gigaset: fix memory leak Dmitry Vyukov <dvyukov@google.com> - 2016-02-16 10:40 +0100
csiph-web