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

Commit 8f31bb39 authored by Burman Yan's avatar Burman Yan Committed by Linus Torvalds
Browse files

[PATCH] serial: replace kmalloc+memset with kzalloc

parent 3689a0ec
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -47,11 +47,10 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
	unsigned long bus_addr;
	unsigned int i;

	info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL);
	info = kzalloc(sizeof(struct serial_card_info), GFP_KERNEL);
	if (!info)
		return -ENOMEM;

	memset(info, 0, sizeof(struct serial_card_info));
	info->num_ports = type->num_ports;

	bus_addr = ecard_resource_start(ec, type->type);
+1 −4
Original line number Diff line number Diff line
@@ -1628,7 +1628,7 @@ pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
			nr_ports = rc;
	}

	priv = kmalloc(sizeof(struct serial_private) +
	priv = kzalloc(sizeof(struct serial_private) +
		       sizeof(unsigned int) * nr_ports,
		       GFP_KERNEL);
	if (!priv) {
@@ -1636,9 +1636,6 @@ pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
		goto err_deinit;
	}

	memset(priv, 0, sizeof(struct serial_private) +
			sizeof(unsigned int) * nr_ports);

	priv->dev = dev;
	priv->quirk = quirk;

+1 −3
Original line number Diff line number Diff line
@@ -1417,14 +1417,12 @@ static int __devinit icom_alloc_adapter(struct icom_adapter
	struct list_head *tmp;

	icom_adapter = (struct icom_adapter *)
	    kmalloc(sizeof(struct icom_adapter), GFP_KERNEL);
	    kzalloc(sizeof(struct icom_adapter), GFP_KERNEL);

	if (!icom_adapter) {
		return -ENOMEM;
	}

	memset(icom_adapter, 0, sizeof(struct icom_adapter));

	list_for_each(tmp, &icom_adapter_head) {
		cur_adapter_entry =
		    list_entry(tmp, struct icom_adapter,
+2 −4
Original line number Diff line number Diff line
@@ -2019,13 +2019,12 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)

	DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, is, idd));

	card_ptr = kmalloc(sizeof(struct ioc3_card), GFP_KERNEL);
	card_ptr = kzalloc(sizeof(struct ioc3_card), GFP_KERNEL);
	if (!card_ptr) {
		printk(KERN_WARNING "ioc3_attach_one"
		       ": unable to get memory for the IOC3\n");
		return -ENOMEM;
	}
	memset(card_ptr, 0, sizeof(struct ioc3_card));
	idd->data[is->id] = card_ptr;
	Submodule_slot = is->id;

@@ -2040,13 +2039,12 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)

	/* Create port structures for each port */
	for (phys_port = 0; phys_port < PORTS_PER_CARD; phys_port++) {
		port = kmalloc(sizeof(struct ioc3_port), GFP_KERNEL);
		port = kzalloc(sizeof(struct ioc3_port), GFP_KERNEL);
		if (!port) {
			printk(KERN_WARNING
			       "IOC3 serial memory not available for port\n");
			goto out4;
		}
		memset(port, 0, sizeof(struct ioc3_port));
		spin_lock_init(&port->ip_lock);

		/* we need to remember the previous ones, to point back to
+3 −6
Original line number Diff line number Diff line
@@ -1076,13 +1076,12 @@ static int inline ioc4_attach_local(struct ioc4_driver_data *idd)
	/* Create port structures for each port */
	for (port_number = 0; port_number < IOC4_NUM_SERIAL_PORTS;
							port_number++) {
		port = kmalloc(sizeof(struct ioc4_port), GFP_KERNEL);
		port = kzalloc(sizeof(struct ioc4_port), GFP_KERNEL);
		if (!port) {
			printk(KERN_WARNING
				"IOC4 serial memory not available for port\n");
			return -ENOMEM;
		}
		memset(port, 0, sizeof(struct ioc4_port));
		spin_lock_init(&port->ip_lock);

		/* we need to remember the previous ones, to point back to
@@ -2811,7 +2810,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
				(void *)serial));

	/* Get memory for the new card */
	control = kmalloc(sizeof(struct ioc4_control), GFP_KERNEL);
	control = kzalloc(sizeof(struct ioc4_control), GFP_KERNEL);

	if (!control) {
		printk(KERN_WARNING "ioc4_attach_one"
@@ -2819,11 +2818,10 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
		ret = -ENOMEM;
		goto out2;
	}
	memset(control, 0, sizeof(struct ioc4_control));
	idd->idd_serial_data = control;

	/* Allocate the soft structure */
	soft = kmalloc(sizeof(struct ioc4_soft), GFP_KERNEL);
	soft = kzalloc(sizeof(struct ioc4_soft), GFP_KERNEL);
	if (!soft) {
		printk(KERN_WARNING
		       "ioc4 (%p): unable to get memory for the soft struct\n",
@@ -2831,7 +2829,6 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
		ret = -ENOMEM;
		goto out3;
	}
	memset(soft, 0, sizeof(struct ioc4_soft));

	spin_lock_init(&soft->is_ir_lock);
	soft->is_ioc4_misc_addr = idd->idd_misc_regs;
Loading