staging: cxt1e1: remove redundant memset() call
authorDaeseok Youn <daeseok.youn@gmail.com>
Fri, 14 Mar 2014 09:08:43 +0000 (18:08 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Mar 2014 21:22:47 +0000 (14:22 -0700)
The banner array doens't need to set to 0.
sprintf() adds a terminating '\0'.

And the sn array can be declared and initialized to zero.
So remove redundant memset() with zero.

Remove unnecessary cast for memcpy().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/cxt1e1/hwprobe.c

index d87a011360bddc3faed1c50fd160a910e55ba628..d41fb79e33048e1e405485a5e8fce19821089ac9 100644 (file)
@@ -51,22 +51,16 @@ show_two(hdw_info_t *hi, int brdno)
        struct pci_dev *pdev;
        char       *bid;
        char       banner[80];
-       char    sn[6];
-
-       /* clear print buffer */
-       memset(banner, 0, 80);
+       char    sn[6] = {0,};
 
        ci = (ci_t *)(netdev_priv(hi->ndev));
        bid = sbeid_get_bdname(ci);
        switch (hi->promfmt) {
        case PROM_FORMAT_TYPE1:
-               memcpy(sn, (FLD_TYPE1 *)(hi->mfg_info.pft1.Serial), 6);
+               memcpy(sn, hi->mfg_info.pft1.Serial, 6);
                break;
        case PROM_FORMAT_TYPE2:
-               memcpy(sn, (FLD_TYPE2 *)(hi->mfg_info.pft2.Serial), 6);
-               break;
-       default:
-               memset(sn, 0, 6);
+               memcpy(sn, hi->mfg_info.pft2.Serial, 6);
                break;
        }