Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6044ec88 authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds
Browse files

[PATCH] kfree cleanup: misc remaining drivers



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: default avatarJesper Juhl <jesper.juhl@gmail.com>
Acked-by: default avatarAristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
Acked-by: default avatarRoland Dreier <rolandd@cisco.com>
Acked-by: default avatarPierre Ossman <drzeus@drzeus.cx>
Acked-by: default avatarJean Delvare <khali@linux-fr.org>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Acked-by: default avatarLen Brown <len.brown@intel.com>
Acked-by: default avatar"Antonino A. Daplas" <adaplas@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2ea75330
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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)
	pc = (struct acpi_container *)acpi_driver_data(device);
	kfree(pc);

	return status;
}

+2 −4
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ 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);
}
@@ -1117,7 +1116,6 @@ 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);
	}
+4 −8
Original line number Diff line number Diff line
@@ -334,7 +334,6 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
	return_VALUE(0);

      err:
	if (buffer.pointer)
	kfree(buffer.pointer);

	return_VALUE(status);
@@ -1488,7 +1487,6 @@ 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);

	video->attached_array = active_device_list;
@@ -1645,7 +1643,6 @@ 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);
@@ -1831,7 +1828,6 @@ 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);

+11 −20
Original line number Diff line number Diff line
@@ -417,13 +417,11 @@ 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;
      }
      Controller->Commands[i] = NULL;
    }
  if (CommandGroup != NULL)
  kfree(CommandGroup);

  if (Controller->CombinedStatusBuffer != NULL)
@@ -435,32 +433,25 @@ 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;
    }
}
}


/*
+4 −8
Original line number Diff line number Diff line
@@ -1096,13 +1096,10 @@ 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);
		}
		if (buff_size)
		kfree(buff_size);
		if (ioc)
		kfree(ioc);
		return(status);
	}
@@ -3034,7 +3031,6 @@ 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);
	if(hba[i]->cmd_pool)
		pci_free_consistent(hba[i]->pdev,
Loading