[PATCH 2/8] [media] ttusb_dec: Adjust five checks for null pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux