]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] kfree cleanup: misc remaining drivers
authorJesper Juhl <jesper.juhl@gmail.com>
Mon, 7 Nov 2005 09:01:32 +0000 (01:01 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:54:05 +0000 (07:54 -0800)
This is the remaining misc drivers/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in misc files in
drivers/.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
Acked-by: Roland Dreier <rolandd@cisco.com>
Acked-by: Pierre Ossman <drzeus@drzeus.cx>
Acked-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Len Brown <len.brown@intel.com>
Acked-by: "Antonino A. Daplas" <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
24 files changed:
drivers/acpi/container.c
drivers/acpi/scan.c
drivers/acpi/video.c
drivers/block/DAC960.c
drivers/block/cciss.c
drivers/fc4/fc.c
drivers/hwmon/w83781d.c
drivers/i2c/busses/i2c-amd756-s4882.c
drivers/ide/ide-cd.c
drivers/ide/ide-probe.c
drivers/ide/ide-taskfile.c
drivers/ide/ide.c
drivers/infiniband/core/mad.c
drivers/input/misc/uinput.c
drivers/macintosh/adbhid.c
drivers/mmc/wbsd.c
drivers/parport/probe.c
drivers/parport/share.c
drivers/pci/hotplug/cpqphp_pci.c
drivers/pcmcia/cistpl.c
drivers/pcmcia/cs.c
drivers/sbus/char/envctrl.c
drivers/video/i810/i810_main.c
drivers/w1/w1_ds2433.c

index 10dd695a1dd93e06d43497b5b4c49ce8680a7cac..27ec12c1fab084c2ea1bba43c24be5e00c636e71 100644 (file)
@@ -118,11 +118,9 @@ static int acpi_container_remove(struct acpi_device *device, int type)
 {
        acpi_status status = AE_OK;
        struct acpi_container *pc = NULL;
-       pc = (struct acpi_container *)acpi_driver_data(device);
-
-       if (pc)
-               kfree(pc);
 
+       pc = (struct acpi_container *)acpi_driver_data(device);
+       kfree(pc);
        return status;
 }
 
index c6db591479de3e02504d40ac8e0cee2d2bebdeab..23e2c6968a1164f9f54aa6f9a5493c619965019a 100644 (file)
@@ -28,8 +28,7 @@ static int acpi_bus_trim(struct acpi_device *start, int rmdevice);
 static void acpi_device_release(struct kobject *kobj)
 {
        struct acpi_device *dev = container_of(kobj, struct acpi_device, kobj);
-       if (dev->pnp.cid_list)
-               kfree(dev->pnp.cid_list);
+       kfree(dev->pnp.cid_list);
        kfree(dev);
 }
 
@@ -1117,8 +1116,7 @@ acpi_add_single_object(struct acpi_device **child,
        if (!result)
                *child = device;
        else {
-               if (device->pnp.cid_list)
-                       kfree(device->pnp.cid_list);
+               kfree(device->pnp.cid_list);
                kfree(device);
        }
 
index e383d6109ae109c6963d43abe7ca71449e554518..f051b151580d7de14647213f6c4497a75a4eff57 100644 (file)
@@ -334,8 +334,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
        return_VALUE(0);
 
       err:
-       if (buffer.pointer)
-               kfree(buffer.pointer);
+       kfree(buffer.pointer);
 
        return_VALUE(status);
 }
@@ -1488,8 +1487,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
        }
        active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END;
 
-       if (video->attached_array)
-               kfree(video->attached_array);
+       kfree(video->attached_array);
 
        video->attached_array = active_device_list;
        video->attached_count = count;
@@ -1645,8 +1643,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
                        printk(KERN_WARNING PREFIX
                               "hhuuhhuu bug in acpi video driver.\n");
 
-               if (data->brightness)
-                       kfree(data->brightness);
+               kfree(data->brightness);
 
                kfree(data);
        }
@@ -1831,8 +1828,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
        acpi_video_bus_put_devices(video);
        acpi_video_bus_remove_fs(device);
 
-       if (video->attached_array)
-               kfree(video->attached_array);
+       kfree(video->attached_array);
        kfree(video);
 
        return_VALUE(0);
index 3760edfdc65cc54f9cb6525eb2d26ebd0833b1e4..70eaa5c7ac088c7db5ed6c8363bf8b5e1f75f881 100644 (file)
@@ -417,14 +417,12 @@ static void DAC960_DestroyAuxiliaryStructures(DAC960_Controller_T *Controller)
             * Remember the beginning of the group, but don't free it
            * until we've reached the beginning of the next group.
            */
