of.c (0cce284537fb42d9c28b9b31038ffc9b464555f5) of.c (6396bb221514d2876fd6dc0aa2a1f240d99b37bb)
1/*
2 * Copyright 2015 IBM Corp.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */

--- 288 unchanged lines hidden (view full) ---

297 /*
298 * encoded array of two cells per entry, each cell encoded as
299 * with encode-int
300 */
301 nranges = len / (2 * sizeof(int));
302 if (nranges == 0 || (nranges * 2 * sizeof(int)) != len)
303 return -EINVAL;
304
1/*
2 * Copyright 2015 IBM Corp.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */

--- 288 unchanged lines hidden (view full) ---

297 /*
298 * encoded array of two cells per entry, each cell encoded as
299 * with encode-int
300 */
301 nranges = len / (2 * sizeof(int));
302 if (nranges == 0 || (nranges * 2 * sizeof(int)) != len)
303 return -EINVAL;
304
305 adapter->guest->irq_avail = kzalloc(nranges * sizeof(struct irq_avail),
305 adapter->guest->irq_avail = kcalloc(nranges, sizeof(struct irq_avail),
306 GFP_KERNEL);
307 if (adapter->guest->irq_avail == NULL)
308 return -ENOMEM;
309
310 adapter->guest->irq_base_offset = be32_to_cpu(ranges[0]);
311 for (i = 0; i < nranges; i++) {
312 cur = &adapter->guest->irq_avail[i];
313 cur->offset = be32_to_cpu(ranges[i * 2]);

--- 198 unchanged lines hidden ---
306 GFP_KERNEL);
307 if (adapter->guest->irq_avail == NULL)
308 return -ENOMEM;
309
310 adapter->guest->irq_base_offset = be32_to_cpu(ranges[0]);
311 for (i = 0; i < nranges; i++) {
312 cur = &adapter->guest->irq_avail[i];
313 cur->offset = be32_to_cpu(ranges[i * 2]);

--- 198 unchanged lines hidden ---