Skip to content

Commit f47e2db

Browse files
committed
Merge branch 'parisc-4.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc fixes and cleanups from Helge Deller: "Nothing really important in this patchset: fix resource leaks in error paths, coding style cleanups and code removal" * 'parisc-4.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Remove flush_user_dcache_range and flush_user_icache_range parisc: fix a printk parisc: ccio-dma: Handle return NULL error from ioremap_nocache parisc: Define access_ok() as macro parisc: eisa: Fix resource leaks in error paths parisc: eisa: Remove coding style errors
2 parents 606ed72 + ef470a6 commit f47e2db

File tree

7 files changed

+83
-88
lines changed

7 files changed

+83
-88
lines changed

arch/parisc/include/asm/cacheflush.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ void flush_user_dcache_range_asm(unsigned long, unsigned long);
2727
void flush_kernel_dcache_range_asm(unsigned long, unsigned long);
2828
void flush_kernel_dcache_page_asm(void *);
2929
void flush_kernel_icache_page(void *);
30-
void flush_user_dcache_range(unsigned long, unsigned long);
31-
void flush_user_icache_range(unsigned long, unsigned long);
3230

3331
/* Cache flush operations */
3432

arch/parisc/include/asm/uaccess.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@
3232
* that put_user is the same as __put_user, etc.
3333
*/
3434

35-
static inline long access_ok(int type, const void __user * addr,
36-
unsigned long size)
37-
{
38-
return 1;
39-
}
35+
#define access_ok(type, uaddr, size) (1)
4036

4137
#define put_user __put_user
4238
#define get_user __get_user

arch/parisc/kernel/cache.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -574,24 +574,6 @@ void flush_cache_mm(struct mm_struct *mm)
574574
}
575575
}
576576

577-
void
578-
flush_user_dcache_range(unsigned long start, unsigned long end)
579-
{
580-
if ((end - start) < parisc_cache_flush_threshold)
581-
flush_user_dcache_range_asm(start,end);
582-
else
583-
flush_data_cache();
584-
}
585-
586-
void
587-
flush_user_icache_range(unsigned long start, unsigned long end)
588-
{
589-
if ((end - start) < parisc_cache_flush_threshold)
590-
flush_user_icache_range_asm(start,end);
591-
else
592-
flush_instruction_cache();
593-
}
594-
595577
void flush_cache_range(struct vm_area_struct *vma,
596578
unsigned long start, unsigned long end)
597579
{

arch/parisc/kernel/signal.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs,
233233
struct rt_sigframe __user *frame;
234234
unsigned long rp, usp;
235235
unsigned long haddr, sigframe_size;
236+
unsigned long start, end;
236237
int err = 0;
237238
#ifdef CONFIG_64BIT
238239
struct compat_rt_sigframe __user * compat_frame;
@@ -300,10 +301,10 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs,
300301
}
301302
#endif
302303

303-
flush_user_dcache_range((unsigned long) &frame->tramp[0],
304-
(unsigned long) &frame->tramp[TRAMP_SIZE]);
305-
flush_user_icache_range((unsigned long) &frame->tramp[0],
306-
(unsigned long) &frame->tramp[TRAMP_SIZE]);
304+
start = (unsigned long) &frame->tramp[0];
305+
end = (unsigned long) &frame->tramp[TRAMP_SIZE];
306+
flush_user_dcache_range_asm(start, end);
307+
flush_user_icache_range_asm(start, end);
307308

308309
/* TRAMP Words 0-4, Length 5 = SIGRESTARTBLOCK_TRAMP
309310
* TRAMP Words 5-9, Length 4 = SIGRETURN_TRAMP
@@ -549,8 +550,8 @@ insert_restart_trampoline(struct pt_regs *regs)
549550
WARN_ON(err);
550551

551552
/* flush data/instruction cache for new insns */
552-
flush_user_dcache_range(start, end);
553-
flush_user_icache_range(start, end);
553+
flush_user_dcache_range_asm(start, end);
554+
flush_user_icache_range_asm(start, end);
554555

555556
regs->gr[31] = regs->gr[30] + 8;
556557
return;

arch/parisc/mm/fault.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ show_signal_msg(struct pt_regs *regs, unsigned long code,
239239
vma ? ',':'\n');
240240

241241
if (vma)
242-
pr_warn(KERN_CONT " vm_start = 0x%08lx, vm_end = 0x%08lx\n",
243-
vma->vm_start, vma->vm_end);
242+
pr_cont(" vm_start = 0x%08lx, vm_end = 0x%08lx\n",
243+
vma->vm_start, vma->vm_end);
244244

