V4L/DVB (8199): gspca: Compile warnings about NULL ptr.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
Harvey Harrison 2008-07-05 06:12:47 -03:00 committed by Mauro Carvalho Chehab
parent 46ccdafa71
commit efab8211db
3 changed files with 42 additions and 41 deletions

View File

@ -334,7 +334,7 @@ static void *rvmalloc(unsigned long size)
/* size = PAGE_ALIGN(size); (already done) */
mem = vmalloc_32(size);
if (mem != 0) {
if (mem != NULL) {
memset(mem, 0, size);
adr = (unsigned long) mem;
while ((long) size > 0) {
@ -464,7 +464,7 @@ static void frame_free(struct gspca_dev *gspca_dev)
int i;
PDEBUG(D_STREAM, "frame free");
if (gspca_dev->frbuf != 0) {
if (gspca_dev->frbuf != NULL) {
rvfree(gspca_dev->frbuf,
gspca_dev->nframes * gspca_dev->frsz);
gspca_dev->frbuf = NULL;
@ -487,7 +487,7 @@ static void destroy_urbs(struct gspca_dev *gspca_dev)
gspca_dev->urb[i] = NULL;
usb_kill_urb(urb);
if (urb->transfer_buffer != 0)
if (urb->transfer_buffer != NULL)
usb_buffer_free(gspca_dev->dev,
urb->transfer_buffer_length,
urb->transfer_buffer,
@ -991,7 +991,7 @@ static int dev_close(struct inode *inode, struct file *file)
gspca_dev->sd_desc->close(gspca_dev);
mutex_unlock(&gspca_dev->usb_lock);
frame_free(gspca_dev);
gspca_dev->capt_file = 0;
gspca_dev->capt_file = NULL;
gspca_dev->memory = GSPCA_MEMORY_NO;
}
file->private_data = NULL;
@ -1165,7 +1165,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
}
/* only one file may do capture */
if ((gspca_dev->capt_file != 0 && gspca_dev->capt_file != file)
if ((gspca_dev->capt_file != NULL && gspca_dev->capt_file != file)
|| gspca_dev->streaming) {
ret = -EBUSY;
goto out;
@ -1173,7 +1173,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
if (rb->count == 0) { /* unrequest? */
frame_free(gspca_dev);
gspca_dev->capt_file = 0;
gspca_dev->capt_file = NULL;
} else {
gspca_dev->memory = rb->memory;
ret = frame_alloc(gspca_dev, rb->count);
@ -1382,7 +1382,7 @@ static int vidiocgmbuf(struct file *file, void *priv,
static int dev_mmap(struct file *file, struct vm_area_struct *vma)
{
struct gspca_dev *gspca_dev = file->private_data;
struct gspca_frame *frame = 0;
struct gspca_frame *frame;
struct page *page;
unsigned long addr, start, size;
int i, ret;
@ -1405,6 +1405,7 @@ static int dev_mmap(struct file *file, struct vm_area_struct *vma)
goto out;
}
frame = NULL;
for (i = 0; i < gspca_dev->nframes; ++i) {
if (gspca_dev->frame[i].v4l2_buf.memory != V4L2_MEMORY_MMAP) {
PDEBUG(D_STREAM, "mmap bad memory type");
@ -1416,7 +1417,7 @@ static int dev_mmap(struct file *file, struct vm_area_struct *vma)
break;
}
}
if (frame == 0) {
if (frame == NULL) {
PDEBUG(D_STREAM, "mmap no frame buffer found");
ret = -EINVAL;
goto out;

View File

@ -504,31 +504,31 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
t16RegWrite(dev, 0x01, 0x0000, n3, 0x06);
t16RegWrite(dev, 0x01, 0x0000, n4, 0x46);
t16RegRead(dev, 0x0080, &test_byte, 1);
t16RegWrite(dev, 0x00, 0x2c80, NULL, 0x0);
t16RegWrite(dev, 0x00, 0x2c80, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
t16RegWrite(dev, 0x00, 0x3880, NULL, 0x0);
t16RegWrite(dev, 0x00, 0x3880, NULL, 0x0);
t16RegWrite(dev, 0x00, 0x338e, NULL, 0x0);
t16RegWrite(dev, 0x00, 0x3880, NULL, 0);
t16RegWrite(dev, 0x00, 0x3880, NULL, 0);
t16RegWrite(dev, 0x00, 0x338e, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04);
t16RegWrite(dev, 0x00, 0x00a9, NULL, 0x0);
t16RegWrite(dev, 0x00, 0x00a9, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, nset6, 0x22);
t16RegWrite(dev, 0x00, 0x86bb, NULL, 0x0);
t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0x0);
t16RegWrite(dev, 0x00, 0x86bb, NULL, 0);
t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, missing, 0x08);
t16RegWrite(dev, 0x00, 0x2087, NULL, 0x0);
t16RegWrite(dev, 0x00, 0x2088, NULL, 0x0);
t16RegWrite(dev, 0x00, 0x2089, NULL, 0x0);
t16RegWrite(dev, 0x00, 0x2087, NULL, 0);
t16RegWrite(dev, 0x00, 0x2088, NULL, 0);
t16RegWrite(dev, 0x00, 0x2089, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04);
t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06);
t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06);
t16RegWrite(dev, 0x01, 0x0000, nset9, 0x04);
t16RegWrite(dev, 0x00, 0x2880, NULL, 0x00);
t16RegWrite(dev, 0x00, 0x2880, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
@ -581,9 +581,9 @@ static void seteffect(struct gspca_dev *gspca_dev)
}
if (sd->effect == 1 || sd->effect == 4)
t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0x00);
t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0);
else
t16RegWrite(dev, 0x00, 0xfaa6, NULL, 0x00);
t16RegWrite(dev, 0x00, 0xfaa6, NULL, 0);
}
static void setwhitebalance(struct gspca_dev *gspca_dev)
@ -649,7 +649,7 @@ static void setsharpness(struct gspca_dev *gspca_dev)
reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness;
t16RegWrite(dev, 0x00, reg_to_write, NULL, 0x00);
t16RegWrite(dev, 0x00, reg_to_write, NULL, 0);
}
static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
@ -870,16 +870,16 @@ static void sd_start(struct gspca_dev *gspca_dev)
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8);
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8);
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8);
t16RegWrite(dev, 0x00, 0x3c80, NULL, 0x00);
t16RegWrite(dev, 0x00, 0x3c80, NULL, 0);
/* just in case and to keep sync with logs (for mine) */
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8);
t16RegWrite(dev, 0x00, 0x3c80, NULL, 0x00);
t16RegWrite(dev, 0x00, 0x3c80, NULL, 0);
/* just in case and to keep sync with logs (for mine) */
t16RegWrite(dev, 0x01, 0x0000, t1, 4);
t16RegWrite(dev, 0x01, 0x0000, t2, 6);
t16RegRead(dev, 0x0012, &test_byte, 0x1);
t16RegRead(dev, 0x0012, &test_byte, 0x01);
t16RegWrite(dev, 0x01, 0x0000, t3, 0x10);
t16RegWrite(dev, 0x00, 0x0013, NULL, 0x00);
t16RegWrite(dev, 0x00, 0x0013, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, t4, 0x4);
/* restart on each start, just in case, sometimes regs goes wrong
* when using controls from app */

