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

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

[PATCH] vfree and kfree cleanup in drivers/



This patch does a full cleanup of 'NULL checks before vfree', and a partial
cleanup of calls to kfree for all of drivers/ - the kfree bit is partial in
that I only did the files that also had vfree calls in them.  The patch
also gets rid of some redundant (void *) casts of pointers being passed to
[vk]free, and a some tiny whitespace corrections also crept in.

Signed-off-by: default avatarJesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 887c27f3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -4216,7 +4216,8 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd,
		
	case CDROMAUDIOBUFSIZ: /* configure the audio buffer size */
		msg(DBG_IOC,"ioctl: CDROMAUDIOBUFSIZ entered.\n");
		if (current_drive->sbp_audsiz>0) vfree(current_drive->aud_buf);
		if (current_drive->sbp_audsiz>0)
			vfree(current_drive->aud_buf);
		current_drive->aud_buf=NULL;
		current_drive->sbp_audsiz=arg;
		
@@ -5910,7 +5911,8 @@ static void sbpcd_exit(void)
		put_disk(D_S[j].disk);
		devfs_remove("sbp/c0t%d", j);
		vfree(D_S[j].sbp_buf);
		if (D_S[j].sbp_audsiz>0) vfree(D_S[j].aud_buf);
		if (D_S[j].sbp_audsiz>0)
			vfree(D_S[j].aud_buf);
		if ((unregister_cdrom(D_S[j].sbpcd_infop) == -EINVAL))
		{
			msg(DBG_INF, "What's that: can't unregister info %s.\n", major_name);
+3 −4
Original line number Diff line number Diff line
@@ -206,10 +206,9 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge)
		bridge->driver->cleanup();
	if (bridge->driver->free_gatt_table)
		bridge->driver->free_gatt_table(bridge);
	if (bridge->key_list) {

	vfree(bridge->key_list);
	bridge->key_list = NULL;
	}

	if (bridge->driver->agp_destroy_page &&
	    bridge->driver->needs_scratch_page)
+5 −9
Original line number Diff line number Diff line
@@ -283,18 +283,14 @@ static void bsd_free (void *state)
		/*
		 * Release the dictionary
		 */
		if (db->dict) {
		vfree(db->dict);
		db->dict = NULL;
		}

		/*
		 * Release the string buffer
		 */
		if (db->lens) {
		vfree(db->lens);
		db->lens = NULL;
		}

		/*
		 * Finally release the structure itself.
+2 −1
Original line number Diff line number Diff line
@@ -1953,7 +1953,8 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
		kfree(d->rcvcount);
	if (!(d->rcvcount = kmalloc(sizeof(int) * m, GFP_ATOMIC))) {
		printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n");
		if (!adding) kfree(d->rcverr);
		if (!adding)
			kfree(d->rcverr);
		return -1;
	}
	memset((char *) d->rcvcount, 0, sizeof(int) * m);
+3 −6
Original line number Diff line number Diff line
@@ -568,12 +568,9 @@ int dm_create_persistent(struct exception_store *store, uint32_t chunk_size)

      bad:
	dm_io_put(sectors_to_pages(chunk_size));
	if (ps) {
		if (ps->area)
	if (ps && ps->area)
		free_area(ps);

	kfree(ps);
	}
	return r;
}

Loading