Commit 3c1fb66e authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

staging/easycap: don't cast NULL pointer

Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent dfc9539f
...@@ -52,7 +52,7 @@ if (NULL == peasycap) { ...@@ -52,7 +52,7 @@ if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL\n"); SAY("ERROR: peasycap is NULL\n");
return -EFAULT; return -EFAULT;
} }
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -359,7 +359,7 @@ if (0 > peasycap->standard_offset) { ...@@ -359,7 +359,7 @@ if (0 > peasycap->standard_offset) {
return -EBUSY; return -EBUSY;
} }
p = peasycap->pusb_device; p = peasycap->pusb_device;
if ((struct usb_device *)NULL == p) { if (NULL == p) {
SAM("ERROR: peaycap->pusb_device is NULL\n"); SAM("ERROR: peaycap->pusb_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -421,7 +421,7 @@ if (V4L2_FIELD_ANY == field) { ...@@ -421,7 +421,7 @@ if (V4L2_FIELD_ANY == field) {
field = V4L2_FIELD_NONE; field = V4L2_FIELD_NONE;
SAM("prefer: V4L2_FIELD_NONE=field, was V4L2_FIELD_ANY\n"); SAM("prefer: V4L2_FIELD_NONE=field, was V4L2_FIELD_ANY\n");
} }
peasycap_best_format = (struct easycap_format *)NULL; peasycap_best_format = NULL;
peasycap_format = &easycap_format[0]; peasycap_format = &easycap_format[0];
while (0 != peasycap_format->v4l2_format.fmt.pix.width) { while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
JOM(16, ".> %i %i 0x%08X %ix%i\n", JOM(16, ".> %i %i 0x%08X %ix%i\n",
...@@ -472,7 +472,7 @@ if (0 == peasycap_format->v4l2_format.fmt.pix.width) { ...@@ -472,7 +472,7 @@ if (0 == peasycap_format->v4l2_format.fmt.pix.width) {
return peasycap->format_offset; return peasycap->format_offset;
} }
} }
if ((struct easycap_format *)NULL == peasycap_best_format) { if (NULL == peasycap_best_format) {
SAM("MISTAKE: peasycap_best_format is NULL"); SAM("MISTAKE: peasycap_best_format is NULL");
return -EINVAL; return -EINVAL;
} }
...@@ -628,7 +628,7 @@ if (NULL == peasycap) { ...@@ -628,7 +628,7 @@ if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL\n"); SAY("ERROR: peasycap is NULL\n");
return -EFAULT; return -EFAULT;
} }
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -686,7 +686,7 @@ if (NULL == peasycap) { ...@@ -686,7 +686,7 @@ if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL\n"); SAY("ERROR: peasycap is NULL\n");
return -EFAULT; return -EFAULT;
} }
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -746,7 +746,7 @@ if (NULL == peasycap) { ...@@ -746,7 +746,7 @@ if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL\n"); SAY("ERROR: peasycap is NULL\n");
return -EFAULT; return -EFAULT;
} }
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -806,7 +806,7 @@ if (NULL == peasycap) { ...@@ -806,7 +806,7 @@ if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL\n"); SAY("ERROR: peasycap is NULL\n");
return -EFAULT; return -EFAULT;
} }
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -862,7 +862,7 @@ if (NULL == peasycap) { ...@@ -862,7 +862,7 @@ if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL\n"); SAY("ERROR: peasycap is NULL\n");
return -EFAULT; return -EFAULT;
} }
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -919,7 +919,7 @@ if (NULL == peasycap) { ...@@ -919,7 +919,7 @@ if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL\n"); SAY("ERROR: peasycap is NULL\n");
return -EFAULT; return -EFAULT;
} }
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -955,7 +955,7 @@ return -ENOENT; ...@@ -955,7 +955,7 @@ return -ENOENT;
(defined(EASYCAP_NEEDS_UNLOCKED_IOCTL))) (defined(EASYCAP_NEEDS_UNLOCKED_IOCTL)))
long long
easycap_ioctl_noinode(struct file *file, unsigned int cmd, unsigned long arg) { easycap_ioctl_noinode(struct file *file, unsigned int cmd, unsigned long arg) {
return (long)easycap_ioctl((struct inode *)NULL, file, cmd, arg); return (long)easycap_ioctl(NULL, file, cmd, arg);
} }
#endif /*EASYCAP_IS_VIDEODEV_CLIENT||EASYCAP_NEEDS_UNLOCKED_IOCTL*/ #endif /*EASYCAP_IS_VIDEODEV_CLIENT||EASYCAP_NEEDS_UNLOCKED_IOCTL*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
...@@ -2368,7 +2368,7 @@ case VIDIOC_STREAMON: { ...@@ -2368,7 +2368,7 @@ case VIDIOC_STREAMON: {
peasycap->isequence = 0; peasycap->isequence = 0;
for (i = 0; i < 180; i++) for (i = 0; i < 180; i++)
peasycap->merit[i] = 0; peasycap->merit[i] = 0;
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
...@@ -2384,7 +2384,7 @@ case VIDIOC_STREAMON: { ...@@ -2384,7 +2384,7 @@ case VIDIOC_STREAMON: {
case VIDIOC_STREAMOFF: { case VIDIOC_STREAMOFF: {
JOM(8, "VIDIOC_STREAMOFF\n"); JOM(8, "VIDIOC_STREAMOFF\n");
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_video); mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -EFAULT; return -EFAULT;
......
...@@ -925,7 +925,7 @@ rc0 = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0), ...@@ -925,7 +925,7 @@ rc0 = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
(__u8)(USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE), (__u8)(USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
(__u16)value, (__u16)value,
(__u16)index, (__u16)index,
(void *)NULL, NULL,
(__u16)0, (__u16)0,
(int)500); (int)500);
......
This diff is collapsed.
...@@ -370,7 +370,7 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) { ...@@ -370,7 +370,7 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
return -EFAULT; return -EFAULT;
} }
pss->private_data = NULL; pss->private_data = NULL;
peasycap->psubstream = (struct snd_pcm_substream *)NULL; peasycap->psubstream = NULL;
JOT(4, "ending successfully\n"); JOT(4, "ending successfully\n");
return 0; return 0;
} }
...@@ -647,7 +647,7 @@ if (true == peasycap->microphone) { ...@@ -647,7 +647,7 @@ if (true == peasycap->microphone) {
strcpy(&psnd_pcm->name[0], &psnd_card->id[0]); strcpy(&psnd_pcm->name[0], &psnd_card->id[0]);
psnd_pcm->private_data = peasycap; psnd_pcm->private_data = peasycap;
peasycap->psnd_pcm = psnd_pcm; peasycap->psnd_pcm = psnd_pcm;
peasycap->psubstream = (struct snd_pcm_substream *)NULL; peasycap->psubstream = NULL;
rc = snd_card_register(psnd_card); rc = snd_card_register(psnd_card);
if (0 != rc) { if (0 != rc) {
...@@ -684,7 +684,7 @@ if (NULL == peasycap) { ...@@ -684,7 +684,7 @@ if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL.\n"); SAY("ERROR: peasycap is NULL.\n");
return -EFAULT; return -EFAULT;
} }
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
return -ENODEV; return -ENODEV;
} }
...@@ -693,12 +693,12 @@ JOM(16, "0x%08lX=peasycap->pusb_device\n", (long int)peasycap->pusb_device); ...@@ -693,12 +693,12 @@ JOM(16, "0x%08lX=peasycap->pusb_device\n", (long int)peasycap->pusb_device);
rc = audio_setup(peasycap); rc = audio_setup(peasycap);
JOM(8, "audio_setup() returned %i\n", rc); JOM(8, "audio_setup() returned %i\n", rc);
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device has become NULL\n"); SAM("ERROR: peasycap->pusb_device has become NULL\n");
return -ENODEV; return -ENODEV;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device has become NULL\n"); SAM("ERROR: peasycap->pusb_device has become NULL\n");
return -ENODEV; return -ENODEV;
} }
...@@ -740,11 +740,11 @@ if (NULL == peasycap) { ...@@ -740,11 +740,11 @@ if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL\n"); SAY("ERROR: peasycap is NULL\n");
return -EFAULT; return -EFAULT;
} }
if ((struct list_head *)NULL == peasycap->purb_audio_head) { if (NULL == peasycap->purb_audio_head) {
SAM("ERROR: peasycap->urb_audio_head uninitialized\n"); SAM("ERROR: peasycap->urb_audio_head uninitialized\n");
return -EFAULT; return -EFAULT;
} }
if ((struct usb_device *)NULL == peasycap->pusb_device) { if (NULL == peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n"); SAM("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -855,15 +855,15 @@ if (NULL == peasycap) { ...@@ -855,15 +855,15 @@ if (NULL == peasycap) {
return -EFAULT; return -EFAULT;
} }
if (peasycap->audio_isoc_streaming) { if (peasycap->audio_isoc_streaming) {
if ((struct list_head *)NULL != peasycap->purb_audio_head) { if (NULL != peasycap->purb_audio_head) {
peasycap->audio_isoc_streaming = 0; peasycap->audio_isoc_streaming = 0;
JOM(4, "killing audio urbs\n"); JOM(4, "killing audio urbs\n");
m = 0; m = 0;
list_for_each(plist_head, (peasycap->purb_audio_head)) { list_for_each(plist_head, (peasycap->purb_audio_head)) {
pdata_urb = list_entry(plist_head, struct data_urb, pdata_urb = list_entry(plist_head, struct data_urb,
list_head); list_head);
if ((struct data_urb *)NULL != pdata_urb) { if (NULL != pdata_urb) {
if ((struct urb *)NULL != pdata_urb->purb) { if (NULL != pdata_urb->purb) {
usb_kill_urb(pdata_urb->purb); usb_kill_urb(pdata_urb->purb);
m++; m++;
} }
......
...@@ -356,7 +356,7 @@ if (NULL == peasycap) { ...@@ -356,7 +356,7 @@ if (NULL == peasycap) {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) { if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
pv4l2_device = usb_get_intfdata(pusb_interface); pv4l2_device = usb_get_intfdata(pusb_interface);
if ((struct v4l2_device *)NULL == pv4l2_device) { if (NULL == pv4l2_device) {
SAY("ERROR: pv4l2_device is NULL\n"); SAY("ERROR: pv4l2_device is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -510,7 +510,7 @@ if ((0 > peasycap->audio_read) || ...@@ -510,7 +510,7 @@ if ((0 > peasycap->audio_read) ||
return -EFAULT; return -EFAULT;
} }
pdata_buffer = &peasycap->audio_buffer[peasycap->audio_read]; pdata_buffer = &peasycap->audio_buffer[peasycap->audio_read];
if ((struct data_buffer *)NULL == pdata_buffer) { if (NULL == pdata_buffer) {
SAM("ERROR: pdata_buffer is NULL\n"); SAM("ERROR: pdata_buffer is NULL\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return -EFAULT; return -EFAULT;
...@@ -598,7 +598,7 @@ while (fragment == (peasycap->audio_read / ...@@ -598,7 +598,7 @@ while (fragment == (peasycap->audio_read /
return -EFAULT; return -EFAULT;
} }
pdata_buffer = &peasycap->audio_buffer[peasycap->audio_read]; pdata_buffer = &peasycap->audio_buffer[peasycap->audio_read];
if ((struct data_buffer *)NULL == pdata_buffer) { if (NULL == pdata_buffer) {
SAM("ERROR: pdata_buffer is NULL\n"); SAM("ERROR: pdata_buffer is NULL\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return -EFAULT; return -EFAULT;
...@@ -1006,7 +1006,7 @@ return 0; ...@@ -1006,7 +1006,7 @@ return 0;
static long easyoss_ioctl_noinode(struct file *file, static long easyoss_ioctl_noinode(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
return (long)easyoss_ioctl((struct inode *)NULL, file, cmd, arg); return (long)easyoss_ioctl(NULL, file, cmd, arg);
} }
#endif /*EASYCAP_IS_VIDEODEV_CLIENT||EASYCAP_NEEDS_UNLOCKED_IOCTL*/ #endif /*EASYCAP_IS_VIDEODEV_CLIENT||EASYCAP_NEEDS_UNLOCKED_IOCTL*/
/*****************************************************************************/ /*****************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment