Skip to content

Commit c788dd2

Browse files
keesdavem330
authored andcommitted
isdn/gigaset: Use kzalloc instead of open-coded field zeroing
This replaces a kmalloc followed by a bunch of per-field zeroing with a single kzalloc call, reducing the lines of code. Cc: Paul Bolle <pebolle@tiscali.nl> Cc: Karsten Keil <isdn@linux-pingi.de> Cc: "David S. Miller" <davem@davemloft.net> Cc: Johan Hovold <johan@kernel.org> Cc: gigaset307x-common@lists.sourceforge.net Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e313ac1 commit c788dd2

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

drivers/isdn/gigaset/bas-gigaset.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,7 +2200,7 @@ static int gigaset_initcshw(struct cardstate *cs)
22002200
{
22012201
struct bas_cardstate *ucs;
22022202

2203-
cs->hw.bas = ucs = kmalloc(sizeof *ucs, GFP_KERNEL);
2203+
cs->hw.bas = ucs = kzalloc(sizeof(*ucs), GFP_KERNEL);
22042204
if (!ucs) {
22052205
pr_err("out of memory\n");
22062206
return -ENOMEM;
@@ -2212,15 +2212,7 @@ static int gigaset_initcshw(struct cardstate *cs)
22122212
return -ENOMEM;
22132213
}
22142214

2215-
ucs->urb_cmd_in = NULL;
2216-
ucs->urb_cmd_out = NULL;
2217-
ucs->rcvbuf = NULL;
2218-
ucs->rcvbuf_size = 0;
2219-
22202215
spin_lock_init(&ucs->lock);
2221-
ucs->pending = 0;
2222-
2223-
ucs->basstate = 0;
22242216
setup_timer(&ucs->timer_ctrl, req_timeout, (unsigned long) cs);
22252217
setup_timer(&ucs->timer_atrdy, atrdy_timeout, (unsigned long) cs);
22262218
setup_timer(&ucs->timer_cmd_in, cmd_in_timeout, (unsigned long) cs);

0 commit comments

Comments
 (0)