[media] v4l2-common: Delete an unnecessary check before the function call "spi_unregi...
authorMarkus Elfring <elfring@users.sourceforge.net>
Tue, 19 Jul 2016 17:54:16 +0000 (14:54 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 24 Aug 2016 12:41:37 +0000 (09:41 -0300)
The spi_unregister_device() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/v4l2-core/v4l2-common.c

index 5b80850..57cfe26 100644 (file)
@@ -291,7 +291,7 @@ struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev,
 error:
        /* If we have a client but no subdev, then something went wrong and
           we must unregister the client. */
-       if (spi && sd == NULL)
+       if (!sd)
                spi_unregister_device(spi);
 
        return sd;