From 40506d402293633f0636e96a7e20c5e688e87563 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Mon, 18 Apr 2016 16:55:38 +0200 Subject: [PATCH 1/4] cmd640: add __init attribute Add __init attribute on a function that is only called from other __init functions and that is not inlined, at least with gcc version 4.8.4 on an x86 machine with allyesconfig. Currently, the function is put in the .text.unlikely segment. Declaring it as __init will cause it to be put in the .init.text and to disappear after initialization. The result of objdump -x on the function before the change is as follows: 0000000000000000 l F .text.unlikely 00000000000000e4 cmd640x_init_one And after the change it is as follows: 00000000000000d2 l F .init.text 00000000000000df cmd640x_init_one Done with the help of Coccinelle. The semantic patch checks for local static non-init functions that are called from an __init function and are not called from any other function. Signed-off-by: Julia Lawall Signed-off-by: David S. Miller --- drivers/ide/cmd640.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/cmd640.c b/drivers/ide/cmd640.c index 70f0a2754c13..004243bd84db 100644 --- a/drivers/ide/cmd640.c +++ b/drivers/ide/cmd640.c @@ -695,7 +695,7 @@ static const struct ide_port_info cmd640_port_info __initconst = { .pio_mask = ATA_PIO5, }; -static int cmd640x_init_one(unsigned long base, unsigned long ctl) +static int __init cmd640x_init_one(unsigned long base, unsigned long ctl) { if (!request_region(base, 8, DRV_NAME)) { printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", From 79f18a0637033f588accaa05621225c60301514a Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Sat, 30 Apr 2016 01:11:12 +0300 Subject: [PATCH 2/4] ide-tape: fix misprint in failure handling in idetape_init() If driver_register() failed there is no sense to call driver_unregister(). unregister_chrdev() should be called here. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: David S. Miller --- drivers/ide/ide-tape.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 12fa04997dcc..9ecf4e35adcd 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -2052,12 +2052,12 @@ static int __init idetape_init(void) error = driver_register(&idetape_driver.gen_driver); if (error) - goto out_free_driver; + goto out_free_chrdev; return 0; -out_free_driver: - driver_unregister(&idetape_driver.gen_driver); +out_free_chrdev: + unregister_chrdev(IDETAPE_MAJOR, "ht"); out_free_class: class_destroy(idetape_sysfs_class); out: From 45969e16f9fe27ed1175b003ef40c47902a09d05 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 12 Jul 2016 11:59:39 +0100 Subject: [PATCH 3/4] ide: hpt366: fix incorrect mask when checking at cmd_high_time According to the HPT366 data sheet, PCI config space dword 0x40-0x43 bits 11:8 specify the primary drive cmd_high_time, however, currently just 3 bits of the 4 are being used because the mask is 0x07 and not 0x0f. Fix the mask, allowing for the 40MHz clock to be detected. Also add in missing space between switch and parenthesis to clean up a checkpatch warning. Signed-off-by: Colin Ian King Acked-by: Sergei Shtylyov Signed-off-by: David S. Miller --- drivers/ide/hpt366.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index f94baadbf424..0ceae5cbd89a 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c @@ -1012,7 +1012,7 @@ static int init_chipset_hpt366(struct pci_dev *dev) pci_read_config_dword(dev, 0x40, &itr1); /* Detect PCI clock by looking at cmd_high_time. */ - switch((itr1 >> 8) & 0x07) { + switch ((itr1 >> 8) & 0x0f) { case 0x09: pci_clk = 40; break; From d4f8c2e0f827a0b3a322c449ac331ae41feeb359 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 14 Jul 2016 13:48:02 +0300 Subject: [PATCH 4/4] ide: missing break statement in set_timings_mdma() There was clearly supposed to be a break statement here. Currently we use the k2 ata timings instead of sh ata ones we intended. Probably no one has this hardware anymore so it likely doesn't make a difference beyond the static checker warning. Signed-off-by: Dan Carpenter Acked-by: Benjamin Herrenschmidt Signed-off-by: David S. Miller --- drivers/ide/pmac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index 7f0434f7e486..0c5d3a99468e 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c @@ -707,6 +707,7 @@ set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, *timings = ((*timings) & ~TR_133_PIOREG_MDMA_MASK) | tr; *timings2 = (*timings2) & ~TR_133_UDMAREG_UDMA_EN; } + break; case controller_un_ata6: case controller_k2_ata6: { /* 100Mhz cell */