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

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

media: drivers: Adjust checks for null pointers



The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarHans Verkuil <hansverk@cisco.com>
parent 2d3da59f
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -749,7 +749,7 @@ static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev,
		void *buffer, size_t size, struct completion *completion) {
	int rc;

	if (completion == NULL)
	if (!completion)
		return -EINVAL;
	init_completion(completion);

@@ -1151,8 +1151,8 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
	}
	pr_debug("Firmware name: %s\n", fw_filename);

	if (loadfirmware_handler == NULL && !(coredev->device_flags
			& SMS_DEVICE_FAMILY2))
	if (!loadfirmware_handler &&
	    !(coredev->device_flags & SMS_DEVICE_FAMILY2))
		return -EINVAL;

	rc = request_firmware(&fw, fw_filename, coredev->device);
@@ -1789,7 +1789,7 @@ int smsclient_sendrequest(struct smscore_client_t *client,
	struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) buffer;
	int rc;

	if (client == NULL) {
	if (!client) {
		pr_err("Got NULL client\n");
		return -EINVAL;
	}
@@ -1797,7 +1797,7 @@ int smsclient_sendrequest(struct smscore_client_t *client,
	coredev = client->coredev;

	/* check that no other channel with same id exists */
	if (coredev == NULL) {
	if (!coredev) {
		pr_err("Got NULL coredev\n");
		return -EINVAL;
	}
@@ -1954,7 +1954,7 @@ int smscore_gpio_configure(struct smscore_device_t *coredev, u8 pin_num,
	if (pin_num > MAX_GPIO_PIN_NUMBER)
		return -EINVAL;

	if (p_gpio_config == NULL)
	if (!p_gpio_config)
		return -EINVAL;

	total_len = sizeof(struct sms_msg_hdr) + (sizeof(u32) * 6);
+3 −3
Original line number Diff line number Diff line
@@ -328,7 +328,7 @@ static int WriteTable(struct drxd_state *state, u8 * pTable)
{
	int status = 0;

	if (pTable == NULL)
	if (!pTable)
		return 0;

	while (!status) {
@@ -909,7 +909,7 @@ static int load_firmware(struct drxd_state *state, const char *fw_name)
	}

	state->microcode = kmemdup(fw->data, fw->size, GFP_KERNEL);
	if (state->microcode == NULL) {
	if (!state->microcode) {
		release_firmware(fw);
		return -ENOMEM;
	}
@@ -2629,7 +2629,7 @@ static int DRXD_init(struct drxd_state *state, const u8 *fw, u32 fw_size)
			break;

		/* Apply I2c address patch to B1 */
		if (!state->type_A && state->m_HiI2cPatch != NULL) {
		if (!state->type_A && state->m_HiI2cPatch) {
			status = WriteTable(state, state->m_HiI2cPatch);
			if (status < 0)
				break;
+3 −3
Original line number Diff line number Diff line
@@ -357,14 +357,14 @@ static int sp2_exit(struct i2c_client *client)

	dev_dbg(&client->dev, "\n");

	if (client == NULL)
	if (!client)
		return 0;

	s = i2c_get_clientdata(client);
	if (s == NULL)
	if (!s)
		return 0;

	if (s->ca.data == NULL)
	if (!s->ca.data)
		return 0;

	dvb_ca_en50221_release(&s->ca);
+3 −3
Original line number Diff line number Diff line
@@ -1948,7 +1948,7 @@ static int adv76xx_set_format(struct v4l2_subdev *sd,
		return -EINVAL;

	info = adv76xx_format_info(state, format->format.code);
	if (info == NULL)
	if (!info)
		info = adv76xx_format_info(state, MEDIA_BUS_FMT_YUYV8_2X8);

	adv76xx_fill_format(state, &format->format);
@@ -2256,7 +2256,7 @@ static int adv76xx_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
		return 0;
	}

	if (data == NULL)
	if (!data)
		return -ENODATA;

	if (edid->start_block >= state->edid.blocks)
@@ -3480,7 +3480,7 @@ static int adv76xx_probe(struct i2c_client *client,
		state->i2c_clients[i] =
			adv76xx_dummy_client(sd, state->pdata.i2c_addresses[i],
					     0xf2 + i);
		if (state->i2c_clients[i] == NULL) {
		if (!state->i2c_clients[i]) {
			err = -ENOMEM;
			v4l2_err(sd, "failed to create i2c client %u\n", i);
			goto err_i2c;
+10 −10
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ static void request_module_async(struct work_struct *work)
	request_module("cx18-alsa");

	/* Initialize cx18-alsa for this instance of the cx18 device */
	if (cx18_ext_init != NULL)
	if (cx18_ext_init)
		cx18_ext_init(dev);
}

@@ -291,11 +291,11 @@ int cx18_msleep_timeout(unsigned int msecs, int intr)
/* Release ioremapped memory */
static void cx18_iounmap(struct cx18 *cx)
{
	if (cx == NULL)
	if (!cx)
		return;

	/* Release io memory */
	if (cx->enc_mem != NULL) {
	if (cx->enc_mem) {
		CX18_DEBUG_INFO("releasing enc_mem\n");
		iounmap(cx->enc_mem);
		cx->enc_mem = NULL;
@@ -649,15 +649,15 @@ static void cx18_process_options(struct cx18 *cx)
		CX18_INFO("User specified %s card\n", cx->card->name);
	else if (cx->options.cardtype != 0)
		CX18_ERR("Unknown user specified type, trying to autodetect card\n");
	if (cx->card == NULL) {
	if (!cx->card) {
		if (cx->pci_dev->subsystem_vendor == CX18_PCI_ID_HAUPPAUGE) {
			cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
			CX18_INFO("Autodetected Hauppauge card\n");
		}
	}
	if (cx->card == NULL) {
	if (!cx->card) {
		for (i = 0; (cx->card = cx18_get_card(i)); i++) {
			if (cx->card->pci_list == NULL)
			if (!cx->card->pci_list)
				continue;
			for (j = 0; cx->card->pci_list[j].device; j++) {
				if (cx->pci_dev->device !=
@@ -676,7 +676,7 @@ static void cx18_process_options(struct cx18 *cx)
	}
done:

	if (cx->card == NULL) {
	if (!cx->card) {
		cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
		CX18_ERR("Unknown card: vendor/device: [%04x:%04x]\n",
			 cx->pci_dev->vendor, cx->pci_dev->device);
@@ -698,7 +698,7 @@ static int cx18_create_in_workq(struct cx18 *cx)
	snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
		 cx->v4l2_dev.name);
	cx->in_work_queue = alloc_ordered_workqueue("%s", 0, cx->in_workq_name);
	if (cx->in_work_queue == NULL) {
	if (!cx->in_work_queue) {
		CX18_ERR("Unable to create incoming mailbox handler thread\n");
		return -ENOMEM;
	}
@@ -1254,7 +1254,7 @@ static void cx18_cancel_out_work_orders(struct cx18 *cx)
{
	int i;
	for (i = 0; i < CX18_MAX_STREAMS; i++)
		if (&cx->streams[i].video_dev != NULL)
		if (&cx->streams[i].video_dev)
			cancel_work_sync(&cx->streams[i].out_work_order);
}

@@ -1299,7 +1299,7 @@ static void cx18_remove(struct pci_dev *pci_dev)

	pci_disable_device(cx->pci_dev);

	if (cx->vbi.sliced_mpeg_data[0] != NULL)
	if (cx->vbi.sliced_mpeg_data[0])
		for (i = 0; i < CX18_VBI_FRAMES; i++)
			kfree(cx->vbi.sliced_mpeg_data[i]);

Loading