245245
show_regs(regs);
246246
}

drivers/parisc/ccio-dma.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ static int __init ccio_probe(struct parisc_device *dev)
15391539
ioc = kzalloc(sizeof(struct ioc), GFP_KERNEL);
15401540
if (ioc == NULL) {
15411541
printk(KERN_ERR MODULE_NAME ": memory allocation failure\n");
1542-
return 1;
1542+
return -ENOMEM;
15431543
}
15441544

15451545
ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn";
@@ -1554,6 +1554,10 @@ static int __init ccio_probe(struct parisc_device *dev)
15541554

15551555
ioc->hw_path = dev->hw_path;
15561556
ioc->ioc_regs = ioremap_nocache(dev->hpa.start, 4096);
1557+
if (!ioc->ioc_regs) {
1558+
kfree(ioc);
1559+
return -ENOMEM;
1560+
}
15571561
ccio_ioc_init(ioc);
15581562
ccio_init_resources(ioc);
15591563
hppa_dma_ops = &ccio_ops;

drivers/parisc/eisa.c

Lines changed: 68 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
* Wax ASIC also includes a PS/2 and RS-232 controller, but those are
1515
* dealt with elsewhere; this file is concerned only with the EISA portions
1616
* of Wax.
17-
*
18-
*
17+
*
18+
*
1919
* HINT:
2020
* -----
2121
* To allow an ISA card to work properly in the EISA slot you need to
22-
* set an edge trigger level. This may be done on the palo command line
23-
* by adding the kernel parameter "eisa_irq_edge=n,n2,[...]]", with
22+
* set an edge trigger level. This may be done on the palo command line
23+
* by adding the kernel parameter "eisa_irq_edge=n,n2,[...]]", with
2424
* n and n2 as the irq levels you want to use.
25-
*
26-
* Example: "eisa_irq_edge=10,11" allows ISA cards to operate at
25+
*
26+
* Example: "eisa_irq_edge=10,11" allows ISA cards to operate at
2727
* irq levels 10 and 11.
2828
*/
2929

@@ -46,9 +46,9 @@
4646
#include <asm/eisa_eeprom.h>
4747

4848
#if 0
49-
#define EISA_DBG(msg, arg... ) printk(KERN_DEBUG "eisa: " msg , ## arg )
49+
#define EISA_DBG(msg, arg...) printk(KERN_DEBUG "eisa: " msg, ## arg)
5050
#else
51-
#define EISA_DBG(msg, arg... )
51+
#define EISA_DBG(msg, arg...)
5252
#endif
5353

5454
#define SNAKES_EEPROM_BASE_ADDR 0xF0810400
@@ -108,7 +108,7 @@ void eisa_out8(unsigned char data, unsigned short port)
108108

109109
void eisa_out16(unsigned short data, unsigned short port)
110110
{
111-
if (EISA_bus)
111+
if (EISA_bus)
112112
gsc_writew(cpu_to_le16(data), eisa_permute(port));
113113
}
114114

@@ -135,9 +135,9 @@ static int master_mask;
135135
static int slave_mask;
136136