View File

@ -6425,11 +6425,11 @@ static void setcontrast(struct gspca_dev *gspca_dev)
{0x18, 0x20, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0e,
0x0b, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00, 0x01};
static const __u8 *gamma_tb[] = {
0, Tgamma_1, Tgamma_2,
NULL, Tgamma_1, Tgamma_2,
Tgamma_3, Tgamma_4, Tgamma_5, Tgamma_6
};
static const __u8 *gradient_tb[] = {
0, Tgradient_1, Tgradient_2,
NULL, Tgradient_1, Tgradient_2,
Tgradient_3, Tgradient_4, Tgradient_5, Tgradient_6
};
#ifdef CONFIG_VIDEO_ADV_DEBUG
@ -6544,21 +6544,21 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
gc0305_50HZ, gc0305_50HZ,
gc0305_60HZ, gc0305_60HZ},
/* SENSOR_HDCS2020 3 */
{0, 0,
0, 0,
0, 0},
{NULL, NULL,
NULL, NULL,
NULL, NULL},
/* SENSOR_HDCS2020b 4 */
{hdcs2020b_NoFliker, hdcs2020b_NoFliker,
hdcs2020b_50HZ, hdcs2020b_50HZ,
hdcs2020b_60HZ, hdcs2020b_60HZ},
/* SENSOR_HV7131B 5 */
{0, 0,
0, 0,
0, 0},
{NULL, NULL,
NULL, NULL,
NULL, NULL},
/* SENSOR_HV7131C 6 */
{0, 0,
0, 0,
0, 0},
{NULL, NULL,
NULL, NULL,
NULL, NULL},
/* SENSOR_ICM105A 7 */
{icm105a_NoFliker, icm105a_NoFlikerScale,
icm105a_50HZ, icm105a_50HZScale,
@ -6572,9 +6572,9 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
OV7620_50HZ, OV7620_50HZ,
OV7620_60HZ, OV7620_60HZ},
/* SENSOR_OV7630C 10 */
{0, 0,
0, 0,
0, 0},
{NULL, NULL,
NULL, NULL,
NULL, NULL},
/* SENSOR_PAS106 11 */
{pas106b_NoFliker, pas106b_NoFliker,
pas106b_50HZ, pas106b_50HZ,
@ -6606,7 +6606,7 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
if (!mode)
i++; /* 640x480 */
zc3_freq = freq_tb[(int) sd->sensor][i];
if (zc3_freq != 0) {
if (zc3_freq != NULL) {
usb_exchange(gspca_dev->dev, zc3_freq);
switch (sd->sensor) {
case SENSOR_GC0305: