aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7164
diff options
context:
space:
mode:
authorPeter Huewe <PeterHuewe@gmx.de>2011-01-30 14:33:01 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-21 19:32:19 -0400
commit61ca1500c5ee04f2be34a4f58bb9baed0214b7a9 (patch)
treeef71d383209c305352710cfac4a34fe068886af6 /drivers/media/video/saa7164
parent7ee9e64a3d7379fd443090880158374181f754cf (diff)
[media] video/saa7164: Fix sparse warning: Using plain integer as NULL pointer
This patch fixes the warning "Using plain integer as NULL pointer", generated by sparse, by replacing if (var == 0) with if (!var) after an allocation and all other offending 0s with NULL. KernelVersion: linus' tree-1f0324c Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7164')
-rw-r--r--drivers/media/video/saa7164/saa7164-api.c10
-rw-r--r--drivers/media/video/saa7164/saa7164-buffer.c16
-rw-r--r--drivers/media/video/saa7164/saa7164-bus.c8
-rw-r--r--drivers/media/video/saa7164/saa7164-cmd.c10
-rw-r--r--drivers/media/video/saa7164/saa7164-core.c8
-rw-r--r--drivers/media/video/saa7164/saa7164-dvb.c4
-rw-r--r--drivers/media/video/saa7164/saa7164-encoder.c8
-rw-r--r--drivers/media/video/saa7164/saa7164-fw.c2
-rw-r--r--drivers/media/video/saa7164/saa7164-vbi.c8
9 files changed, 37 insertions, 37 deletions
diff --git a/drivers/media/video/saa7164/saa7164-api.c b/drivers/media/video/saa7164/saa7164-api.c
index bd86d970f4c2..8a98ab68239e 100644
--- a/drivers/media/video/saa7164/saa7164-api.c
+++ b/drivers/media/video/saa7164/saa7164-api.c
@@ -743,7 +743,7 @@ int saa7164_api_configure_dif(struct saa7164_port *port, u32 std)
743int saa7164_api_initialize_dif(struct saa7164_port *port) 743int saa7164_api_initialize_dif(struct saa7164_port *port)
744{ 744{
745 struct saa7164_dev *dev = port->dev; 745 struct saa7164_dev *dev = port->dev;
746 struct saa7164_port *p = 0; 746 struct saa7164_port *p = NULL;
747 int ret = -EINVAL; 747 int ret = -EINVAL;
748 u32 std = 0; 748 u32 std = 0;
749 749
@@ -926,9 +926,9 @@ int saa7164_api_configure_port_mpeg2ps(struct saa7164_dev *dev,
926 926
927int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len) 927int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
928{ 928{
929 struct saa7164_port *tsport = 0; 929 struct saa7164_port *tsport = NULL;
930 struct saa7164_port *encport = 0; 930 struct saa7164_port *encport = NULL;
931 struct saa7164_port *vbiport = 0; 931 struct saa7164_port *vbiport = NULL;
932 u32 idx, next_offset; 932 u32 idx, next_offset;
933 int i; 933 int i;
934 struct tmComResDescrHeader *hdr, *t; 934 struct tmComResDescrHeader *hdr, *t;
@@ -1340,7 +1340,7 @@ int saa7164_api_enum_subdevs(struct saa7164_dev *dev)
1340 1340
1341 /* Allocate enough storage for all of the descs */ 1341 /* Allocate enough storage for all of the descs */
1342 buf = kzalloc(buflen, GFP_KERNEL); 1342 buf = kzalloc(buflen, GFP_KERNEL);
1343 if (buf == NULL) 1343 if (!buf)
1344 return SAA_ERR_NO_RESOURCES; 1344 return SAA_ERR_NO_RESOURCES;
1345 1345
1346 /* Retrieve them */ 1346 /* Retrieve them */
diff --git a/drivers/media/video/saa7164/saa7164-buffer.c b/drivers/media/video/saa7164/saa7164-buffer.c
index ddd25211c9e8..66696fa8341d 100644
--- a/drivers/media/video/saa7164/saa7164-buffer.c
+++ b/drivers/media/video/saa7164/saa7164-buffer.c
@@ -93,7 +93,7 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port,
93 u32 len) 93 u32 len)
94{ 94{
95 struct tmHWStreamParameters *params = &port->hw_streamingparams; 95 struct tmHWStreamParameters *params = &port->hw_streamingparams;
96 struct saa7164_buffer *buf = 0; 96 struct saa7164_buffer *buf = NULL;
97 struct saa7164_dev *dev = port->dev; 97 struct saa7164_dev *dev = port->dev;
98 int i; 98 int i;
99 99
@@ -103,7 +103,7 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port,
103 } 103 }
104 104
105 buf = kzalloc(sizeof(struct saa7164_buffer), GFP_KERNEL); 105 buf = kzalloc(sizeof(struct saa7164_buffer), GFP_KERNEL);
106 if (buf == NULL) { 106 if (!buf) {
107 log_warn("%s() SAA_ERR_NO_RESOURCES\n", __func__); 107 log_warn("%s() SAA_ERR_NO_RESOURCES\n", __func__);
108 goto ret; 108 goto ret;
109 } 109 }
@@ -157,7 +157,7 @@ fail2:
157fail1: 157fail1:
158 kfree(buf); 158 kfree(buf);
159 159
160 buf = 0; 160 buf = NULL;
161ret: 161ret:
162 return buf; 162 return buf;
163} 163}
@@ -289,14 +289,14 @@ struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev,
289 struct saa7164_user_buffer *buf; 289 struct saa7164_user_buffer *buf;
290 290
291 buf = kzalloc(sizeof(struct saa7164_user_buffer), GFP_KERNEL); 291 buf = kzalloc(sizeof(struct saa7164_user_buffer), GFP_KERNEL);
292 if (buf == 0) 292 if (!buf)
293 return 0; 293 return NULL;
294 294
295 buf->data = kzalloc(len, GFP_KERNEL); 295 buf->data = kzalloc(len, GFP_KERNEL);
296 296
297 if (buf->data == 0) { 297 if (!buf->data) {
298 kfree(buf); 298 kfree(buf);
299 return 0; 299 return NULL;
300 } 300 }
301 301
302 buf->actual_size = len; 302 buf->actual_size = len;
@@ -315,7 +315,7 @@ void saa7164_buffer_dealloc_user(struct saa7164_user_buffer *buf)
315 return; 315 return;
316 316
317 kfree(buf->data); 317 kfree(buf->data);
318 buf->data = 0; 318 buf->data = NULL;
319 319
320 kfree(buf); 320 kfree(buf);
321} 321}
diff --git a/drivers/media/video/saa7164/saa7164-bus.c b/drivers/media/video/saa7164/saa7164-bus.c
index b2b0d97101d0..466e1b02f91f 100644
--- a/drivers/media/video/saa7164/saa7164-bus.c
+++ b/drivers/media/video/saa7164/saa7164-bus.c
@@ -158,7 +158,7 @@ int saa7164_bus_set(struct saa7164_dev *dev, struct tmComResInfo* msg,
158 return SAA_ERR_BAD_PARAMETER; 158 return SAA_ERR_BAD_PARAMETER;
159 } 159 }
160 160
161 if ((msg->size > 0) && (buf == 0)) { 161 if ((msg->size > 0) && (buf == NULL)) {
162 printk(KERN_ERR "%s() Missing message buffer\n", __func__); 162 printk(KERN_ERR "%s() Missing message buffer\n", __func__);
163 return SAA_ERR_BAD_PARAMETER; 163 return SAA_ERR_BAD_PARAMETER;
164 } 164 }
@@ -315,7 +315,7 @@ int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,
315 315
316 saa7164_bus_verify(dev); 316 saa7164_bus_verify(dev);
317 317
318 if (msg == 0) 318 if (msg == NULL)
319 return ret; 319 return ret;
320 320
321 if (msg->size > dev->bus.m_wMaxReqSize) { 321 if (msg->size > dev->bus.m_wMaxReqSize) {
@@ -324,7 +324,7 @@ int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,
324 return ret; 324 return ret;
325 } 325 }
326 326
327 if ((peekonly == 0) && (msg->size > 0) && (buf == 0)) { 327 if ((peekonly == 0) && (msg->size > 0) && (buf == NULL)) {
328 printk(KERN_ERR 328 printk(KERN_ERR
329 "%s() Missing msg buf, size should be %d bytes\n", 329 "%s() Missing msg buf, size should be %d bytes\n",
330 __func__, msg->size); 330 __func__, msg->size);
@@ -392,7 +392,7 @@ int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,
392 392
393 printk(KERN_ERR "%s() Unexpected msg miss-match\n", __func__); 393 printk(KERN_ERR "%s() Unexpected msg miss-match\n", __func__);
394 saa7164_bus_dumpmsg(dev, msg, buf); 394 saa7164_bus_dumpmsg(dev, msg, buf);
395 saa7164_bus_dumpmsg(dev, &msg_tmp, 0); 395 saa7164_bus_dumpmsg(dev, &msg_tmp, NULL);
396 ret = SAA_ERR_INVALID_COMMAND; 396 ret = SAA_ERR_INVALID_COMMAND;
397 goto out; 397 goto out;
398 } 398 }
diff --git a/drivers/media/video/saa7164/saa7164-cmd.c b/drivers/media/video/saa7164/saa7164-cmd.c
index a97ae17b36c2..6a4c217ed3a7 100644
--- a/drivers/media/video/saa7164/saa7164-cmd.c
+++ b/drivers/media/video/saa7164/saa7164-cmd.c
@@ -84,7 +84,7 @@ int saa7164_irq_dequeue(struct saa7164_dev *dev)
84{ 84{
85 int ret = SAA_OK, i = 0; 85 int ret = SAA_OK, i = 0;
86 u32 timeout; 86 u32 timeout;
87 wait_queue_head_t *q = 0; 87 wait_queue_head_t *q = NULL;
88 u8 tmp[512]; 88 u8 tmp[512];
89 dprintk(DBGLVL_CMD, "%s()\n", __func__); 89 dprintk(DBGLVL_CMD, "%s()\n", __func__);
90 90
@@ -137,7 +137,7 @@ int saa7164_cmd_dequeue(struct saa7164_dev *dev)
137 int loop = 1; 137 int loop = 1;
138 int ret; 138 int ret;
139 u32 timeout; 139 u32 timeout;
140 wait_queue_head_t *q = 0; 140 wait_queue_head_t *q = NULL;
141 u8 tmp[512]; 141 u8 tmp[512];
142 dprintk(DBGLVL_CMD, "%s()\n", __func__); 142 dprintk(DBGLVL_CMD, "%s()\n", __func__);
143 143
@@ -261,7 +261,7 @@ out:
261 */ 261 */
262int saa7164_cmd_wait(struct saa7164_dev *dev, u8 seqno) 262int saa7164_cmd_wait(struct saa7164_dev *dev, u8 seqno)
263{ 263{
264 wait_queue_head_t *q = 0; 264 wait_queue_head_t *q = NULL;
265 int ret = SAA_BUS_TIMEOUT; 265 int ret = SAA_BUS_TIMEOUT;
266 unsigned long stamp; 266 unsigned long stamp;
267 int r; 267 int r;
@@ -357,7 +357,7 @@ int saa7164_cmd_send(struct saa7164_dev *dev, u8 id, enum tmComResCmd command,
357 "sel = 0x%x)\n", __func__, saa7164_unitid_name(dev, id), id, 357 "sel = 0x%x)\n", __func__, saa7164_unitid_name(dev, id), id,
358 command, controlselector); 358 command, controlselector);
359 359
360 if ((size == 0) || (buf == 0)) { 360 if ((size == 0) || (buf == NULL)) {
361 printk(KERN_ERR "%s() Invalid param\n", __func__); 361 printk(KERN_ERR "%s() Invalid param\n", __func__);
362 return SAA_ERR_BAD_PARAMETER; 362 return SAA_ERR_BAD_PARAMETER;
363 } 363 }
@@ -538,7 +538,7 @@ int saa7164_cmd_send(struct saa7164_dev *dev, u8 id, enum tmComResCmd command,
538 538
539 /* Invalid */ 539 /* Invalid */
540 dprintk(DBGLVL_CMD, "%s() Invalid\n", __func__); 540 dprintk(DBGLVL_CMD, "%s() Invalid\n", __func__);
541 ret = saa7164_bus_get(dev, presponse_t, 0, 0); 541 ret = saa7164_bus_get(dev, presponse_t, NULL, 0);
542 if (ret != SAA_OK) { 542 if (ret != SAA_OK) {
543 printk(KERN_ERR "get failed\n"); 543 printk(KERN_ERR "get failed\n");
544 return ret; 544 return ret;
diff --git a/drivers/media/video/saa7164/saa7164-core.c b/drivers/media/video/saa7164/saa7164-core.c
index 58af67f2278b..b813aec1e456 100644
--- a/drivers/media/video/saa7164/saa7164-core.c
+++ b/drivers/media/video/saa7164/saa7164-core.c
@@ -277,8 +277,8 @@ static void saa7164_histogram_print(struct saa7164_port *port,
277static void saa7164_work_enchandler_helper(struct saa7164_port *port, int bufnr) 277static void saa7164_work_enchandler_helper(struct saa7164_port *port, int bufnr)
278{ 278{
279 struct saa7164_dev *dev = port->dev; 279 struct saa7164_dev *dev = port->dev;
280 struct saa7164_buffer *buf = 0; 280 struct saa7164_buffer *buf = NULL;
281 struct saa7164_user_buffer *ubuf = 0; 281 struct saa7164_user_buffer *ubuf = NULL;
282 struct list_head *c, *n; 282 struct list_head *c, *n;
283 int i = 0; 283 int i = 0;
284 u8 __iomem *p; 284 u8 __iomem *p;
@@ -649,7 +649,7 @@ static irqreturn_t saa7164_irq(int irq, void *dev_id)
649 u32 intid, intstat[INT_SIZE/4]; 649 u32 intid, intstat[INT_SIZE/4];
650 int i, handled = 0, bit; 650 int i, handled = 0, bit;
651 651
652 if (dev == 0) { 652 if (dev == NULL) {
653 printk(KERN_ERR "%s() No device specified\n", __func__); 653 printk(KERN_ERR "%s() No device specified\n", __func__);
654 handled = 0; 654 handled = 0;
655 goto out; 655 goto out;
@@ -945,7 +945,7 @@ static int get_resources(struct saa7164_dev *dev)
945 945
946static int saa7164_port_init(struct saa7164_dev *dev, int portnr) 946static int saa7164_port_init(struct saa7164_dev *dev, int portnr)
947{ 947{
948 struct saa7164_port *port = 0; 948 struct saa7164_port *port = NULL;
949 949
950 if ((portnr < 0) || (portnr >= SAA7164_MAX_PORTS)) 950 if ((portnr < 0) || (portnr >= SAA7164_MAX_PORTS))
951 BUG(); 951 BUG();
diff --git a/drivers/media/video/saa7164/saa7164-dvb.c b/drivers/media/video/saa7164/saa7164-dvb.c
index b305a01b3bde..f65eab63ca87 100644
--- a/drivers/media/video/saa7164/saa7164-dvb.c
+++ b/drivers/media/video/saa7164/saa7164-dvb.c
@@ -309,8 +309,8 @@ static int dvb_register(struct saa7164_port *port)
309 309
310 port->hw_streamingparams.pitch = 188; 310 port->hw_streamingparams.pitch = 188;
311 port->hw_streamingparams.linethreshold = 0; 311 port->hw_streamingparams.linethreshold = 0;
312 port->hw_streamingparams.pagetablelistvirt = 0; 312 port->hw_streamingparams.pagetablelistvirt = NULL;
313 port->hw_streamingparams.pagetablelistphys = 0; 313 port->hw_streamingparams.pagetablelistphys = NULL;
314 port->hw_streamingparams.numpagetables = 2 + 314 port->hw_streamingparams.numpagetables = 2 +
315 ((SAA7164_TS_NUMBER_OF_LINES * 188) / PAGE_SIZE); 315 ((SAA7164_TS_NUMBER_OF_LINES * 188) / PAGE_SIZE);
316 316
diff --git a/drivers/media/video/saa7164/saa7164-encoder.c b/drivers/media/video/saa7164/saa7164-encoder.c
index 1838408cd5cb..f9d594698832 100644
--- a/drivers/media/video/saa7164/saa7164-encoder.c
+++ b/drivers/media/video/saa7164/saa7164-encoder.c
@@ -152,8 +152,8 @@ static int saa7164_encoder_buffers_alloc(struct saa7164_port *port)
152 /* Init and establish defaults */ 152 /* Init and establish defaults */
153 params->bitspersample = 8; 153 params->bitspersample = 8;
154 params->linethreshold = 0; 154 params->linethreshold = 0;
155 params->pagetablelistvirt = 0; 155 params->pagetablelistvirt = NULL;
156 params->pagetablelistphys = 0; 156 params->pagetablelistphys = NULL;
157 params->numpagetableentries = port->hwcfg.buffercount; 157 params->numpagetableentries = port->hwcfg.buffercount;
158 158
159 /* Allocate the PCI resources, buffers (hard) */ 159 /* Allocate the PCI resources, buffers (hard) */
@@ -1108,7 +1108,7 @@ static int fops_release(struct file *file)
1108 1108
1109struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port) 1109struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port)
1110{ 1110{
1111 struct saa7164_user_buffer *ubuf = 0; 1111 struct saa7164_user_buffer *ubuf = NULL;
1112 struct saa7164_dev *dev = port->dev; 1112 struct saa7164_dev *dev = port->dev;
1113 u32 crc; 1113 u32 crc;
1114 1114
@@ -1443,7 +1443,7 @@ int saa7164_encoder_register(struct saa7164_port *port)
1443 port->v4l_device = saa7164_encoder_alloc(port, 1443 port->v4l_device = saa7164_encoder_alloc(port,
1444 dev->pci, &saa7164_mpeg_template, "mpeg"); 1444 dev->pci, &saa7164_mpeg_template, "mpeg");
1445 1445
1446 if (port->v4l_device == NULL) { 1446 if (!port->v4l_device) {
1447 printk(KERN_INFO "%s: can't allocate mpeg device\n", 1447 printk(KERN_INFO "%s: can't allocate mpeg device\n",
1448 dev->name); 1448 dev->name);
1449 result = -ENOMEM; 1449 result = -ENOMEM;
diff --git a/drivers/media/video/saa7164/saa7164-fw.c b/drivers/media/video/saa7164/saa7164-fw.c
index ebed6f786a23..b369300cce06 100644
--- a/drivers/media/video/saa7164/saa7164-fw.c
+++ b/drivers/media/video/saa7164/saa7164-fw.c
@@ -88,7 +88,7 @@ int saa7164_downloadimage(struct saa7164_dev *dev, u8 *src, u32 srcsize,
88 "%s(image=%p, size=%d, flags=0x%x, dst=%p, dstsize=0x%x)\n", 88 "%s(image=%p, size=%d, flags=0x%x, dst=%p, dstsize=0x%x)\n",
89 __func__, src, srcsize, dlflags, dst, dstsize); 89 __func__, src, srcsize, dlflags, dst, dstsize);
90 90
91 if ((src == 0) || (dst == 0)) { 91 if ((src == NULL) || (dst == NULL)) {
92 ret = -EIO; 92 ret = -EIO;
93 goto out; 93 goto out;
94 } 94 }
diff --git a/drivers/media/video/saa7164/saa7164-vbi.c b/drivers/media/video/saa7164/saa7164-vbi.c
index 8abbe6d661e4..9e5b01c29cf5 100644
--- a/drivers/media/video/saa7164/saa7164-vbi.c
+++ b/drivers/media/video/saa7164/saa7164-vbi.c
@@ -123,8 +123,8 @@ static int saa7164_vbi_buffers_alloc(struct saa7164_port *port)
123 ((params->numberoflines * params->pitch) / PAGE_SIZE); 123 ((params->numberoflines * params->pitch) / PAGE_SIZE);
124 params->bitspersample = 8; 124 params->bitspersample = 8;
125 params->linethreshold = 0; 125 params->linethreshold = 0;
126 params->pagetablelistvirt = 0; 126 params->pagetablelistvirt = NULL;
127 params->pagetablelistphys = 0; 127 params->pagetablelistphys = NULL;
128 params->numpagetableentries = port->hwcfg.buffercount; 128 params->numpagetableentries = port->hwcfg.buffercount;
129 129
130 /* Allocate the PCI resources, buffers (hard) */ 130 /* Allocate the PCI resources, buffers (hard) */
@@ -1054,7 +1054,7 @@ static int fops_release(struct file *file)
1054 1054
1055struct saa7164_user_buffer *saa7164_vbi_next_buf(struct saa7164_port *port) 1055struct saa7164_user_buffer *saa7164_vbi_next_buf(struct saa7164_port *port)
1056{ 1056{
1057 struct saa7164_user_buffer *ubuf = 0; 1057 struct saa7164_user_buffer *ubuf = NULL;
1058 struct saa7164_dev *dev = port->dev; 1058 struct saa7164_dev *dev = port->dev;
1059 u32 crc; 1059 u32 crc;
1060 1060
@@ -1334,7 +1334,7 @@ int saa7164_vbi_register(struct saa7164_port *port)
1334 port->v4l_device = saa7164_vbi_alloc(port, 1334 port->v4l_device = saa7164_vbi_alloc(port,
1335 dev->pci, &saa7164_vbi_template, "vbi"); 1335 dev->pci, &saa7164_vbi_template, "vbi");
1336 1336
1337 if (port->v4l_device == NULL) { 1337 if (!port->v4l_device) {
1338 printk(KERN_INFO "%s: can't allocate vbi device\n", 1338 printk(KERN_INFO "%s: can't allocate vbi device\n",
1339 dev->name); 1339 dev->name);
1340 result = -ENOMEM; 1340 result = -ENOMEM;