isdn/gigaset: Use kzalloc instead of open-coded field zeroing
authorKees Cook <keescook@chromium.org>
Tue, 17 Oct 2017 00:29:15 +0000 (17:29 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Oct 2017 11:39:39 +0000 (12:39 +0100)
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>
drivers/isdn/gigaset/bas-gigaset.c

index 2da3ff6..33151f0 100644 (file)
@@ -2200,7 +2200,7 @@ static int gigaset_initcshw(struct cardstate *cs)
 {
        struct bas_cardstate *ucs;
 
-       cs->hw.bas = ucs = kmalloc(sizeof *ucs, GFP_KERNEL);
+       cs->hw.bas = ucs = kzalloc(sizeof(*ucs), GFP_KERNEL);
        if (!ucs) {
                pr_err("out of memory\n");
                return -ENOMEM;
@@ -2212,15 +2212,7 @@ static int gigaset_initcshw(struct cardstate *cs)
                return -ENOMEM;
        }
 
-       ucs->urb_cmd_in = NULL;
-       ucs->urb_cmd_out = NULL;
-       ucs->rcvbuf = NULL;
-       ucs->rcvbuf_size = 0;
-
        spin_lock_init(&ucs->lock);
-       ucs->pending = 0;
-
-       ucs->basstate = 0;
        setup_timer(&ucs->timer_ctrl, req_timeout, (unsigned long) cs);
        setup_timer(&ucs->timer_atrdy, atrdy_timeout, (unsigned long) cs);
        setup_timer(&ucs->timer_cmd_in, cmd_in_timeout, (unsigned long) cs);