-          if (CommandGroup != NULL)
-               kfree(CommandGroup);
-           CommandGroup = Command;
+          kfree(CommandGroup);
+          CommandGroup = Command;
       }
       Controller->Commands[i] = NULL;
     }
-  if (CommandGroup != NULL)
-      kfree(CommandGroup);
+  kfree(CommandGroup);
 
   if (Controller->CombinedStatusBuffer != NULL)
     {
@@ -435,30 +433,23 @@ static void DAC960_DestroyAuxiliaryStructures(DAC960_Controller_T *Controller)
 
   if (ScatterGatherPool != NULL)
        pci_pool_destroy(ScatterGatherPool);
-  if (Controller->FirmwareType == DAC960_V1_Controller) return;
+  if (Controller->FirmwareType == DAC960_V1_Controller)
+       return;
 
   if (RequestSensePool != NULL)
        pci_pool_destroy(RequestSensePool);
 
-  for (i = 0; i < DAC960_MaxLogicalDrives; i++)
-    if (Controller->V2.LogicalDeviceInformation[i] != NULL)
-      {
+  for (i = 0; i < DAC960_MaxLogicalDrives; i++) {
        kfree(Controller->V2.LogicalDeviceInformation[i]);
        Controller->V2.LogicalDeviceInformation[i] = NULL;
-      }
+  }
 
   for (i = 0; i < DAC960_V2_MaxPhysicalDevices; i++)
     {
-      if (Controller->V2.PhysicalDeviceInformation[i] != NULL)
-       {
-         kfree(Controller->V2.PhysicalDeviceInformation[i]);
-         Controller->V2.PhysicalDeviceInformation[i] = NULL;
-       }
-      if (Controller->V2.InquiryUnitSerialNumber[i] != NULL)
-       {
-         kfree(Controller->V2.InquiryUnitSerialNumber[i]);
-         Controller->V2.InquiryUnitSerialNumber[i] = NULL;
-       }
+      kfree(Controller->V2.PhysicalDeviceInformation[i]);
+      Controller->V2.PhysicalDeviceInformation[i] = NULL;
+      kfree(Controller->V2.InquiryUnitSerialNumber[i]);
+      Controller->V2.InquiryUnitSerialNumber[i] = NULL;
     }
 }
 
index 486b6e1c7dfb96aaa1a8e98e06169d7ce7164f27..a97c80b57737528b3e5cf6b1da2f351584dc14ca 100644 (file)
@@ -1096,14 +1096,11 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
 cleanup1:
                if (buff) {
                        for(i=0; i<sg_used; i++)
-                               if(buff[i] != NULL)
-                                       kfree(buff[i]);
+                               kfree(buff[i]);
                        kfree(buff);
                }
-               if (buff_size)
-                       kfree(buff_size);
-               if (ioc)
-                       kfree(ioc);
+               kfree(buff_size);
+               kfree(ioc);
                return(status);
        }
        default:
@@ -3034,8 +3031,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
        return(1);
 
 clean4:
-       if(hba[i]->cmd_pool_bits)
-                       kfree(hba[i]->cmd_pool_bits);
+       kfree(hba[i]->cmd_pool_bits);
        if(hba[i]->cmd_pool)
                pci_free_consistent(hba[i]->pdev,
                        NR_CMDS * sizeof(CommandList_struct),
index e375995a2e9b70bb357402674033a622c93c3cfc..5c8943509cc1b7b668a784685861c9e9fab94a89 100644 (file)
@@ -554,8 +554,8 @@ int fcp_initialize(fc_channel *fcchain, int count)
        l->logi = kzalloc (count * 3 * sizeof(logi), GFP_KERNEL);
        l->fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL);
        if (!l->logi || !l->fcmds) {
-               if (l->logi) kfree (l->logi);
-               if (l->fcmds) kfree (l->fcmds);
+               kfree (l->logi);
+               kfree (l->fcmds);
                kfree (l);
                printk ("FC: Cannot allocate DMA memory for initialization\n");
                return -ENOMEM;
@@ -674,7 +674,6 @@ int fcp_forceoffline(fc_channel *fcchain, int count)
        atomic_set (&l.todo, count);
        l.fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL);
        if (!l.fcmds) {
-               kfree (l.fcmds);
                printk ("FC: Cannot allocate memory for forcing offline\n");
                return -ENOMEM;
        }
