2005-11-16 03:22:54

by Adam Belay

[permalink] [raw]
Subject: [RFC][PATCH 5/6] PCI PM: kzalloc() cleanup

Use kzalloc() instead of kmalloc() and memset().


--- a/drivers/pci/pm.c 2005-11-08 17:10:37.000000000 -0500
+++ b/drivers/pci/pm.c 2005-11-08 17:11:33.000000000 -0500
@@ -300,12 +300,10 @@
return -EIO;
}

- dev->pm = pm_data = kmalloc(sizeof(struct pci_dev_pm), GFP_KERNEL);
+ dev->pm = pm_data = kzalloc(sizeof(struct pci_dev_pm), GFP_KERNEL);
if (!pm_data)
return -ENOMEM;

- memset(pm_data, 0, sizeof(struct pci_dev_pm));
-
pm_data->pm_offset = pm;

/* determine supported device states */



2005-11-16 06:46:52

by Greg KH

[permalink] [raw]
Subject: Re: [RFC][PATCH 5/6] PCI PM: kzalloc() cleanup

On Tue, Nov 15, 2005 at 10:31:31PM -0500, Adam Belay wrote:
> Use kzalloc() instead of kmalloc() and memset().
>
>
> --- a/drivers/pci/pm.c 2005-11-08 17:10:37.000000000 -0500
> +++ b/drivers/pci/pm.c 2005-11-08 17:11:33.000000000 -0500
> @@ -300,12 +300,10 @@
> return -EIO;
> }
>
> - dev->pm = pm_data = kmalloc(sizeof(struct pci_dev_pm), GFP_KERNEL);
> + dev->pm = pm_data = kzalloc(sizeof(struct pci_dev_pm), GFP_KERNEL);
> if (!pm_data)
> return -ENOMEM;
>
> - memset(pm_data, 0, sizeof(struct pci_dev_pm));
> -

You can merge this back with your other patch :)

thanks,

greg k-h

2005-11-16 07:12:46

by Adam Belay

[permalink] [raw]
Subject: Re: [RFC][PATCH 5/6] PCI PM: kzalloc() cleanup

On Tue, 2005-11-15 at 22:22 -0800, Greg KH wrote:
> On Tue, Nov 15, 2005 at 10:31:31PM -0500, Adam Belay wrote:
> > Use kzalloc() instead of kmalloc() and memset().
> >
> >
> > --- a/drivers/pci/pm.c 2005-11-08 17:10:37.000000000 -0500
> > +++ b/drivers/pci/pm.c 2005-11-08 17:11:33.000000000 -0500
> > @@ -300,12 +300,10 @@
> > return -EIO;
> > }
> >
> > - dev->pm = pm_data = kmalloc(sizeof(struct pci_dev_pm), GFP_KERNEL);
> > + dev->pm = pm_data = kzalloc(sizeof(struct pci_dev_pm), GFP_KERNEL);
> > if (!pm_data)
> > return -ENOMEM;
> >
> > - memset(pm_data, 0, sizeof(struct pci_dev_pm));
> > -
>
> You can merge this back with your other patch :)
>
> thanks,
>
> greg k-h

Will do.

Thanks,
Adam