diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-04-16 10:18:12 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-28 19:10:59 -0300 |
commit | 93e4fe64ece4eccf0ff4ac69bceb389290b8ab7c (patch) | |
tree | 5794c15f0d2c47568e49379b56e9a8d139532050 /drivers/edac/edac_pci.c | |
parent | a895bf8b1e1ea4c032a8fa8a09475a2ce09fe77a (diff) | |
download | blackbird-op-linux-93e4fe64ece4eccf0ff4ac69bceb389290b8ab7c.tar.gz blackbird-op-linux-93e4fe64ece4eccf0ff4ac69bceb389290b8ab7c.zip |
edac: rewrite edac_align_ptr()
The edac_align_ptr() function is used to prepare data for a single
memory allocation kzalloc() call. It counts how many bytes are needed
by some data structure.
Using it as-is is not that trivial, as the quantity of memory elements
reserved is not there, but, instead, it is on a next call.
In order to avoid mistakes when using it, move the number of allocated
elements into it, making easier to use it.
Reviewed-by: Borislav Petkov <bp@amd64.org>
Cc: Aristeu Rozanski <arozansk@redhat.com>
Cc: Doug Thompson <norsk5@yahoo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac/edac_pci.c')
-rw-r--r-- | drivers/edac/edac_pci.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/edac/edac_pci.c b/drivers/edac/edac_pci.c index 63af1c5673d1..f1ac86649886 100644 --- a/drivers/edac/edac_pci.c +++ b/drivers/edac/edac_pci.c @@ -42,13 +42,13 @@ struct edac_pci_ctl_info *edac_pci_alloc_ctl_info(unsigned int sz_pvt, const char *edac_pci_name) { struct edac_pci_ctl_info *pci; - void *pvt; + void *p = NULL, *pvt; unsigned int size; debugf1("%s()\n", __func__); - pci = (struct edac_pci_ctl_info *)0; - pvt = edac_align_ptr(&pci[1], sz_pvt); + pci = edac_align_ptr(&p, sizeof(*pci), 1); + pvt = edac_align_ptr(&p, 1, sz_pvt); size = ((unsigned long)pvt) + sz_pvt; /* Alloc the needed control struct memory */ |