index 9265f32122fa4b59d072b98134c18bf383fb57d0..ffdb3a03e2b5f9bd39bc8c551f04506df4a92081 100644 (file)
@@ -976,11 +976,9 @@ w83781d_detect_subclients(struct i2c_adapter *adapter, int address, int kind,
 ERROR_SC_3:
        i2c_detach_client(data->lm75[0]);
 ERROR_SC_2:
-       if (data->lm75[1])
-               kfree(data->lm75[1]);
+       kfree(data->lm75[1]);
 ERROR_SC_1:
-       if (data->lm75[0])
-               kfree(data->lm75[0]);
+       kfree(data->lm75[0]);
 ERROR_SC_0:
        return err;
 }
index f51ab652300a66a5d629ac3937622e289f379bf7..56c7d987590f51704ea22363796ab34d838c9c1b 100644 (file)
@@ -245,10 +245,8 @@ static void __exit amd756_s4882_exit(void)
                kfree(s4882_adapter);
                s4882_adapter = NULL;
        }
-       if (s4882_algo) {
-               kfree(s4882_algo);
-               s4882_algo = NULL;
-       }
+       kfree(s4882_algo);
+       s4882_algo = NULL;
 
        /* Restore physical bus */
        if (i2c_add_adapter(&amd756_smbus))
index 74d2ab0d901ea8b3057ca8066a3a819e32c228a5..c2f47923d174bd6eedb352ec9164b52eac38b488 100644 (file)
@@ -3292,12 +3292,9 @@ static void ide_cd_release(struct kref *kref)
        ide_drive_t *drive = info->drive;
        struct gendisk *g = info->disk;
 
-       if (info->buffer != NULL)
-               kfree(info->buffer);
-       if (info->toc != NULL)
-               kfree(info->toc);
-       if (info->changer_info != NULL)
-               kfree(info->changer_info);
+       kfree(info->buffer);
+       kfree(info->toc);
+       kfree(info->changer_info);
        if (devinfo->handle == drive && unregister_cdrom(devinfo))
                printk(KERN_ERR "%s: %s failed to unregister device from the cdrom "
                                "driver.\n", __FUNCTION__, drive->name);
@@ -3487,12 +3484,9 @@ static int ide_cd_probe(struct device *dev)
        if (ide_cdrom_setup(drive)) {
                struct cdrom_device_info *devinfo = &info->devinfo;
                ide_unregister_subdriver(drive, &ide_cdrom_driver);
-               if (info->buffer != NULL)
-                       kfree(info->buffer);
-               if (info->toc != NULL)
-                       kfree(info->toc);
-               if (info->changer_info != NULL)
-                       kfree(info->changer_info);
+               kfree(info->buffer);
+               kfree(info->toc);
+               kfree(info->changer_info);
                if (devinfo->handle == drive && unregister_cdrom(devinfo))
                        printk (KERN_ERR "%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name);
                kfree(info);
index e6695e5df5bda3a5e4b0a14a2b1b5eff802c4bc6..02167a5b751dbe40a0b1be304766903fceb43c52 100644 (file)
@@ -1315,10 +1315,8 @@ static void drive_release_dev (struct device *dev)
                drive->devfs_name[0] = '\0';
        }
        ide_remove_drive_from_hwgroup(drive);
-       if (drive->id != NULL) {
-               kfree(drive->id);
-               drive->id = NULL;
-       }
+       kfree(drive->id);
+       drive->id = NULL;
        drive->present = 0;
        /* Messed up locking ... */
        spin_unlock_irq(&ide_lock);
index 9c3b4f6156214b0127039cea75bbd0b4b9205da7..7ec18fa3b5ff8f8f6d0e8fc8ae7eda36a2186afe 100644 (file)
@@ -646,10 +646,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
        }
 abort:
        kfree(req_task);
-       if (outbuf != NULL)
-               kfree(outbuf);
-       if (inbuf != NULL)
-               kfree(inbuf);
+       kfree(outbuf);
+       kfree(inbuf);
 
 //     printk("IDE Taskfile ioctl ended. rc = %i\n", err);
 
index 1bbf67882ae5f6e5c88cfd0ff89c5582386990ae..9fe19808d8153853332891595776b7f1e27659ba 100644 (file)
@@ -888,8 +888,7 @@ static int __ide_add_setting(ide_drive_t *drive, const char *name, int rw, int r
        return 0;
 abort:
        up(&ide_setting_sem);
-       if (setting)
-               kfree(setting);
+       kfree(setting);
        return -1;
 }
 