137137
/* the trig level can be set with the
138-
* eisa_irq_edge=n,n,n commandline parameter
139-
* We should really read this from the EEPROM
140-
* in the furure.
138+
* eisa_irq_edge=n,n,n commandline parameter
139+
* We should really read this from the EEPROM
140+
* in the furure.
141141
*/
142142
/* irq 13,8,2,1,0 must be edge */
143143
static unsigned int eisa_irq_level __read_mostly; /* default to edge triggered */
@@ -170,7 +170,7 @@ static void eisa_unmask_irq(struct irq_data *d)
170170
unsigned int irq = d->irq;
171171
unsigned long flags;
172172
EISA_DBG("enable irq %d\n", irq);
173-
173+
174174
spin_lock_irqsave(&eisa_irq_lock, flags);
175175
if (irq & 8) {
176176
slave_mask &= ~(1 << (irq&7));
@@ -194,39 +194,39 @@ static irqreturn_t eisa_irq(int wax_irq, void *intr_dev)
194194
{
195195
int irq = gsc_readb(0xfc01f000); /* EISA supports 16 irqs */
196196
unsigned long flags;
197-
197+
198198
spin_lock_irqsave(&eisa_irq_lock, flags);
199199
/* read IRR command */
200200
eisa_out8(0x0a, 0x20);
201201
eisa_out8(0x0a, 0xa0);
202202

203203
EISA_DBG("irq IAR %02x 8259-1 irr %02x 8259-2 irr %02x\n",
204204
irq, eisa_in8(0x20), eisa_in8(0xa0));
205-
205+
206206
/* read ISR command */
207207
eisa_out8(0x0a, 0x20);
208208
eisa_out8(0x0a, 0xa0);
209209
EISA_DBG("irq 8259-1 isr %02x imr %02x 8259-2 isr %02x imr %02x\n",
210210
eisa_in8(0x20), eisa_in8(0x21), eisa_in8(0xa0), eisa_in8(0xa1));
211-
211+
212212
irq &= 0xf;
213-
213+
214214
/* mask irq and write eoi */
215215
if (irq & 8) {
216216
slave_mask |= (1 << (irq&7));
217217
eisa_out8(slave_mask, 0xa1);
218218
eisa_out8(0x60 | (irq&7),0xa0);/* 'Specific EOI' to slave */
219-
eisa_out8(0x62,0x20); /* 'Specific EOI' to master-IRQ2 */
220-
219+
eisa_out8(0x62, 0x20); /* 'Specific EOI' to master-IRQ2 */
220+
221221
} else {
222222
master_mask |= (1 << (irq&7));
223223
eisa_out8(master_mask, 0x21);
224-
eisa_out8(0x60|irq,0x20); /* 'Specific EOI' to master */
224+
eisa_out8(0x60|irq, 0x20); /* 'Specific EOI' to master */
225225
}
226226
spin_unlock_irqrestore(&eisa_irq_lock, flags);
227227

228228
generic_handle_irq(irq);
229-
229+
230230
spin_lock_irqsave(&eisa_irq_lock, flags);
231231
/* unmask */
232232
if (irq & 8) {
@@ -254,44 +254,44 @@ static struct irqaction irq2_action = {
254254
static void init_eisa_pic(void)
255255
{
256256
unsigned long flags;
257-
257+
258258
spin_lock_irqsave(&eisa_irq_lock, flags);
259259

260260
eisa_out8(0xff, 0x21); /* mask during init */
261261
eisa_out8(0xff, 0xa1); /* mask during init */
262-
262+
263263
/* master pic */
264-
eisa_out8(0x11,0x20); /* ICW1 */
265-
eisa_out8(0x00,0x21); /* ICW2 */
266-
eisa_out8(0x04,0x21); /* ICW3 */
267-
eisa_out8(0x01,0x21); /* ICW4 */
268-
eisa_out8(0x40,0x20); /* OCW2 */
269-
264+
eisa_out8(0x11, 0x20); /* ICW1 */
265+
eisa_out8(0x00, 0x21); /* ICW2 */
266+
eisa_out8(0x04, 0x21); /* ICW3 */
267+
eisa_out8(0x01, 0x21); /* ICW4 */
268+
eisa_out8(0x40, 0x20); /* OCW2 */
269+
270270
/* slave pic */
271-
eisa_out8(0x11,0xa0); /* ICW1 */
272-
eisa_out8(0x08,0xa1); /* ICW2 */
273-
eisa_out8(0x02,0xa1); /* ICW3 */
274-
eisa_out8(0x01,0xa1); /* ICW4 */
275-
eisa_out8(0x40,0xa0); /* OCW2 */
276-
271+
eisa_out8(0x11, 0xa0); /* ICW1 */
272+
eisa_out8(0x08, 0xa1); /* ICW2 */
273+
eisa_out8(0x02, 0xa1); /* ICW3 */
274+
eisa_out8(0x01, 0xa1); /* ICW4 */
275+
eisa_out8(0x40, 0xa0); /* OCW2 */
276+
277277
udelay(100);
278-
279-
slave_mask = 0xff;
280-
master_mask = 0xfb;
278+
279+
slave_mask = 0xff;
280+
master_mask = 0xfb;
281281
eisa_out8(slave_mask, 0xa1); /* OCW1 */
282282
eisa_out8(master_mask, 0x21); /* OCW1 */
283-
283+
284284
/* setup trig level */
285285
EISA_DBG("EISA edge/level %04x\n", eisa_irq_level);
286-
286+
287287
eisa_out8(eisa_irq_level&0xff, 0x4d0); /* Set all irq's to edge */
288-
eisa_out8((eisa_irq_level >> 8) & 0xff, 0x4d1);
289-
288+
eisa_out8((eisa_irq_level >> 8) & 0xff, 0x4d1);
289+
290290
EISA_DBG("pic0 mask %02x\n", eisa_in8(0x21));
291291
EISA_DBG("pic1 mask %02x\n", eisa_in8(0xa1));
292292
EISA_DBG("pic0 edge/level %02x\n", eisa_in8(0x4d0));
293293
EISA_DBG("pic1 edge/level %02x\n", eisa_in8(0x4d1));
294-
294+
295295
spin_unlock_irqrestore(&eisa_irq_lock, flags);
296296
}
297297

@@ -305,7 +305,7 @@ static int __init eisa_probe(struct parisc_device *dev)
305305

306306
char *name = is_mongoose(dev) ? "Mongoose" : "Wax";
307307

308-
printk(KERN_INFO "%s EISA Adapter found at 0x%08lx\n",
308+
printk(KERN_INFO "%s EISA Adapter found at 0x%08lx\n",
309309
name, (unsigned long)dev->hpa.start);
310310

311311
eisa_dev.hba.dev = dev;
@@ -334,16 +334,16 @@ static int __init eisa_probe(struct parisc_device *dev)
334334
result = request_irq(dev->irq, eisa_irq, IRQF_SHARED, "EISA", &eisa_dev);
335335
if (result) {
336336
printk(KERN_ERR "EISA: request_irq failed!\n");
337-
return result;
337+
goto error_release;
338338
}
339-
339+
340340
/* Reserve IRQ2 */
341341
setup_irq(2, &irq2_action);
342342
for (i = 0; i < 16; i++) {
343343
irq_set_chip_and_handler(i, &eisa_interrupt_type,
344344
handle_simple_irq);
345345
}
346-
346+
347347
EISA_bus = 1;
348348

349349
if (dev->num_addrs) {
@@ -358,6 +358,11 @@ static int __init eisa_probe(struct parisc_device *dev)
358358
}
359359
}
360360
eisa_eeprom_addr = ioremap_nocache(eisa_dev.eeprom_addr, HPEE_MAX_LENGTH);
361+
if (!eisa_eeprom_addr) {
362+
result = -ENOMEM;
363+
printk(KERN_ERR "EISA: ioremap_nocache failed!\n");
364+
goto error_free_irq;
365+
}
361366
result = eisa_enumerator(eisa_dev.eeprom_addr, &eisa_dev.hba.io_space,
362367
&eisa_dev.hba.lmmio_space);
363368
init_eisa_pic();
@@ -372,11 +377,20 @@ static int __init eisa_probe(struct parisc_device *dev)
372377
eisa_dev.root.dma_mask = 0xffffffff; /* wild guess */
373378
if (eisa_root_register (&eisa_dev.root)) {
374379
printk(KERN_ERR "EISA: Failed to register EISA root\n");
375-
return -1;
380+
result = -ENOMEM;
381+
goto error_iounmap;
376382
}
377383
}
378-
384+
379385
return 0;
386+
387+
error_iounmap:
388+
iounmap(eisa_eeprom_addr);
389+
error_free_irq:
390+
free_irq(dev->irq, &eisa_dev);
391+
error_release:
392+
release_resource(&eisa_dev.hba.io_space);
393+
return result;
380394
}
381395

382396
static const struct parisc_device_id eisa_tbl[] = {
@@ -404,7 +418,7 @@ void eisa_make_irq_level(int num)
404418
{
405419
if (eisa_irq_configured& (1<<num)) {
406420
printk(KERN_WARNING
407-
"IRQ %d polarity configured twice (last to level)\n",
421+
"IRQ %d polarity configured twice (last to level)\n",
408422
num);
409423
}
410424
eisa_irq_level |= (1<<num); /* set the corresponding bit */
@@ -414,7 +428,7 @@ void eisa_make_irq_level(int num)
414428
void eisa_make_irq_edge(int num)
415429
{
416430
if (eisa_irq_configured& (1<<num)) {
417-
printk(KERN_WARNING
431+
printk(KERN_WARNING
418432
"IRQ %d polarity configured twice (last to edge)\n",
419433
num);
420434
}
@@ -430,18 +444,18 @@ static int __init eisa_irq_setup(char *str)
430444
EISA_DBG("IRQ setup\n");
431445
while (cur != NULL) {
432446
char *pe;
433-
447+
434448
val = (int) simple_strtoul(cur, &pe, 0);
435449
if (val > 15 || val < 0) {
436450
printk(KERN_ERR "eisa: EISA irq value are 0-15\n");
437451
continue;
438452
}
439-
if (val == 2) {
453+
if (val == 2) {
440454
val = 9;
441455
}
442456
eisa_make_irq_edge(val); /* clear the corresponding bit */
443457
EISA_DBG("setting IRQ %d to edge-triggered mode\n", val);
444-
458+
445459
if ((cur = strchr(cur, ','))) {
446460
cur++;
447461
} else {

0 commit comments

Comments
 (0)