From 1746fbe5656b1b10064913b9293a4590ec0b7f27 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Fri, 21 Nov 2014 20:22:32 +0100 Subject: IDE: Deletion of an unnecessary check before the function call "module_put" The module_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: David S. Miller diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 2ce6268..e29b02c 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -101,8 +101,7 @@ void ide_device_put(ide_drive_t *drive) struct device *host_dev = drive->hwif->host->dev[0]; struct module *module = host_dev ? host_dev->driver->owner : NULL; - if (module) - module_put(module); + module_put(module); #endif put_device(&drive->gendev); } -- cgit v0.10.2 From ca957b6a34a6f7014828f235e35c1945cb955795 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 27 Nov 2014 22:57:29 +0100 Subject: drivers: ide: Fix mostly harmless off-by-one hardcoded value The string "IOMEGA Clik!" has length 12, not 11. Using strstarts avoids the error-prone hardcoding of the prefix length. For consistency, also change the occurence just above. Signed-off-by: Rasmus Villemoes Signed-off-by: David S. Miller diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 3d42043..8c6363c 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -487,7 +487,7 @@ static void ide_floppy_setup(ide_drive_t *drive) * it. It should be fixed as of version 1.9, but to be on the safe side * we'll leave the limitation below for the 2.2.x tree. */ - if (!strncmp((char *)&id[ATA_ID_PROD], "IOMEGA ZIP 100 ATAPI", 20)) { + if (strstarts((char *)&id[ATA_ID_PROD], "IOMEGA ZIP 100 ATAPI")) { drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE; /* This value will be visible in the /proc/ide/hdx/settings */ drive->pc_delay = IDEFLOPPY_PC_DELAY; @@ -498,7 +498,7 @@ static void ide_floppy_setup(ide_drive_t *drive) * Guess what? The IOMEGA Clik! drive also needs the above fix. It makes * nasty clicking noises without it, so please don't remove this. */ - if (strncmp((char *)&id[ATA_ID_PROD], "IOMEGA Clik!", 11) == 0) { + if (strstarts((char *)&id[ATA_ID_PROD], "IOMEGA Clik!")) { blk_queue_max_hw_sectors(drive->queue, 64); drive->atapi_flags |= IDE_AFLAG_CLIK_DRIVE; /* IOMEGA Clik! drives do not support lock/unlock commands */ -- cgit v0.10.2