index 3d8175e5f0544e7cf22e97649049f8e0635cf30f..41d6b4017acb9d24aebdd5aed278b079bf382d85 100644 (file)
@@ -508,8 +508,7 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
        wait_event(mad_agent_priv->wait,
                   !atomic_read(&mad_agent_priv->refcount));
 
-       if (mad_agent_priv->reg_req)
-               kfree(mad_agent_priv->reg_req);
+       kfree(mad_agent_priv->reg_req);
        ib_dereg_mr(mad_agent_priv->agent.mr);
        kfree(mad_agent_priv);
 }
@@ -2500,8 +2499,7 @@ error:
 static void destroy_mad_qp(struct ib_mad_qp_info *qp_info)
 {
        ib_destroy_qp(qp_info->qp);
-       if (qp_info->snoop_table)
-               kfree(qp_info->snoop_table);
+       kfree(qp_info->snoop_table);
 }
 
 /*
index 4015a91f4b6e7bcc0a17089f155ebb36233ce16d..948c1cc01bc95ea5291a843b107f86f2e7cf70bd 100644 (file)
@@ -271,8 +271,7 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz
                goto exit;
        }
 
-       if (dev->name)
-               kfree(dev->name);
+       kfree(dev->name);
 
        size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1;
        dev->name = name = kmalloc(size, GFP_KERNEL);
@@ -372,11 +371,8 @@ static int uinput_burn_device(struct uinput_device *udev)
        if (test_bit(UIST_CREATED, &udev->state))
                uinput_destroy_device(udev);
 
-       if (udev->dev->name)
-               kfree(udev->dev->name);
-       if (udev->dev->phys)
-               kfree(udev->dev->phys);
-
+       kfree(udev->dev->name);
+       kfree(udev->dev->phys);
        kfree(udev->dev);
        kfree(udev);
 
index 8f02c155fdc0e26693ce5babe3abe1b5e14221be..c0b46bceb5df88709348e4e6e4bdc68ec93499ed 100644 (file)
@@ -857,8 +857,7 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
 static void adbhid_input_unregister(int id)
 {
        input_unregister_device(adbhid[id]->input);
-       if (adbhid[id]->keycode)
-               kfree(adbhid[id]->keycode);
+       kfree(adbhid[id]->keycode);
        kfree(adbhid[id]);
        adbhid[id] = NULL;
 }
index 4ff67e7363d95436de496a044ce2e076bddefb7a..e954b8354fef74f3e7f8d6a9dabdfef7814a9c95 100644 (file)
@@ -1602,8 +1602,7 @@ static void __devexit wbsd_release_dma(struct wbsd_host* host)
        if (host->dma_addr)
                dma_unmap_single(host->mmc->dev, host->dma_addr, WBSD_DMA_SIZE,
                        DMA_BIDIRECTIONAL);
-       if (host->dma_buffer)
-               kfree(host->dma_buffer);
+       kfree(host->dma_buffer);
        if (host->dma >= 0)
                free_dma(host->dma);
 
index 6e6f42d01e64847cc626ca974e01f58f15d755f5..4b48b31ec235ae16457ccc0b31678f502db8d493 100644 (file)
@@ -78,17 +78,15 @@ static void parse_data(struct parport *port, int device, char *str)
                                u++;
                        }
                        if (!strcmp(p, "MFG") || !strcmp(p, "MANUFACTURER")) {
-                               if (info->mfr)
-                                       kfree (info->mfr);
+                               kfree(info->mfr);
                                info->mfr = kstrdup(sep, GFP_KERNEL);
                        } else if (!strcmp(p, "MDL") || !strcmp(p, "MODEL")) {
-                               if (info->model)
-                                       kfree (info->model);
+                               kfree(info->model);
                                info->model = kstrdup(sep, GFP_KERNEL);
                        } else if (!strcmp(p, "CLS") || !strcmp(p, "CLASS")) {
                                int i;
-                               if (info->class_name)
-                                       kfree (info->class_name);
+
+                               kfree(info->class_name);
                                info->class_name = kstrdup(sep, GFP_KERNEL);
                                for (u = sep; *u; u++)
                                        *u = toupper(*u);
@@ -102,21 +100,22 @@ static void parse_data(struct parport *port, int device, char *str)
                                info->class = PARPORT_CLASS_OTHER;
                        } else if (!strcmp(p, "CMD") ||
                                   !strcmp(p, "COMMAND SET")) {
-                               if (info->cmdset)
-                                       kfree (info->cmdset);
+                               kfree(info->cmdset);
                                info->cmdset = kstrdup(sep, GFP_KERNEL);
                                /* if it speaks printer language, it's
                                   probably a printer */
                                if (strstr(sep, "PJL") || strstr(sep, "PCL"))
                                        guessed_class = PARPORT_CLASS_PRINTER;
                        } else if (!strcmp(p, "DES") || !strcmp(p, "DESCRIPTION")) {
-                               if (info->description)
-                                       kfree (info->description);
+                               kfree(info->description);
                                info->description = kstrdup(sep, GFP_KERNEL);
                        }
                }
        rock_on:
