Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6888393c authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman
Browse files

staging/easycap: convert comparison to NULL into boolean



convert if (NULL != ptr) to if (ptr)
convert if (NULL == ptr) to if (!ptr)

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent febd32bc
Loading
Loading
Loading
Loading
+26 −26
Original line number Original line Diff line number Diff line
@@ -48,11 +48,11 @@ int adjust_standard(struct easycap *peasycap, v4l2_std_id std_id)
	unsigned int itwas, isnow;
	unsigned int itwas, isnow;
	bool resubmit;
	bool resubmit;


	if (NULL == peasycap) {
	if (!peasycap) {
		SAY("ERROR: peasycap is NULL\n");
		SAY("ERROR: peasycap is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
	if (NULL == peasycap->pusb_device) {
	if (!peasycap->pusb_device) {
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -370,7 +370,7 @@ int adjust_format(struct easycap *peasycap,
	u32 uc;
	u32 uc;
	bool resubmit;
	bool resubmit;


	if (NULL == peasycap) {
	if (!peasycap) {
		SAY("ERROR: peasycap is NULL\n");
		SAY("ERROR: peasycap is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -379,7 +379,7 @@ int adjust_format(struct easycap *peasycap,
		return -EBUSY;
		return -EBUSY;
	}
	}
	p = peasycap->pusb_device;
	p = peasycap->pusb_device;
	if (NULL == p) {
	if (!p) {
		SAM("ERROR: peaycap->pusb_device is NULL\n");
		SAM("ERROR: peaycap->pusb_device is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -491,7 +491,7 @@ int adjust_format(struct easycap *peasycap,
			return peasycap->format_offset;
			return peasycap->format_offset;
		}
		}
	}
	}
	if (NULL == peasycap_best_format) {
	if (!peasycap_best_format) {
		SAM("MISTAKE: peasycap_best_format is NULL");
		SAM("MISTAKE: peasycap_best_format is NULL");
		return -EINVAL;
		return -EINVAL;
	}
	}
@@ -632,11 +632,11 @@ int adjust_brightness(struct easycap *peasycap, int value)
	unsigned int mood;
	unsigned int mood;
	int i1, k;
	int i1, k;


	if (NULL == peasycap) {
	if (!peasycap) {
		SAY("ERROR: peasycap is NULL\n");
		SAY("ERROR: peasycap is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
	if (NULL == peasycap->pusb_device) {
	if (!peasycap->pusb_device) {
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -689,11 +689,11 @@ int adjust_contrast(struct easycap *peasycap, int value)
	unsigned int mood;
	unsigned int mood;
	int i1, k;
	int i1, k;


	if (NULL == peasycap) {
	if (!peasycap) {
		SAY("ERROR: peasycap is NULL\n");
		SAY("ERROR: peasycap is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
	if (NULL == peasycap->pusb_device) {
	if (!peasycap->pusb_device) {
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -747,11 +747,11 @@ int adjust_saturation(struct easycap *peasycap, int value)
	unsigned int mood;
	unsigned int mood;
	int i1, k;
	int i1, k;


	if (NULL == peasycap) {
	if (!peasycap) {
		SAY("ERROR: peasycap is NULL\n");
		SAY("ERROR: peasycap is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
	if (NULL == peasycap->pusb_device) {
	if (!peasycap->pusb_device) {
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -805,11 +805,11 @@ int adjust_hue(struct easycap *peasycap, int value)
	unsigned int mood;
	unsigned int mood;
	int i1, i2, k;
	int i1, i2, k;


	if (NULL == peasycap) {
	if (!peasycap) {
		SAY("ERROR: peasycap is NULL\n");
		SAY("ERROR: peasycap is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
	if (NULL == peasycap->pusb_device) {
	if (!peasycap->pusb_device) {
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -859,11 +859,11 @@ int adjust_volume(struct easycap *peasycap, int value)
	s8 mood;
	s8 mood;
	int i1;
	int i1;


	if (NULL == peasycap) {
	if (!peasycap) {
		SAY("ERROR: peasycap is NULL\n");
		SAY("ERROR: peasycap is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
	if (NULL == peasycap->pusb_device) {
	if (!peasycap->pusb_device) {
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -916,11 +916,11 @@ static int adjust_mute(struct easycap *peasycap, int value)
{
{
	int i1;
	int i1;


	if (NULL == peasycap) {
	if (!peasycap) {
		SAY("ERROR: peasycap is NULL\n");
		SAY("ERROR: peasycap is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
	if (NULL == peasycap->pusb_device) {
	if (!peasycap->pusb_device) {
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -958,12 +958,12 @@ long easycap_unlocked_ioctl(struct file *file,
	struct usb_device *p;
	struct usb_device *p;
	int kd;
	int kd;


	if (NULL == file) {
	if (!file) {
		SAY("ERROR:  file is NULL\n");
		SAY("ERROR:  file is NULL\n");
		return -ERESTARTSYS;
		return -ERESTARTSYS;
	}
	}
	peasycap = file->private_data;
	peasycap = file->private_data;
	if (NULL == peasycap) {
	if (!peasycap) {
		SAY("ERROR:  peasycap is NULL\n");
		SAY("ERROR:  peasycap is NULL\n");
		return -1;
		return -1;
	}
	}
@@ -972,7 +972,7 @@ long easycap_unlocked_ioctl(struct file *file,
		return -EFAULT;
		return -EFAULT;
	}
	}
	p = peasycap->pusb_device;
	p = peasycap->pusb_device;
	if (NULL == p) {
	if (!p) {
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		SAM("ERROR: peasycap->pusb_device is NULL\n");
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -993,13 +993,13 @@ long easycap_unlocked_ioctl(struct file *file,
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
		if (kd != isdongle(peasycap))
		if (kd != isdongle(peasycap))
			return -ERESTARTSYS;
			return -ERESTARTSYS;
		if (NULL == file) {
		if (!file) {
			SAY("ERROR:  file is NULL\n");
			SAY("ERROR:  file is NULL\n");
			mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
			mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
			return -ERESTARTSYS;
			return -ERESTARTSYS;
		}
		}
		peasycap = file->private_data;
		peasycap = file->private_data;
		if (NULL == peasycap) {
		if (!peasycap) {
			SAY("ERROR:  peasycap is NULL\n");
			SAY("ERROR:  peasycap is NULL\n");
			mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
			mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
			return -ERESTARTSYS;
			return -ERESTARTSYS;
@@ -1010,7 +1010,7 @@ long easycap_unlocked_ioctl(struct file *file,
			return -EFAULT;
			return -EFAULT;
		}
		}
		p = peasycap->pusb_device;
		p = peasycap->pusb_device;
		if (NULL == peasycap->pusb_device) {
		if (!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 -ERESTARTSYS;
			return -ERESTARTSYS;
@@ -2325,7 +2325,7 @@ long easycap_unlocked_ioctl(struct file *file,
		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 (NULL == peasycap->pusb_device) {
		if (!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;
@@ -2341,7 +2341,7 @@ long easycap_unlocked_ioctl(struct file *file,
	case VIDIOC_STREAMOFF: {
	case VIDIOC_STREAMOFF: {
		JOM(8, "VIDIOC_STREAMOFF\n");
		JOM(8, "VIDIOC_STREAMOFF\n");


		if (NULL == peasycap->pusb_device) {
		if (!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;
@@ -2362,7 +2362,7 @@ long easycap_unlocked_ioctl(struct file *file,
		wake_up_interruptible(&(peasycap->wq_audio));
		wake_up_interruptible(&(peasycap->wq_audio));


#else
#else
		if (NULL != peasycap->psubstream)
		if (peasycap->psubstream)
			snd_pcm_period_elapsed(peasycap->psubstream);
			snd_pcm_period_elapsed(peasycap->psubstream);
#endif /* CONFIG_EASYCAP_OSS */
#endif /* CONFIG_EASYCAP_OSS */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
+24 −24
Original line number Original line Diff line number Diff line
@@ -330,7 +330,7 @@ int confirm_resolution(struct usb_device *p)
{
{
	u8 get0, get1, get2, get3, get4, get5, get6, get7;
	u8 get0, get1, get2, get3, get4, get5, get6, get7;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	GET(p, 0x0110, &get0);
	GET(p, 0x0110, &get0);
	GET(p, 0x0111, &get1);
	GET(p, 0x0111, &get1);
@@ -371,7 +371,7 @@ int confirm_stream(struct usb_device *p)
	u16 get2;
	u16 get2;
	u8 igot;
	u8 igot;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	GET(p, 0x0100, &igot);  get2 = 0x80 & igot;
	GET(p, 0x0100, &igot);  get2 = 0x80 & igot;
	if (0x80 == get2)
	if (0x80 == get2)
@@ -385,7 +385,7 @@ int setup_stk(struct usb_device *p, bool ntsc)
{
{
	int i0;
	int i0;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	i0 = 0;
	i0 = 0;
	if (ntsc) {
	if (ntsc) {
@@ -411,7 +411,7 @@ int setup_saa(struct usb_device *p, bool ntsc)
{
{
	int i0, ir;
	int i0, ir;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	i0 = 0;
	i0 = 0;
	if (ntsc) {
	if (ntsc) {
@@ -434,7 +434,7 @@ int write_000(struct usb_device *p, u16 set2, u16 set0)
{
{
	u8 igot0, igot2;
	u8 igot0, igot2;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	GET(p, 0x0002, &igot2);
	GET(p, 0x0002, &igot2);
	GET(p, 0x0000, &igot0);
	GET(p, 0x0000, &igot0);
@@ -445,7 +445,7 @@ int write_000(struct usb_device *p, u16 set2, u16 set0)
/****************************************************************************/
/****************************************************************************/
int write_saa(struct usb_device *p, u16 reg0, u16 set0)
int write_saa(struct usb_device *p, u16 reg0, u16 set0)
{
{
	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	SET(p, 0x200, 0x00);
	SET(p, 0x200, 0x00);
	SET(p, 0x204, reg0);
	SET(p, 0x204, reg0);
@@ -470,7 +470,7 @@ write_vt(struct usb_device *p, u16 reg0, u16 set0)
	u16 got502, got503;
	u16 got502, got503;
	u16 set502, set503;
	u16 set502, set503;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	SET(p, 0x0504, reg0);
	SET(p, 0x0504, reg0);
	SET(p, 0x0500, 0x008B);
	SET(p, 0x0500, 0x008B);
@@ -506,7 +506,7 @@ int read_vt(struct usb_device *p, u16 reg0)
	u8 igot;
	u8 igot;
	u16 got502, got503;
	u16 got502, got503;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	SET(p, 0x0504, reg0);
	SET(p, 0x0504, reg0);
	SET(p, 0x0500, 0x008B);
	SET(p, 0x0500, 0x008B);
@@ -527,7 +527,7 @@ int read_vt(struct usb_device *p, u16 reg0)
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
int write_300(struct usb_device *p)
int write_300(struct usb_device *p)
{
{
	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	SET(p, 0x300, 0x0012);
	SET(p, 0x300, 0x0012);
	SET(p, 0x350, 0x002D);
	SET(p, 0x350, 0x002D);
@@ -548,7 +548,7 @@ int check_saa(struct usb_device *p, bool ntsc)
{
{
	int i0, ir, rc;
	int i0, ir, rc;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	i0 = 0;
	i0 = 0;
	rc = 0;
	rc = 0;
@@ -597,7 +597,7 @@ int merit_saa(struct usb_device *p)
{
{
	int rc;
	int rc;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	rc = read_saa(p, 0x1F);
	rc = read_saa(p, 0x1F);
	return ((0 > rc) || (0x02 & rc)) ? 1 : 0;
	return ((0 > rc) || (0x02 & rc)) ? 1 : 0;
@@ -615,7 +615,7 @@ int ready_saa(struct usb_device *p)
 *              3     FOR NON-INTERLACED   60 Hz
 *              3     FOR NON-INTERLACED   60 Hz
*/
*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	j = 0;
	j = 0;
	while (max > j) {
	while (max > j) {
@@ -660,7 +660,7 @@ int check_stk(struct usb_device *p, bool ntsc)
{
{
	int i0, ir;
	int i0, ir;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	i0 = 0;
	i0 = 0;
	if (ntsc) {
	if (ntsc) {
@@ -731,7 +731,7 @@ int read_saa(struct usb_device *p, u16 reg0)
{
{
	u8 igot;
	u8 igot;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	SET(p, 0x208, reg0);
	SET(p, 0x208, reg0);
	SET(p, 0x200, 0x20);
	SET(p, 0x200, 0x20);
@@ -746,7 +746,7 @@ int read_stk(struct usb_device *p, u32 reg0)
{
{
	u8 igot;
	u8 igot;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	igot = 0;
	igot = 0;
	GET(p, reg0, &igot);
	GET(p, reg0, &igot);
@@ -776,7 +776,7 @@ select_input(struct usb_device *p, int input, int mode)
{
{
	int ir;
	int ir;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	stop_100(p);
	stop_100(p);
	switch (input) {
	switch (input) {
@@ -879,7 +879,7 @@ int set_resolution(struct usb_device *p,
{
{
	u16 u0x0111, u0x0113, u0x0115, u0x0117;
	u16 u0x0111, u0x0113, u0x0115, u0x0117;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	u0x0111 = ((0xFF00 & set0) >> 8);
	u0x0111 = ((0xFF00 & set0) >> 8);
	u0x0113 = ((0xFF00 & set1) >> 8);
	u0x0113 = ((0xFF00 & set1) >> 8);
@@ -903,7 +903,7 @@ int start_100(struct usb_device *p)
	u16 get116, get117, get0;
	u16 get116, get117, get0;
	u8 igot116, igot117, igot;
	u8 igot116, igot117, igot;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	GET(p, 0x0116, &igot116);
	GET(p, 0x0116, &igot116);
	get116 = igot116;
	get116 = igot116;
@@ -927,7 +927,7 @@ int stop_100(struct usb_device *p)
	u16 get0;
	u16 get0;
	u8 igot;
	u8 igot;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;
	GET(p, 0x0100, &igot);
	GET(p, 0x0100, &igot);
	get0 = igot;
	get0 = igot;
@@ -947,7 +947,7 @@ int wait_i2c(struct usb_device *p)
	const int max = 2;
	const int max = 2;
	int k;
	int k;


	if (NULL == p)
	if (!p)
		return -ENODEV;
		return -ENODEV;


	for (k = 0;  k < max;  k++) {
	for (k = 0;  k < max;  k++) {
@@ -1000,11 +1000,11 @@ audio_setup(struct easycap *peasycap)
	const u16 index = 0x0301;
	const u16 index = 0x0301;
	const u16 length = 1;
	const u16 length = 1;


	if (NULL == peasycap)
	if (!peasycap)
		return -EFAULT;
		return -EFAULT;


	pusb_device = peasycap->pusb_device;
	pusb_device = peasycap->pusb_device;
	if (NULL == pusb_device)
	if (!pusb_device)
		return -ENODEV;
		return -ENODEV;


	JOM(8, "%02X %02X %02X %02X %02X %02X %02X %02X\n",
	JOM(8, "%02X %02X %02X %02X %02X %02X %02X %02X\n",
@@ -1143,7 +1143,7 @@ int audio_gainset(struct usb_device *pusb_device, s8 loud)
	u8 tmp;
	u8 tmp;
	u16 mute;
	u16 mute;


	if (NULL == pusb_device)
	if (!pusb_device)
		return -ENODEV;
		return -ENODEV;
	if (0 > loud)
	if (0 > loud)
		loud = 0;
		loud = 0;
@@ -1209,7 +1209,7 @@ int audio_gainget(struct usb_device *pusb_device)
{
{
	int igot;
	int igot;


	if (NULL == pusb_device)
	if (!pusb_device)
		return -ENODEV;
		return -ENODEV;
	igot = read_vt(pusb_device, 0x001C);
	igot = read_vt(pusb_device, 0x001C);
	if (0 > igot)
	if (0 > igot)
+81 −81

File changed.

Preview size limit exceeded, changes collapsed.

+40 −40

File changed.

Preview size limit exceeded, changes collapsed.

+24 −24

File changed.

Preview size limit exceeded, changes collapsed.

Loading