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

Commit 10c642d0 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

USB: serial: remove redundant OOM messages



Remove redundant error messages on allocation failures, which have
already been logged.

Cc: Joe Perches <joe@perches.com>
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4d5147ec
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -384,10 +384,8 @@ static void ch341_break_ctl(struct tty_struct *tty, int break_state)
	uint8_t *break_reg;

	break_reg = kmalloc(2, GFP_KERNEL);
	if (!break_reg) {
		dev_err(&port->dev, "%s - kmalloc failed\n", __func__);
	if (!break_reg)
		return;
	}

	r = ch341_control_in(port->serial->dev, CH341_REQ_READ_REG,
			ch341_break_reg, 0, break_reg, 2);
+0 −2
Original line number Diff line number Diff line
@@ -135,7 +135,6 @@ static int usb_console_setup(struct console *co, char *options)
			tty = kzalloc(sizeof(*tty), GFP_KERNEL);
			if (!tty) {
				retval = -ENOMEM;
				dev_err(&port->dev, "no more memory\n");
				goto reset_open_count;
			}
			kref_init(&tty->kref);
@@ -144,7 +143,6 @@ static int usb_console_setup(struct console *co, char *options)
			tty->index = co->index;
			if (tty_init_termios(tty)) {
				retval = -ENOMEM;
				dev_err(&port->dev, "no more memory\n");
				goto free_tty;
			}
		}
+2 −6
Original line number Diff line number Diff line
@@ -305,10 +305,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
	length = (((size - 1) | 3) + 1) / 4;

	buf = kcalloc(length, sizeof(__le32), GFP_KERNEL);
	if (!buf) {
		dev_err(&port->dev, "%s - out of memory.\n", __func__);
	if (!buf)
		return -ENOMEM;
	}

	/* Issue the request, attempting to read 'size' bytes */
	result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
@@ -352,10 +350,8 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
	length = (((size - 1) | 3) + 1) / 4;

	buf = kmalloc(length * sizeof(__le32), GFP_KERNEL);
	if (!buf) {
		dev_err(&port->dev, "%s - out of memory.\n", __func__);
	if (!buf)
		return -ENOMEM;
	}

	/* Array of integers into bytes */
	for (i = 0; i < length; i++)
+1 −4
Original line number Diff line number Diff line
@@ -1695,11 +1695,8 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)


	priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL);
	if (!priv) {
		dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__,
					sizeof(struct ftdi_private));
	if (!priv)
		return -ENOMEM;
	}

	mutex_init(&priv->cfg_lock);

+5 −10
Original line number Diff line number Diff line
@@ -279,10 +279,9 @@ static int pkt_add(struct garmin_data *garmin_data_p,
	if (data_length) {
		pkt = kmalloc(sizeof(struct garmin_packet)+data_length,
								GFP_ATOMIC);
		if (pkt == NULL) {
			dev_err(&garmin_data_p->port->dev, "out of memory\n");
		if (!pkt)
			return 0;
		}

		pkt->size = data_length;
		memcpy(pkt->data, data, data_length);

@@ -1006,14 +1005,11 @@ static int garmin_write_bulk(struct usb_serial_port *port,
	spin_unlock_irqrestore(&garmin_data_p->lock, flags);

	buffer = kmalloc(count, GFP_ATOMIC);
	if (!buffer) {
		dev_err(&port->dev, "out of memory\n");
	if (!buffer)
		return -ENOMEM;
	}

	urb = usb_alloc_urb(0, GFP_ATOMIC);
	if (!urb) {
		dev_err(&port->dev, "no more free urbs\n");
		kfree(buffer);
		return -ENOMEM;
	}
@@ -1393,10 +1389,9 @@ static int garmin_port_probe(struct usb_serial_port *port)
	struct garmin_data *garmin_data_p;

	garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL);
	if (garmin_data_p == NULL) {
		dev_err(&port->dev, "%s - Out of memory\n", __func__);
	if (!garmin_data_p)
		return -ENOMEM;
	}

	init_timer(&garmin_data_p->timer);
	spin_lock_init(&garmin_data_p->lock);
	INIT_LIST_HEAD(&garmin_data_p->pktlist);
Loading