-               if (q) p = q+1; else p=NULL;
+               if (q)
+                       p = q + 1;
+               else
+                       p = NULL;
        }
 
        /* If the device didn't tell us its class, maybe we have managed to
index ae7becf7efa5a5b45fef251003c230ce945530ad..9cb3ab156b09c40d82477b23f2de41a15e5d3f42 100644 (file)
@@ -202,16 +202,11 @@ static void free_port (struct parport *port)
        list_del(&port->full_list);
        spin_unlock(&full_list_lock);
        for (d = 0; d < 5; d++) {
-               if (port->probe_info[d].class_name)
-                       kfree (port->probe_info[d].class_name);
-               if (port->probe_info[d].mfr)
-                       kfree (port->probe_info[d].mfr);
-               if (port->probe_info[d].model)
-                       kfree (port->probe_info[d].model);
-               if (port->probe_info[d].cmdset)
-                       kfree (port->probe_info[d].cmdset);
-               if (port->probe_info[d].description)
-                       kfree (port->probe_info[d].description);
+               kfree(port->probe_info[d].class_name);
+               kfree(port->probe_info[d].mfr);
+               kfree(port->probe_info[d].model);
+               kfree(port->probe_info[d].cmdset);
+               kfree(port->probe_info[d].description);
        }
 
        kfree(port->name);
@@ -618,9 +613,9 @@ parport_register_device(struct parport *port, const char *name,
        return tmp;
 
  out_free_all:
-       kfree (tmp->state);
+       kfree(tmp->state);
  out_free_pardevice:
-       kfree (tmp);
+       kfree(tmp);
  out:
        parport_put_port (port);
        module_put(port->ops->owner);
index 93e39c4096a927bf8b6737b298f875b1ebf2583a..00b81a7bdd266a9513a6c39506236bb52c1c3622 100644 (file)
@@ -259,8 +259,7 @@ static int PCI_GetBusDevHelper(struct controller *ctrl, u8 *bus_num, u8 *dev_num
               sizeof(struct irq_routing_table)) / sizeof(struct irq_info);
        // Make sure I got at least one entry
        if (len == 0) {
-               if (PCIIRQRoutingInfoLength != NULL)
-                       kfree(PCIIRQRoutingInfoLength );
+               kfree(PCIIRQRoutingInfoLength );
                return -1;
        }
 
@@ -275,8 +274,7 @@ static int PCI_GetBusDevHelper(struct controller *ctrl, u8 *bus_num, u8 *dev_num
                        ctrl->pci_bus->number = tbus;
                        pci_bus_read_config_dword (ctrl->pci_bus, *dev_num, PCI_VENDOR_ID, &work);
                        if (!nobridge || (work == 0xffffffff)) {
-                               if (PCIIRQRoutingInfoLength != NULL)
-                                       kfree(PCIIRQRoutingInfoLength );
+                               kfree(PCIIRQRoutingInfoLength );
                                return 0;
                        }
 
@@ -289,20 +287,17 @@ static int PCI_GetBusDevHelper(struct controller *ctrl, u8 *bus_num, u8 *dev_num
                                dbg("Scan bus for Non Bridge: bus %d\n", tbus);
                                if (PCI_ScanBusForNonBridge(ctrl, tbus, dev_num) == 0) {
                                        *bus_num = tbus;
-                                       if (PCIIRQRoutingInfoLength != NULL)
-                                               kfree(PCIIRQRoutingInfoLength );
+                                       kfree(PCIIRQRoutingInfoLength );
                                        return 0;
                                }
                        } else {
-                               if (PCIIRQRoutingInfoLength != NULL)
-                                       kfree(PCIIRQRoutingInfoLength );
+                               kfree(PCIIRQRoutingInfoLength );
                                return 0;
                        }
 
                }
        }
-       if (PCIIRQRoutingInfoLength != NULL)
-               kfree(PCIIRQRoutingInfoLength );
+       kfree(PCIIRQRoutingInfoLength );
        return -1;
 }
 
index 3afb682255a04d112dfa1a34f5bc4aac4d4e4b5f..2dc3e611a9a3473fbbb2a715db4de58d270a3f63 100644 (file)
@@ -334,10 +334,8 @@ void destroy_cis_cache(struct pcmcia_socket *s)
        /*
         * If there was a fake CIS, destroy that as well.
         */
