aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-10 12:09:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-10 12:09:47 -0400
commitf741df1f3a2afe988f413ca78d1e866657079beb (patch)
tree385fe773b3549dec86261cf1933beb3f8a7adf61
parentc67723ebbb2d6f672a0e9e5b1a8d1a2442942557 (diff)
parent5950f0803ca9d396ab79b7fe6789351f96e1d8d5 (diff)
Merge tag 'for-linus-20130509' of git://git.infradead.org/~dwmw2/random-2.6
Pull misc fixes from David Woodhouse: "This is some miscellaneous cleanups that don't really belong anywhere else (or were ignored), that have been sitting in linux-next for some time. Two of them are fixes resulting from my audit of krealloc() usage that don't seem to have elicited any response when I posted them, and the other three are patches from Artem removing dead code." * tag 'for-linus-20130509' of git://git.infradead.org/~dwmw2/random-2.6: pcmcia: remove RPX board stuff m68k: remove rpxlite stuff pcmcia: remove Motorola MBX860 support params: Fix potential memory leak in add_sysfs_param() dell-laptop: Fix krealloc() misuse in parse_da_table()
-rw-r--r--arch/m68k/include/asm/commproc.h17
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c140
-rw-r--r--drivers/platform/x86/dell-laptop.c10
-rw-r--r--kernel/params.c5
4 files changed, 10 insertions, 162 deletions
diff --git a/arch/m68k/include/asm/commproc.h b/arch/m68k/include/asm/commproc.h
index a73998528d26..66a36bd51aa1 100644
--- a/arch/m68k/include/asm/commproc.h
+++ b/arch/m68k/include/asm/commproc.h
@@ -480,23 +480,6 @@ typedef struct scc_enet {
480#define SICR_ENET_CLKRT ((uint)0x0000003d) 480#define SICR_ENET_CLKRT ((uint)0x0000003d)
481#endif 481#endif
482 482
483#ifdef CONFIG_RPXLITE
484/* This ENET stuff is for the MPC850 with ethernet on SCC2. Some of
485 * this may be unique to the RPX-Lite configuration.
486 * Note TENA is on Port B.
487 */
488#define PA_ENET_RXD ((ushort)0x0004)
489#define PA_ENET_TXD ((ushort)0x0008)
490#define PA_ENET_TCLK ((ushort)0x0200)
491#define PA_ENET_RCLK ((ushort)0x0800)
492#define PB_ENET_TENA ((uint)0x00002000)
493#define PC_ENET_CLSN ((ushort)0x0040)
494#define PC_ENET_RENA ((ushort)0x0080)
495
496#define SICR_ENET_MASK ((uint)0x0000ff00)
497#define SICR_ENET_CLKRT ((uint)0x00003d00)
498#endif
499
500#ifdef CONFIG_BSEIP 483#ifdef CONFIG_BSEIP
501/* This ENET stuff is for the MPC823 with ethernet on SCC2. 484/* This ENET stuff is for the MPC823 with ethernet on SCC2.
502 * This is unique to the BSE ip-Engine board. 485 * This is unique to the BSE ip-Engine board.
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index a3a851e49321..18c0d8d1ddf7 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -68,12 +68,6 @@ MODULE_LICENSE("Dual MPL/GPL");
68 68
69#if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) 69#if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
70 70
71/* The RPX series use SLOT_B */
72#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE)
73#define CONFIG_PCMCIA_SLOT_B
74#define CONFIG_BD_IS_MHZ
75#endif
76
77/* The ADS board use SLOT_A */ 71/* The ADS board use SLOT_A */
78#ifdef CONFIG_ADS 72#ifdef CONFIG_ADS
79#define CONFIG_PCMCIA_SLOT_A 73#define CONFIG_PCMCIA_SLOT_A
@@ -253,81 +247,6 @@ static irqreturn_t m8xx_interrupt(int irq, void *dev);
253 247
254#define PCMCIA_BMT_LIMIT (15*4) /* Bus Monitor Timeout value */ 248#define PCMCIA_BMT_LIMIT (15*4) /* Bus Monitor Timeout value */
255 249
256/* ------------------------------------------------------------------------- */
257/* board specific stuff: */
258/* voltage_set(), hardware_enable() and hardware_disable() */
259/* ------------------------------------------------------------------------- */
260/* RPX Boards from Embedded Planet */
261
262#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE)
263
264/* The RPX boards seems to have it's bus monitor timeout set to 6*8 clocks.
265 * SYPCR is write once only, therefore must the slowest memory be faster
266 * than the bus monitor or we will get a machine check due to the bus timeout.
267 */
268
269#define PCMCIA_BOARD_MSG "RPX CLASSIC or RPX LITE"
270
271#undef PCMCIA_BMT_LIMIT
272#define PCMCIA_BMT_LIMIT (6*8)
273
274static int voltage_set(int slot, int vcc, int vpp)
275{
276 u32 reg = 0;
277
278 switch (vcc) {
279 case 0:
280 break;
281 case 33:
282 reg |= BCSR1_PCVCTL4;
283 break;
284 case 50:
285 reg |= BCSR1_PCVCTL5;
286 break;
287 default:
288 return 1;
289 }
290
291 switch (vpp) {
292 case 0:
293 break;
294 case 33:
295 case 50:
296 if (vcc == vpp)
297 reg |= BCSR1_PCVCTL6;
298 else
299 return 1;
300 break;
301 case 120:
302 reg |= BCSR1_PCVCTL7;
303 default:
304 return 1;
305 }
306
307 if (!((vcc == 50) || (vcc == 0)))
308 return 1;
309
310 /* first, turn off all power */
311
312 out_be32(((u32 *) RPX_CSR_ADDR),
313 in_be32(((u32 *) RPX_CSR_ADDR)) & ~(BCSR1_PCVCTL4 |
314 BCSR1_PCVCTL5 |
315 BCSR1_PCVCTL6 |
316 BCSR1_PCVCTL7));
317
318 /* enable new powersettings */
319
320 out_be32(((u32 *) RPX_CSR_ADDR), in_be32(((u32 *) RPX_CSR_ADDR)) | reg);
321
322 return 0;
323}
324
325#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
326#define hardware_enable(_slot_) /* No hardware to enable */
327#define hardware_disable(_slot_) /* No hardware to disable */
328
329#endif /* CONFIG_RPXCLASSIC */
330
331/* FADS Boards from Motorola */ 250/* FADS Boards from Motorola */
332 251
333#if defined(CONFIG_FADS) 252#if defined(CONFIG_FADS)
@@ -419,65 +338,6 @@ static inline int voltage_set(int slot, int vcc, int vpp)
419 338
420#endif 339#endif
421 340
422/* ------------------------------------------------------------------------- */
423/* Motorola MBX860 */
424
425#if defined(CONFIG_MBX)
426
427#define PCMCIA_BOARD_MSG "MBX"
428
429static int voltage_set(int slot, int vcc, int vpp)
430{
431 u8 reg = 0;
432
433 switch (vcc) {
434 case 0:
435 break;
436 case 33:
437 reg |= CSR2_VCC_33;
438 break;
439 case 50:
440 reg |= CSR2_VCC_50;
441 break;
442 default:
443 return 1;
444 }
445
446 switch (vpp) {
447 case 0:
448 break;
449 case 33:
450 case 50:
451 if (vcc == vpp)
452 reg |= CSR2_VPP_VCC;
453 else
454 return 1;
455 break;
456 case 120:
457 if ((vcc == 33) || (vcc == 50))
458 reg |= CSR2_VPP_12;
459 else
460 return 1;
461 default:
462 return 1;
463 }
464
465 /* first, turn off all power */
466 out_8((u8 *) MBX_CSR2_ADDR,
467 in_8((u8 *) MBX_CSR2_ADDR) & ~(CSR2_VCC_MASK | CSR2_VPP_MASK));
468
469 /* enable new powersettings */
470 out_8((u8 *) MBX_CSR2_ADDR, in_8((u8 *) MBX_CSR2_ADDR) | reg);
471
472 return 0;
473}
474
475#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
476#define hardware_enable(_slot_) /* No hardware to enable */
477#define hardware_disable(_slot_) /* No hardware to disable */
478
479#endif /* CONFIG_MBX */
480
481#if defined(CONFIG_PRxK) 341#if defined(CONFIG_PRxK)
482#include <asm/cpld.h> 342#include <asm/cpld.h>
483extern volatile fpga_pc_regs *fpga_pc; 343extern volatile fpga_pc_regs *fpga_pc;
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index fa3ee6209572..1134119521ac 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -284,6 +284,7 @@ static void __init parse_da_table(const struct dmi_header *dm)
284{ 284{
285 /* Final token is a terminator, so we don't want to copy it */ 285 /* Final token is a terminator, so we don't want to copy it */
286 int tokens = (dm->length-11)/sizeof(struct calling_interface_token)-1; 286 int tokens = (dm->length-11)/sizeof(struct calling_interface_token)-1;
287 struct calling_interface_token *new_da_tokens;
287 struct calling_interface_structure *table = 288 struct calling_interface_structure *table =
288 container_of(dm, struct calling_interface_structure, header); 289 container_of(dm, struct calling_interface_structure, header);
289 290
@@ -296,12 +297,13 @@ static void __init parse_da_table(const struct dmi_header *dm)
296 da_command_address = table->cmdIOAddress; 297 da_command_address = table->cmdIOAddress;
297 da_command_code = table->cmdIOCode; 298 da_command_code = table->cmdIOCode;
298 299
299 da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) * 300 new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
300 sizeof(struct calling_interface_token), 301 sizeof(struct calling_interface_token),
301 GFP_KERNEL); 302 GFP_KERNEL);
302 303
303 if (!da_tokens) 304 if (!new_da_tokens)
304 return; 305 return;
306 da_tokens = new_da_tokens;
305 307
306 memcpy(da_tokens+da_num_tokens, table->tokens, 308 memcpy(da_tokens+da_num_tokens, table->tokens,
307 sizeof(struct calling_interface_token) * tokens); 309 sizeof(struct calling_interface_token) * tokens);
diff --git a/kernel/params.c b/kernel/params.c
index ed35345be536..53b958fcd639 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -613,10 +613,13 @@ static __modinit int add_sysfs_param(struct module_kobject *mk,
613 sizeof(*mk->mp) + sizeof(mk->mp->attrs[0]) * (num+1), 613 sizeof(*mk->mp) + sizeof(mk->mp->attrs[0]) * (num+1),
614 GFP_KERNEL); 614 GFP_KERNEL);
615 if (!new) { 615 if (!new) {
616 kfree(mk->mp); 616 kfree(attrs);
617 err = -ENOMEM; 617 err = -ENOMEM;
618 goto fail; 618 goto fail;
619 } 619 }
620 /* Despite looking like the typical realloc() bug, this is safe.
621 * We *want* the old 'attrs' to be freed either way, and we'll store
622 * the new one in the success case. */
620 attrs = krealloc(attrs, sizeof(new->grp.attrs[0])*(num+2), GFP_KERNEL); 623 attrs = krealloc(attrs, sizeof(new->grp.attrs[0])*(num+2), GFP_KERNEL);
621 if (!attrs) { 624 if (!attrs) {
622 err = -ENOMEM; 625 err = -ENOMEM;