linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org,
	Arvind Yadav <arvind.yadav.cs@gmail.com>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/8] [media] ttusb_dec: Adjust five checks for null pointers
Date: Thu, 14 Sep 2017 12:32:36 +0200	[thread overview]
Message-ID: <4cd3254b-abc3-2145-e693-c454a13d1a2a@users.sourceforge.net> (raw)
In-Reply-To: <66b087d3-6dd3-1e1c-d33d-e34c9e2ffe25@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 13 Sep 2017 18:22:35 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/usb/ttusb-dec/ttusb_dec.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c
index 0bc80daf6e2e..901cb221aad2 100644
--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
@@ -406,15 +406,15 @@ static int ttusb_dec_get_stb_state (struct ttusb_dec *dec, unsigned int *mode,
 		return result;
 
 	if (c_length >= 0x0c) {
-		if (mode != NULL) {
+		if (mode) {
 			memcpy(&tmp, c, 4);
 			*mode = ntohl(tmp);
 		}
-		if (model != NULL) {
+		if (model) {
 			memcpy(&tmp, &c[4], 4);
 			*model = ntohl(tmp);
 		}
-		if (version != NULL) {
+		if (version) {
 			memcpy(&tmp, &c[8], 4);
 			*version = ntohl(tmp);
 		}
@@ -1393,7 +1393,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
 	j = 0;
 
 	b = kmalloc(ARM_PACKET_SIZE, GFP_KERNEL);
-	if (b == NULL) {
+	if (!b) {
 		release_firmware(fw_entry);
 		return -ENOMEM;
 	}
@@ -1703,18 +1703,17 @@ static int ttusb_dec_probe(struct usb_interface *intf,
 		break;
 	}
 
-	if (dec->fe == NULL) {
+	if (!dec->fe)
 		printk("dvb-ttusb-dec: A frontend driver was not found for device [%04x:%04x]\n",
 		       le16_to_cpu(dec->udev->descriptor.idVendor),
 		       le16_to_cpu(dec->udev->descriptor.idProduct));
-	} else {
+	else
 		if (dvb_register_frontend(&dec->adapter, dec->fe)) {
 			printk("budget-ci: Frontend registration failed!\n");
 			if (dec->fe->ops.release)
 				dec->fe->ops.release(dec->fe);
 			dec->fe = NULL;
 		}
-	}
 
 	ttusb_dec_init_v_pes(dec);
 	ttusb_dec_init_filters(dec);
-- 
2.14.1

  parent reply	other threads:[~2017-09-14 10:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 10:30 [PATCH 0/8] [media] ttusb_dec: Fine-tuning for some function implementations SF Markus Elfring
2017-09-14 10:31 ` [PATCH 1/8] [media] ttusb_dec: Use common error handling code in ttusb_dec_init_dvb() SF Markus Elfring
2017-09-14 10:32 ` SF Markus Elfring [this message]
2017-09-14 10:33 ` [PATCH 3/8] [media] ttusb_dec: Improve a size determination in three functions SF Markus Elfring
2017-09-14 10:34 ` [PATCH 4/8] [media] ttusb_dec: Delete an error message for a failed memory allocation in ttusb_dec_probe() SF Markus Elfring
2017-09-14 10:35 ` [PATCH 5/8] [media] ttusb_dec: Move an assignment " SF Markus Elfring
2017-09-14 10:36 ` [PATCH 6/8] [media] ttusb_dec: Reduce the scope for three variables in ttusb_dec_process_urb() SF Markus Elfring
2017-09-14 10:37 ` [PATCH 7/8] [media] ttusb_dec: Add spaces for better code readability SF Markus Elfring
2017-09-14 10:38 ` [PATCH 8/8] [media] ttusb_dec: Delete four unwanted spaces SF Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4cd3254b-abc3-2145-e693-c454a13d1a2a@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=hans.verkuil@cisco.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).