-       if (s->fake_cis) {
-               kfree(s->fake_cis);
-               s->fake_cis = NULL;
-       }
+       kfree(s->fake_cis);
+       s->fake_cis = NULL;
 }
 EXPORT_SYMBOL(destroy_cis_cache);
 
@@ -386,10 +384,8 @@ int verify_cis_cache(struct pcmcia_socket *s)
 
 int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis)
 {
-    if (s->fake_cis != NULL) {
-       kfree(s->fake_cis);
-       s->fake_cis = NULL;
-    }
+    kfree(s->fake_cis);
+    s->fake_cis = NULL;
     if (cis->Length > CISTPL_MAX_CIS_SIZE)
        return CS_BAD_SIZE;
     s->fake_cis = kmalloc(cis->Length, GFP_KERNEL);
index d5e76423a0ee89b15a3888e0b411f688e49b05fb..234cdca6fe137e8967fbe43bf6c71557a84c434b 100644 (file)
@@ -331,10 +331,8 @@ static void shutdown_socket(struct pcmcia_socket *s)
        cb_free(s);
 #endif
        s->functions = 0;
-       if (s->config) {
-               kfree(s->config);
-               s->config = NULL;
-       }
+       kfree(s->config);
+       s->config = NULL;
 
        {
                int status;
index b0cc3c2588fdd44074cf6ae873c920489b0a111f..ba56762b05f676e69d803234bdc545bedcd5c04a 100644 (file)
@@ -1125,10 +1125,9 @@ out_deregister:
        misc_deregister(&envctrl_dev);
 out_iounmap:
        iounmap(i2c);
-       for (i = 0; i < ENVCTRL_MAX_CPU * 2; i++) {
-               if (i2c_childlist[i].tables)
-                       kfree(i2c_childlist[i].tables);
-       }
+       for (i = 0; i < ENVCTRL_MAX_CPU * 2; i++)
+               kfree(i2c_childlist[i].tables);
+
        return err;
 }
 
@@ -1141,10 +1140,8 @@ static void __exit envctrl_cleanup(void)
        iounmap(i2c);
        misc_deregister(&envctrl_dev);
 
-       for (i = 0; i < ENVCTRL_MAX_CPU * 2; i++) {
-               if (i2c_childlist[i].tables)
-                       kfree(i2c_childlist[i].tables);
-       }
+       for (i = 0; i < ENVCTRL_MAX_CPU * 2; i++)
+               kfree(i2c_childlist[i].tables);
 }
 
 module_init(envctrl_init);
index 1d148c5a5a4b7914f3b462f91034dce88c2781e7..c0c974b1afaa0285fd1cc753affc90f71c96e6f0 100644 (file)
@@ -2057,8 +2057,7 @@ static void i810fb_release_resource(struct fb_info *info,
                iounmap(par->mmio_start_virtual);
        if (par->aperture.virtual)
                iounmap(par->aperture.virtual);
-       if (par->edid)
-               kfree(par->edid);
+       kfree(par->edid);
        if (par->res_flags & FRAMEBUFFER_REQ)
                release_mem_region(par->aperture.physical,
                                   par->aperture.size);
index 279e0e0363d6afb7e7326da42381d6c36c5e37f4..1e3d98aac12dbc788b458a6adbb8e2bf70139889 100644 (file)
@@ -299,10 +299,8 @@ static int w1_f23_add_slave(struct w1_slave *sl)
 static void w1_f23_remove_slave(struct w1_slave *sl)
 {
 #ifdef CONFIG_W1_F23_CRC
-       if (sl->family_data) {
-               kfree(sl->family_data);
-               sl->family_data = NULL;
-       }
+       kfree(sl->family_data);
+       sl->family_data = NULL;
 #endif /* CONFIG_W1_F23_CRC */
        sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr);
 }