Re: [PATCH] staging: media: usbvision: Remove comparision to NULL

Hans Verkuil
2023-05-23T11:37:02Z

Hi Anup,

On 02/05/2023 03:05, Anup Sharma wrote:
> Remove comparison to null in file usbvision-core.c and usbvision-i2c.c.
>
> Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>
> ---
> drivers/staging/media/usbvision/usbvision-core.c | 8 ++++----
> drivers/staging/media/usbvision/usbvision-i2c.c | 2 +-
> 2 files changed, 5 insertions(+), 5 deletions(-)

The usbvision driver has been removed almost 2 years ago, so this patch is for
a really old kernel.

Rather odd, but in any case, I'm rejecting this patch for obvious reasons...

Regards,

Hans

>
> diff --git a/drivers/staging/media/usbvision/usbvision-core.c b/drivers/staging/media/usbvision/usbvision-core.c
> index e35dee35b068..a38104b2a0f9 100644
> --- a/drivers/staging/media/usbvision/usbvision-core.c
> +++ b/drivers/staging/media/usbvision/usbvision-core.c
> @@ -349,7 +349,7 @@ int usbvision_scratch_alloc(struct usb_usbvision *usbvision)
> {
> usbvision->scratch = vmalloc_32(scratch_buf_size);
> scratch_reset(usbvision);
> - if (usbvision->scratch == NULL) {
> + if (!usbvision->scratch) {
> dev_err(&usbvision->dev->dev,
> "%s: unable to allocate %d bytes for scratch\n",
> __func__, scratch_buf_size);
> @@ -374,7 +374,7 @@ int usbvision_decompress_alloc(struct usb_usbvision *usbvision)
> int IFB_size = MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * 3 / 2;
>
> usbvision->intra_frame_buffer = vmalloc_32(IFB_size);
> - if (usbvision->intra_frame_buffer == NULL) {
> + if (!usbvision->intra_frame_buffer) {
> dev_err(&usbvision->dev->dev,
> "%s: unable to allocate %d for compr. frame buffer\n",
> __func__, IFB_size);
> @@ -2284,7 +2284,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
> struct urb *urb;
>
> urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
> - if (urb == NULL)
> + if (!urb)
> return -ENOMEM;
> usbvision->sbuf[buf_idx].urb = urb;
> usbvision->sbuf[buf_idx].data =
> @@ -2343,7 +2343,7 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision)
> int buf_idx, err_code, reg_value;
> int sb_size = USBVISION_URB_FRAMES * usbvision->isoc_packet_size;
>
> - if ((usbvision->streaming == stream_off) || (usbvision->dev == NULL))
> + if ((usbvision->streaming == stream_off) || (!usbvision->dev))
> return;
>
> /* Unschedule all of the iso td's */
> diff --git a/drivers/staging/media/usbvision/usbvision-i2c.c b/drivers/staging/media/usbvision/usbvision-i2c.c
> index 6e4df3335b1b..3bba93293463 100644
> --- a/drivers/staging/media/usbvision/usbvision-i2c.c
> +++ b/drivers/staging/media/usbvision/usbvision-i2c.c
> @@ -233,7 +233,7 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision)
> &usbvision->i2c_adap,
> "tuner", 0, v4l2_i2c_tuner_addrs(type));
>
> - if (sd == NULL)
> + if (!sd)
> return -ENODEV;
> if (usbvision->tuner_type != -1) {
> tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;