diff options
| author | Ralf Baechle <ralf@linux-mips.org> | 2014-08-01 18:07:03 -0400 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2014-08-01 18:07:03 -0400 |
| commit | 475d5928b79bb78326a645863d46ff95c5e25e5a (patch) | |
| tree | a260aed0d94bda824d7f2c5d74b2b1f8002634aa | |
| parent | c6b7b9f290c0987194b966d5ea1383e10e1a01b1 (diff) | |
| parent | 1062080a7d8dbe08cefce728341285e77930ef49 (diff) | |
Merge branch '3.16-fixes' into mips-for-linux-next
| -rw-r--r-- | arch/mips/jz4740/platform.c | 2 | ||||
| -rw-r--r-- | arch/mips/kernel/ftrace.c | 56 | ||||
| -rw-r--r-- | arch/mips/kernel/mcount.S | 13 | ||||
| -rw-r--r-- | arch/mips/kernel/ptrace.c | 3 | ||||
| -rw-r--r-- | arch/mips/kernel/rtlx-cmp.c | 3 | ||||
| -rw-r--r-- | arch/mips/kernel/rtlx-mt.c | 3 | ||||
| -rw-r--r-- | arch/mips/kernel/scall64-n32.S | 2 | ||||
| -rw-r--r-- | arch/mips/kernel/smp-mt.c | 2 | ||||
| -rw-r--r-- | arch/mips/kernel/unaligned.c | 1 | ||||
| -rw-r--r-- | arch/mips/math-emu/cp1emu.c | 2 | ||||
| -rw-r--r-- | arch/mips/mm/tlbex.c | 3 | ||||
| -rw-r--r-- | arch/mips/rb532/devices.c | 1 | ||||
| -rw-r--r-- | arch/mips/sgi-ip22/ip22-gio.c | 10 | ||||
| -rw-r--r-- | arch/mips/txx9/generic/7segled.c | 14 | ||||
| -rw-r--r-- | arch/mips/txx9/generic/setup.c | 29 |
15 files changed, 116 insertions, 28 deletions
diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c index a447101cf9f1..0b12f273cb2e 100644 --- a/arch/mips/jz4740/platform.c +++ b/arch/mips/jz4740/platform.c | |||
| @@ -59,7 +59,7 @@ struct platform_device jz4740_usb_ohci_device = { | |||
| 59 | 59 | ||
| 60 | /* USB Device Controller */ | 60 | /* USB Device Controller */ |
| 61 | struct platform_device jz4740_udc_xceiv_device = { | 61 | struct platform_device jz4740_udc_xceiv_device = { |
| 62 | .name = "usb_phy_gen_xceiv", | 62 | .name = "usb_phy_generic", |
| 63 | .id = 0, | 63 | .id = 0, |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c index 60e7e5e45af1..2a72208e319c 100644 --- a/arch/mips/kernel/ftrace.c +++ b/arch/mips/kernel/ftrace.c | |||
| @@ -63,7 +63,7 @@ static inline int in_kernel_space(unsigned long ip) | |||
| 63 | ((unsigned int)(JAL | (((addr) >> 2) & ADDR_MASK))) | 63 | ((unsigned int)(JAL | (((addr) >> 2) & ADDR_MASK))) |
| 64 | 64 | ||
| 65 | static unsigned int insn_jal_ftrace_caller __read_mostly; | 65 | static unsigned int insn_jal_ftrace_caller __read_mostly; |
| 66 | static unsigned int insn_lui_v1_hi16_mcount __read_mostly; | 66 | static unsigned int insn_la_mcount[2] __read_mostly; |
| 67 | static unsigned int insn_j_ftrace_graph_caller __maybe_unused __read_mostly; | 67 | static unsigned int insn_j_ftrace_graph_caller __maybe_unused __read_mostly; |
| 68 | 68 | ||
| 69 | static inline void ftrace_dyn_arch_init_insns(void) | 69 | static inline void ftrace_dyn_arch_init_insns(void) |
| @@ -71,10 +71,10 @@ static inline void ftrace_dyn_arch_init_insns(void) | |||
| 71 | u32 *buf; | 71 | u32 *buf; |
| 72 | unsigned int v1; | 72 | unsigned int v1; |
| 73 | 73 | ||
| 74 | /* lui v1, hi16_mcount */ | 74 | /* la v1, _mcount */ |
| 75 | v1 = 3; | 75 | v1 = 3; |
| 76 | buf = (u32 *)&insn_lui_v1_hi16_mcount; | 76 | buf = (u32 *)&insn_la_mcount[0]; |
| 77 | UASM_i_LA_mostly(&buf, v1, MCOUNT_ADDR); | 77 | UASM_i_LA(&buf, v1, MCOUNT_ADDR); |
| 78 | 78 | ||
| 79 | /* jal (ftrace_caller + 8), jump over the first two instruction */ | 79 | /* jal (ftrace_caller + 8), jump over the first two instruction */ |
| 80 | buf = (u32 *)&insn_jal_ftrace_caller; | 80 | buf = (u32 *)&insn_jal_ftrace_caller; |
| @@ -111,14 +111,47 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1, | |||
| 111 | unsigned int new_code2) | 111 | unsigned int new_code2) |
| 112 | { | 112 | { |
| 113 | int faulted; | 113 | int faulted; |
| 114 | mm_segment_t old_fs; | ||
| 114 | 115 | ||
| 115 | safe_store_code(new_code1, ip, faulted); | 116 | safe_store_code(new_code1, ip, faulted); |
| 116 | if (unlikely(faulted)) | 117 | if (unlikely(faulted)) |
| 117 | return -EFAULT; | 118 | return -EFAULT; |
| 118 | safe_store_code(new_code2, ip + 4, faulted); | 119 | |
| 120 | ip += 4; | ||
| 121 | safe_store_code(new_code2, ip, faulted); | ||
| 119 | if (unlikely(faulted)) | 122 | if (unlikely(faulted)) |
| 120 | return -EFAULT; | 123 | return -EFAULT; |
| 124 | |||
| 125 | ip -= 4; | ||
| 126 | old_fs = get_fs(); | ||
| 127 | set_fs(get_ds()); | ||
| 121 | flush_icache_range(ip, ip + 8); | 128 | flush_icache_range(ip, ip + 8); |
| 129 | set_fs(old_fs); | ||
| 130 | |||
| 131 | return 0; | ||
| 132 | } | ||
| 133 | |||
| 134 | static int ftrace_modify_code_2r(unsigned long ip, unsigned int new_code1, | ||
| 135 | unsigned int new_code2) | ||
| 136 | { | ||
| 137 | int faulted; | ||
| 138 | mm_segment_t old_fs; | ||
| 139 | |||
| 140 | ip += 4; | ||
| 141 | safe_store_code(new_code2, ip, faulted); | ||
| 142 | if (unlikely(faulted)) | ||
| 143 | return -EFAULT; | ||
| 144 | |||
| 145 | ip -= 4; | ||
| 146 | safe_store_code(new_code1, ip, faulted); | ||
| 147 | if (unlikely(faulted)) | ||
| 148 | return -EFAULT; | ||
| 149 | |||
| 150 | old_fs = get_fs(); | ||
| 151 | set_fs(get_ds()); | ||
| 152 | flush_icache_range(ip, ip + 8); | ||
| 153 | set_fs(old_fs); | ||
| 154 | |||
| 122 | return 0; | 155 | return 0; |
| 123 | } | 156 | } |
| 124 | #endif | 157 | #endif |
| @@ -130,13 +163,14 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1, | |||
| 130 | * | 163 | * |
| 131 | * move at, ra | 164 | * move at, ra |
| 132 | * jal _mcount --> nop | 165 | * jal _mcount --> nop |
| 166 | * sub sp, sp, 8 --> nop (CONFIG_32BIT) | ||
| 133 | * | 167 | * |
| 134 | * 2. For modules: | 168 | * 2. For modules: |
| 135 | * | 169 | * |
| 136 | * 2.1 For KBUILD_MCOUNT_RA_ADDRESS and CONFIG_32BIT | 170 | * 2.1 For KBUILD_MCOUNT_RA_ADDRESS and CONFIG_32BIT |
| 137 | * | 171 | * |
| 138 | * lui v1, hi_16bit_of_mcount --> b 1f (0x10000005) | 172 | * lui v1, hi_16bit_of_mcount --> b 1f (0x10000005) |
| 139 | * addiu v1, v1, low_16bit_of_mcount | 173 | * addiu v1, v1, low_16bit_of_mcount --> nop (CONFIG_32BIT) |
| 140 | * move at, ra | 174 | * move at, ra |
| 141 | * move $12, ra_address | 175 | * move $12, ra_address |
| 142 | * jalr v1 | 176 | * jalr v1 |
| @@ -145,7 +179,7 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1, | |||
| 145 | * 2.2 For the Other situations | 179 | * 2.2 For the Other situations |
| 146 | * | 180 | * |
| 147 | * lui v1, hi_16bit_of_mcount --> b 1f (0x10000004) | 181 | * lui v1, hi_16bit_of_mcount --> b 1f (0x10000004) |
| 148 | * addiu v1, v1, low_16bit_of_mcount | 182 | * addiu v1, v1, low_16bit_of_mcount --> nop (CONFIG_32BIT) |
| 149 | * move at, ra | 183 | * move at, ra |
| 150 | * jalr v1 | 184 | * jalr v1 |
| 151 | * nop | move $12, ra_address | sub sp, sp, 8 | 185 | * nop | move $12, ra_address | sub sp, sp, 8 |
| @@ -184,10 +218,14 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
| 184 | unsigned int new; | 218 | unsigned int new; |
| 185 | unsigned long ip = rec->ip; | 219 | unsigned long ip = rec->ip; |
| 186 | 220 | ||
| 187 | new = in_kernel_space(ip) ? insn_jal_ftrace_caller : | 221 | new = in_kernel_space(ip) ? insn_jal_ftrace_caller : insn_la_mcount[0]; |
| 188 | insn_lui_v1_hi16_mcount; | ||
| 189 | 222 | ||
| 223 | #ifdef CONFIG_64BIT | ||
| 190 | return ftrace_modify_code(ip, new); | 224 | return ftrace_modify_code(ip, new); |
| 225 | #else | ||
| 226 | return ftrace_modify_code_2r(ip, new, in_kernel_space(ip) ? | ||
| 227 | INSN_NOP : insn_la_mcount[1]); | ||
| 228 | #endif | ||
| 191 | } | 229 | } |
| 192 | 230 | ||
| 193 | #define FTRACE_CALL_IP ((unsigned long)(&ftrace_call)) | 231 | #define FTRACE_CALL_IP ((unsigned long)(&ftrace_call)) |
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S index 539b6294b613..26ceb3c0eca9 100644 --- a/arch/mips/kernel/mcount.S +++ b/arch/mips/kernel/mcount.S | |||
| @@ -84,6 +84,19 @@ _mcount: | |||
| 84 | #endif | 84 | #endif |
| 85 | 85 | ||
| 86 | PTR_SUBU a0, ra, 8 /* arg1: self address */ | 86 | PTR_SUBU a0, ra, 8 /* arg1: self address */ |
| 87 | PTR_LA t1, _stext | ||
| 88 | sltu t2, a0, t1 /* t2 = (a0 < _stext) */ | ||
| 89 | PTR_LA t1, _etext | ||
| 90 | sltu t3, t1, a0 /* t3 = (a0 > _etext) */ | ||
| 91 | or t1, t2, t3 | ||
| 92 | beqz t1, ftrace_call | ||
| 93 | nop | ||
| 94 | #if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT) | ||
| 95 | PTR_SUBU a0, a0, 16 /* arg1: adjust to module's recorded callsite */ | ||
| 96 | #else | ||
| 97 | PTR_SUBU a0, a0, 12 | ||
| 98 | #endif | ||
| 99 | |||
| 87 | .globl ftrace_call | 100 | .globl ftrace_call |
| 88 | ftrace_call: | 101 | ftrace_call: |
| 89 | nop /* a placeholder for the call to a real tracing function */ | 102 | nop /* a placeholder for the call to a real tracing function */ |
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 8c78f01dbe73..645b3c4fcfba 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c | |||
| @@ -150,6 +150,7 @@ int ptrace_setfpregs(struct task_struct *child, __u32 __user *data) | |||
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | __get_user(child->thread.fpu.fcr31, data + 64); | 152 | __get_user(child->thread.fpu.fcr31, data + 64); |
| 153 | child->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; | ||
| 153 | 154 | ||
| 154 | /* FIR may not be written. */ | 155 | /* FIR may not be written. */ |
| 155 | 156 | ||
| @@ -695,7 +696,7 @@ long arch_ptrace(struct task_struct *child, long request, | |||
| 695 | break; | 696 | break; |
| 696 | #endif | 697 | #endif |
| 697 | case FPC_CSR: | 698 | case FPC_CSR: |
| 698 | child->thread.fpu.fcr31 = data; | 699 | child->thread.fpu.fcr31 = data & ~FPU_CSR_ALL_X; |
| 699 | break; | 700 | break; |
| 700 | case DSP_BASE ... DSP_BASE + 5: { | 701 | case DSP_BASE ... DSP_BASE + 5: { |
| 701 | dspreg_t *dregs; | 702 | dspreg_t *dregs; |
diff --git a/arch/mips/kernel/rtlx-cmp.c b/arch/mips/kernel/rtlx-cmp.c index 758fb3cd2326..d26dcc4b46e7 100644 --- a/arch/mips/kernel/rtlx-cmp.c +++ b/arch/mips/kernel/rtlx-cmp.c | |||
| @@ -77,6 +77,9 @@ int __init rtlx_module_init(void) | |||
| 77 | dev = device_create(mt_class, NULL, MKDEV(major, i), NULL, | 77 | dev = device_create(mt_class, NULL, MKDEV(major, i), NULL, |
| 78 | "%s%d", RTLX_MODULE_NAME, i); | 78 | "%s%d", RTLX_MODULE_NAME, i); |
| 79 | if (IS_ERR(dev)) { | 79 | if (IS_ERR(dev)) { |
| 80 | while (i--) | ||
| 81 | device_destroy(mt_class, MKDEV(major, i)); | ||
| 82 | |||
| 80 | err = PTR_ERR(dev); | 83 | err = PTR_ERR(dev); |
| 81 | goto out_chrdev; | 84 | goto out_chrdev; |
| 82 | } | 85 | } |
diff --git a/arch/mips/kernel/rtlx-mt.c b/arch/mips/kernel/rtlx-mt.c index 5a66b975989e..cb95470e2e69 100644 --- a/arch/mips/kernel/rtlx-mt.c +++ b/arch/mips/kernel/rtlx-mt.c | |||
| @@ -103,6 +103,9 @@ int __init rtlx_module_init(void) | |||
| 103 | dev = device_create(mt_class, NULL, MKDEV(major, i), NULL, | 103 | dev = device_create(mt_class, NULL, MKDEV(major, i), NULL, |
| 104 | "%s%d", RTLX_MODULE_NAME, i); | 104 | "%s%d", RTLX_MODULE_NAME, i); |
| 105 | if (IS_ERR(dev)) { | 105 | if (IS_ERR(dev)) { |
| 106 | while (i--) | ||
| 107 | device_destroy(mt_class, MKDEV(major, i)); | ||
| 108 | |||
| 106 | err = PTR_ERR(dev); | 109 | err = PTR_ERR(dev); |
| 107 | goto out_chrdev; | 110 | goto out_chrdev; |
| 108 | } | 111 | } |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 7641c87be99a..03dec5ae11ba 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
| @@ -162,7 +162,7 @@ EXPORT(sysn32_call_table) | |||
| 162 | PTR sys_getpeername | 162 | PTR sys_getpeername |
| 163 | PTR sys_socketpair | 163 | PTR sys_socketpair |
| 164 | PTR compat_sys_setsockopt | 164 | PTR compat_sys_setsockopt |
| 165 | PTR sys_getsockopt | 165 | PTR compat_sys_getsockopt |
| 166 | PTR __sys_clone /* 6055 */ | 166 | PTR __sys_clone /* 6055 */ |
| 167 | PTR __sys_fork | 167 | PTR __sys_fork |
| 168 | PTR compat_sys_execve | 168 | PTR compat_sys_execve |
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c index 3babf6e4f894..21f23add04f4 100644 --- a/arch/mips/kernel/smp-mt.c +++ b/arch/mips/kernel/smp-mt.c | |||
| @@ -288,6 +288,7 @@ struct plat_smp_ops vsmp_smp_ops = { | |||
| 288 | .prepare_cpus = vsmp_prepare_cpus, | 288 | .prepare_cpus = vsmp_prepare_cpus, |
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | #ifdef CONFIG_PROC_FS | ||
| 291 | static int proc_cpuinfo_chain_call(struct notifier_block *nfb, | 292 | static int proc_cpuinfo_chain_call(struct notifier_block *nfb, |
| 292 | unsigned long action_unused, void *data) | 293 | unsigned long action_unused, void *data) |
| 293 | { | 294 | { |
| @@ -309,3 +310,4 @@ static int __init proc_cpuinfo_notifier_init(void) | |||
| 309 | } | 310 | } |
| 310 | 311 | ||
| 311 | subsys_initcall(proc_cpuinfo_notifier_init); | 312 | subsys_initcall(proc_cpuinfo_notifier_init); |
| 313 | #endif | ||
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c index 2b3517214d6d..e11906dff885 100644 --- a/arch/mips/kernel/unaligned.c +++ b/arch/mips/kernel/unaligned.c | |||
| @@ -690,7 +690,6 @@ static void emulate_load_store_insn(struct pt_regs *regs, | |||
| 690 | case sdc1_op: | 690 | case sdc1_op: |
| 691 | die_if_kernel("Unaligned FP access in kernel code", regs); | 691 | die_if_kernel("Unaligned FP access in kernel code", regs); |
| 692 | BUG_ON(!used_math()); | 692 | BUG_ON(!used_math()); |
| 693 | BUG_ON(!is_fpu_owner()); | ||
| 694 | 693 | ||
| 695 | lose_fpu(1); /* Save FPU state for the emulator. */ | 694 | lose_fpu(1); /* Save FPU state for the emulator. */ |
| 696 | res = fpu_emulator_cop1Handler(regs, ¤t->thread.fpu, 1, | 695 | res = fpu_emulator_cop1Handler(regs, ¤t->thread.fpu, 1, |
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 736c17a226e9..bf0fc6b16ad9 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
| @@ -1827,7 +1827,7 @@ dcopuop: | |||
| 1827 | case -1: | 1827 | case -1: |
| 1828 | 1828 | ||
| 1829 | if (cpu_has_mips_4_5_r) | 1829 | if (cpu_has_mips_4_5_r) |
| 1830 | cbit = fpucondbit[MIPSInst_RT(ir) >> 2]; | 1830 | cbit = fpucondbit[MIPSInst_FD(ir) >> 2]; |
| 1831 | else | 1831 | else |
| 1832 | cbit = FPU_CSR_COND; | 1832 | cbit = FPU_CSR_COND; |
| 1833 | if (rv.w) | 1833 | if (rv.w) |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index ccf8298e7ab2..a08dd53a1cc5 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
| @@ -429,6 +429,7 @@ static void build_r3000_tlb_refill_handler(void) | |||
| 429 | (unsigned int)(p - tlb_handler)); | 429 | (unsigned int)(p - tlb_handler)); |
| 430 | 430 | ||
| 431 | memcpy((void *)ebase, tlb_handler, 0x80); | 431 | memcpy((void *)ebase, tlb_handler, 0x80); |
| 432 | local_flush_icache_range(ebase, ebase + 0x80); | ||
| 432 | 433 | ||
| 433 | dump_handler("r3000_tlb_refill", (u32 *)ebase, 32); | 434 | dump_handler("r3000_tlb_refill", (u32 *)ebase, 32); |
| 434 | } | 435 | } |
| @@ -1299,6 +1300,7 @@ static void build_r4000_tlb_refill_handler(void) | |||
| 1299 | } | 1300 | } |
| 1300 | #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT | 1301 | #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT |
| 1301 | uasm_l_tlb_huge_update(&l, p); | 1302 | uasm_l_tlb_huge_update(&l, p); |
| 1303 | UASM_i_LW(&p, K0, 0, K1); | ||
| 1302 | build_huge_update_entries(&p, htlb_info.huge_pte, K1); | 1304 | build_huge_update_entries(&p, htlb_info.huge_pte, K1); |
| 1303 | build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random, | 1305 | build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random, |
| 1304 | htlb_info.restore_scratch); | 1306 | htlb_info.restore_scratch); |
| @@ -1415,6 +1417,7 @@ static void build_r4000_tlb_refill_handler(void) | |||
| 1415 | final_len); | 1417 | final_len); |
| 1416 | 1418 | ||
| 1417 | memcpy((void *)ebase, final_handler, 0x100); | 1419 | memcpy((void *)ebase, final_handler, 0x100); |
| 1420 | local_flush_icache_range(ebase, ebase + 0x100); | ||
| 1418 | 1421 | ||
| 1419 | dump_handler("r4000_tlb_refill", (u32 *)ebase, 64); | 1422 | dump_handler("r4000_tlb_refill", (u32 *)ebase, 64); |
| 1420 | } | 1423 | } |
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c index 03a4cdc80226..e31e8cdcb296 100644 --- a/arch/mips/rb532/devices.c +++ b/arch/mips/rb532/devices.c | |||
| @@ -223,6 +223,7 @@ static struct platform_device rb532_wdt = { | |||
| 223 | 223 | ||
| 224 | static struct plat_serial8250_port rb532_uart_res[] = { | 224 | static struct plat_serial8250_port rb532_uart_res[] = { |
| 225 | { | 225 | { |
| 226 | .type = PORT_16550A, | ||
| 226 | .membase = (char *)KSEG1ADDR(REGBASE + UART0BASE), | 227 | .membase = (char *)KSEG1ADDR(REGBASE + UART0BASE), |
| 227 | .irq = UART0_IRQ, | 228 | .irq = UART0_IRQ, |
| 228 | .regshift = 2, | 229 | .regshift = 2, |
diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c index 8e52446286ca..8f1b86d4da84 100644 --- a/arch/mips/sgi-ip22/ip22-gio.c +++ b/arch/mips/sgi-ip22/ip22-gio.c | |||
| @@ -27,8 +27,14 @@ static struct { | |||
| 27 | { .name = "SGI GR2/GR3", .id = 0x7f }, | 27 | { .name = "SGI GR2/GR3", .id = 0x7f }, |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | static void gio_bus_release(struct device *dev) | ||
| 31 | { | ||
| 32 | kfree(dev); | ||
| 33 | } | ||
| 34 | |||
| 30 | static struct device gio_bus = { | 35 | static struct device gio_bus = { |
| 31 | .init_name = "gio", | 36 | .init_name = "gio", |
| 37 | .release = &gio_bus_release, | ||
| 32 | }; | 38 | }; |
| 33 | 39 | ||
| 34 | /** | 40 | /** |
| @@ -413,8 +419,10 @@ int __init ip22_gio_init(void) | |||
| 413 | int ret; | 419 | int ret; |
| 414 | 420 | ||
| 415 | ret = device_register(&gio_bus); | 421 | ret = device_register(&gio_bus); |
| 416 | if (ret) | 422 | if (ret) { |
| 423 | put_device(&gio_bus); | ||
| 417 | return ret; | 424 | return ret; |
| 425 | } | ||
| 418 | 426 | ||
| 419 | ret = bus_register(&gio_bus_type); | 427 | ret = bus_register(&gio_bus_type); |
| 420 | if (!ret) { | 428 | if (!ret) { |
diff --git a/arch/mips/txx9/generic/7segled.c b/arch/mips/txx9/generic/7segled.c index 4642f56e70e5..566c58bd44d0 100644 --- a/arch/mips/txx9/generic/7segled.c +++ b/arch/mips/txx9/generic/7segled.c | |||
| @@ -83,6 +83,11 @@ static struct bus_type tx_7segled_subsys = { | |||
| 83 | .dev_name = "7segled", | 83 | .dev_name = "7segled", |
| 84 | }; | 84 | }; |
| 85 | 85 | ||
| 86 | static void tx_7segled_release(struct device *dev) | ||
| 87 | { | ||
| 88 | kfree(dev); | ||
| 89 | } | ||
| 90 | |||
| 86 | static int __init tx_7segled_init_sysfs(void) | 91 | static int __init tx_7segled_init_sysfs(void) |
| 87 | { | 92 | { |
| 88 | int error, i; | 93 | int error, i; |
| @@ -103,11 +108,14 @@ static int __init tx_7segled_init_sysfs(void) | |||
| 103 | } | 108 | } |
| 104 | dev->id = i; | 109 | dev->id = i; |
| 105 | dev->bus = &tx_7segled_subsys; | 110 | dev->bus = &tx_7segled_subsys; |
| 111 | dev->release = &tx_7segled_release; | ||
| 106 | error = device_register(dev); | 112 | error = device_register(dev); |
| 107 | if (!error) { | 113 | if (error) { |
| 108 | device_create_file(dev, &dev_attr_ascii); | 114 | put_device(dev); |
| 109 | device_create_file(dev, &dev_attr_raw); | 115 | return error; |
| 110 | } | 116 | } |
| 117 | device_create_file(dev, &dev_attr_ascii); | ||
| 118 | device_create_file(dev, &dev_attr_raw); | ||
| 111 | } | 119 | } |
| 112 | return error; | 120 | return error; |
| 113 | } | 121 | } |
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index dd2cf25b5ae5..9ff200ae1c9a 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c | |||
| @@ -937,6 +937,14 @@ static ssize_t txx9_sram_write(struct file *filp, struct kobject *kobj, | |||
| 937 | return size; | 937 | return size; |
| 938 | } | 938 | } |
| 939 | 939 | ||
| 940 | static void txx9_device_release(struct device *dev) | ||
| 941 | { | ||
| 942 | struct txx9_sramc_dev *tdev; | ||
| 943 | |||
| 944 | tdev = container_of(dev, struct txx9_sramc_dev, dev); | ||
| 945 | kfree(tdev); | ||
| 946 | } | ||
| 947 | |||
| 940 | void __init txx9_sramc_init(struct resource *r) | 948 | void __init txx9_sramc_init(struct resource *r) |
| 941 | { | 949 | { |
| 942 | struct txx9_sramc_dev *dev; | 950 | struct txx9_sramc_dev *dev; |
| @@ -951,8 +959,11 @@ void __init txx9_sramc_init(struct resource *r) | |||
| 951 | return; | 959 | return; |
| 952 | size = resource_size(r); | 960 | size = resource_size(r); |
| 953 | dev->base = ioremap(r->start, size); | 961 | dev->base = ioremap(r->start, size); |
| 954 | if (!dev->base) | 962 | if (!dev->base) { |
| 955 | goto exit; | 963 | kfree(dev); |
| 964 | return; | ||
| 965 | } | ||
| 966 | dev->dev.release = &txx9_device_release; | ||
| 956 | dev->dev.bus = &txx9_sramc_subsys; | 967 | dev->dev.bus = &txx9_sramc_subsys; |
| 957 | sysfs_bin_attr_init(&dev->bindata_attr); | 968 | sysfs_bin_attr_init(&dev->bindata_attr); |
| 958 | dev->bindata_attr.attr.name = "bindata"; | 969 | dev->bindata_attr.attr.name = "bindata"; |
| @@ -963,17 +974,15 @@ void __init txx9_sramc_init(struct resource *r) | |||
| 963 | dev->bindata_attr.private = dev; | 974 | dev->bindata_attr.private = dev; |
| 964 | err = device_register(&dev->dev); | 975 | err = device_register(&dev->dev); |
| 965 | if (err) | 976 | if (err) |
| 966 | goto exit; | 977 | goto exit_put; |
| 967 | err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); | 978 | err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); |
| 968 | if (err) { | 979 | if (err) { |
| 969 | device_unregister(&dev->dev); | 980 | device_unregister(&dev->dev); |
| 970 | goto exit; | 981 | iounmap(dev->base); |
| 971 | } | ||
| 972 | return; | ||
| 973 | exit: | ||
| 974 | if (dev) { | ||
| 975 | if (dev->base) | ||
| 976 | iounmap(dev->base); | ||
| 977 | kfree(dev); | 982 | kfree(dev); |
| 978 | } | 983 | } |
| 984 | return; | ||
| 985 | exit_put: | ||
| 986 | put_device(&dev->dev); | ||
| 987 | return; | ||
| 979 | } | 988 | } |
