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

Commit c38e8657 authored by Markus Elfring's avatar Markus Elfring Committed by Mauro Carvalho Chehab
Browse files

media: drivers: delete error messages for failed memory allocation



Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

[mchehab@s-opensource.com: fold several similar patches into one]

Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarHans Verkuil <hansverk@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent a0ec8d1d
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -75,10 +75,8 @@ int cypress_load_firmware(struct usb_device *udev,
	int ret, pos = 0;

	hx = kmalloc(sizeof(struct hexline), GFP_KERNEL);
	if (!hx) {
		dev_err(&udev->dev, "%s: kmalloc() failed\n", KBUILD_MODNAME);
	if (!hx)
		return -ENOMEM;
	}

	/* stop the CPU */
	hx->data[0] = 1;
+4 −9
Original line number Diff line number Diff line
@@ -1301,10 +1301,8 @@ static int smscore_init_device(struct smscore_device_t *coredev, int mode)

	buffer = kmalloc(sizeof(struct sms_msg_data) +
			SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA);
	if (!buffer) {
		pr_err("Could not allocate buffer for init device message.\n");
	if (!buffer)
		return -ENOMEM;
	}

	msg = (struct sms_msg_data *)SMS_ALIGN_ADDRESS(buffer);
	SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_INIT_DEVICE_REQ,
@@ -1687,10 +1685,9 @@ static int smscore_validate_client(struct smscore_device_t *coredev,
		return -EEXIST;
	}
	listentry = kzalloc(sizeof(struct smscore_idlist_t), GFP_KERNEL);
	if (!listentry) {
		pr_err("Can't allocate memory for client id.\n");
	if (!listentry)
		return -ENOMEM;
	}

	listentry->id = id;
	listentry->data_type = data_type;
	list_add_locked(&listentry->entry, &client->idlist,
@@ -1725,10 +1722,8 @@ int smscore_register_client(struct smscore_device_t *coredev,
	}

	newclient = kzalloc(sizeof(struct smscore_client_t), GFP_KERNEL);
	if (!newclient) {
		pr_err("Failed to allocate memory for client.\n");
	if (!newclient)
		return -ENOMEM;
	}

	INIT_LIST_HEAD(&newclient->idlist);
	newclient->coredev = coredev;
+2 −3
Original line number Diff line number Diff line
@@ -456,10 +456,9 @@ struct dvb_frontend *as102_attach(const char *name,
	struct dvb_frontend *fe;

	state = kzalloc(sizeof(struct as102_state), GFP_KERNEL);
	if (state == NULL) {
		pr_err("%s: unable to allocate memory for state\n", __func__);
	if (!state)
		return NULL;
	}

	fe = &state->frontend;
	fe->demodulator_priv = state;
	state->ops = ops;
+2 −3
Original line number Diff line number Diff line
@@ -555,10 +555,9 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
	struct cx24113_state *state =
		kzalloc(sizeof(struct cx24113_state), GFP_KERNEL);
	int rc;
	if (state == NULL) {
		cx_err("Unable to kzalloc\n");

	if (!state)
		goto error;
	}

	/* setup the state */
	state->config = config;
+0 −1
Original line number Diff line number Diff line
@@ -227,7 +227,6 @@ static int cx24116_writeregN(struct cx24116_state *state, int reg,

	buf = kmalloc(len + 1, GFP_KERNEL);
	if (buf == NULL) {
		printk("Unable to kmalloc\n");
		ret = -ENOMEM;
		goto error;
	}
Loading