Skip to content

Commit

Permalink
V4L/DVB (8199): gspca: Compile warnings about NULL ptr.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Harvey Harrison authored and Mauro Carvalho Chehab committed Jul 20, 2008
1 parent 46ccdaf commit efab821
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 41 deletions.
17 changes: 9 additions & 8 deletions drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1165,15 +1165,15 @@ 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;
}

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);
Expand Down Expand Up @@ -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;
Expand All @@ -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");
Expand All @@ -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;
Expand Down
36 changes: 18 additions & 18 deletions drivers/media/video/gspca/t613.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 */
Expand Down
30 changes: 15 additions & 15 deletions drivers/media/video/gspca/zc3xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit efab821

Please sign in to comment.