patch-2.4.0-test2 linux/drivers/char/agp/agpgart_fe.c

Next file: linux/drivers/char/amigamouse.c
Previous file: linux/drivers/char/agp/agpgart_be.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test1/linux/drivers/char/agp/agpgart_fe.c linux/drivers/char/agp/agpgart_fe.c
@@ -687,7 +687,6 @@
 	}
 	agp_remove_file_private(priv);
 	kfree(priv);
-	MOD_DEC_USE_COUNT;
 	AGP_UNLOCK();
 	return 0;
 }
@@ -697,19 +696,17 @@
 	int minor = MINOR(inode->i_rdev);
 	agp_file_private *priv;
 	agp_client *client;
+	int rc = -ENXIO;
 
 	AGP_LOCK();
 
-	if (minor != AGPGART_MINOR) {
-		AGP_UNLOCK();
-		return -ENXIO;
-	}
+	if (minor != AGPGART_MINOR)
+		goto err_out;
+
 	priv = kmalloc(sizeof(agp_file_private), GFP_KERNEL);
+	if (priv == NULL)
+		goto err_out_nomem;
 
-	if (priv == NULL) {
-		AGP_UNLOCK();
-		return -ENOMEM;
-	}
 	memset(priv, 0, sizeof(agp_file_private));
 	set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags);
 	priv->my_pid = current->pid;
@@ -726,9 +723,14 @@
 	}
 	file->private_data = (void *) priv;
 	agp_insert_file_private(priv);
-	MOD_INC_USE_COUNT;
 	AGP_UNLOCK();
 	return 0;
+
+err_out_nomem:
+	rc = -ENOMEM;
+err_out:
+	AGP_UNLOCK();
+	return rc;
 }
 
 
@@ -1059,6 +1061,7 @@
 
 static struct file_operations agp_fops =
 {
+	owner:		THIS_MODULE,
 	llseek:		agp_lseek,
 	read:		agp_read,
 	write:		agp_write,

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)