Re: [PATCH] [I2C] kmalloc + memset -> kzalloc conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/1/05, Deepak Saxena <[email protected]> wrote:
>
> Signed-off-by: Deepak Saxena <[email protected]>
>
[snip]
> --- a/drivers/i2c/busses/i2c-keywest.c
> +++ b/drivers/i2c/busses/i2c-keywest.c
> @@ -535,13 +535,12 @@ create_iface(struct device_node *np, str
>
>         tsize = sizeof(struct keywest_iface) +
>                 (sizeof(struct keywest_chan) + 4) * nchan;
> -       iface = (struct keywest_iface *) kmalloc(tsize, GFP_KERNEL);
> +       iface = (struct keywest_iface *) kzalloc(tsize, GFP_KERNEL);
cast isn't needed
>         if (iface == NULL) {
>                 printk(KERN_ERR "i2c-keywest: can't allocate inteface !\n");
>                 pmac_low_i2c_unlock(np);
>                 return -ENOMEM;
>         }
> -       memset(iface, 0, tsize);
>         spin_lock_init(&iface->lock);
>         init_completion(&iface->complete);
>         iface->node = of_node_get(np);
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -296,10 +296,9 @@ static int fsl_i2c_probe(struct device *
>
>         pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data;
>
> -       if (!(i2c = kmalloc(sizeof(*i2c), GFP_KERNEL))) {
> +       if (!(i2c = kzalloc(sizeof(*i2c), GFP_KERNEL))) {
>                 return -ENOMEM;
>         }
> -       memset(i2c, 0, sizeof(*i2c));
>
>         i2c->irq = platform_get_irq(pdev, 0);
>         i2c->flags = pdata->device_flags;
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -500,13 +500,11 @@ mv64xxx_i2c_probe(struct device *dev)
>         if ((pd->id != 0) || !pdata)
>                 return -ENODEV;
>
> -       drv_data = kmalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL);
> +       drv_data = kzalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL);
>
>         if (!drv_data)
>                 return -ENOMEM;
>
> -       memset(drv_data, 0, sizeof(struct mv64xxx_i2c_data));
> -
>         if (mv64xxx_i2c_map_regs(pd, drv_data)) {
>                 rc = -ENODEV;
>                 goto exit_kfree;
> diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
> --- a/drivers/i2c/busses/i2c-nforce2.c
> +++ b/drivers/i2c/busses/i2c-nforce2.c
> @@ -313,10 +313,9 @@ static int __devinit nforce2_probe(struc
>         int res1, res2;
>
>         /* we support 2 SMBus adapters */
> -       if (!(smbuses = (void *)kmalloc(2*sizeof(struct nforce2_smbus),
> +       if (!(smbuses = (void *)kzalloc(2*sizeof(struct nforce2_smbus),
>                                         GFP_KERNEL)))
cast from (void*) to (void*)? No...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux