GPU-DRM-GMA500: Delete unnecessary checks before two function calls
authorMarkus Elfring <elfring@users.sourceforge.net>
Fri, 22 Jul 2016 08:30:30 +0000 (10:30 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 22 Jul 2016 09:31:42 +0000 (11:31 +0200)
The functions pci_dev_put() and psb_intel_i2c_destroy() test whether
their argument is NULL and then return immediately.
Thus the tests around their calls are not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/f1a0fd83-4320-f3db-e1bb-3b9832a4429f@users.sourceforge.net
drivers/gpu/drm/gma500/cdv_intel_hdmi.c
drivers/gpu/drm/gma500/cdv_intel_lvds.c
drivers/gpu/drm/gma500/psb_drv.c
drivers/gpu/drm/gma500/psb_intel_lvds.c

index 28f9d90988ff9164f4a2830c5b621446c821e6db..563f193fcfacf972cbb40499c97e295288a00f9f 100644 (file)
@@ -246,8 +246,7 @@ static void cdv_hdmi_destroy(struct drm_connector *connector)
 {
        struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
 
-       if (gma_encoder->i2c_bus)
-               psb_intel_i2c_destroy(gma_encoder->i2c_bus);
+       psb_intel_i2c_destroy(gma_encoder->i2c_bus);
        drm_connector_unregister(connector);
        drm_connector_cleanup(connector);
        kfree(connector);
index 813ef23a805466299a096dbdf8ccb414a22265f6..38dc890831483c4aef716f33c6b33453c2cc1bef 100644 (file)
@@ -444,8 +444,7 @@ static void cdv_intel_lvds_destroy(struct drm_connector *connector)
 {
        struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
 
-       if (gma_encoder->i2c_bus)
-               psb_intel_i2c_destroy(gma_encoder->i2c_bus);
+       psb_intel_i2c_destroy(gma_encoder->i2c_bus);
        drm_connector_unregister(connector);
        drm_connector_cleanup(connector);
        kfree(connector);
@@ -780,12 +779,10 @@ out:
 failed_find:
        mutex_unlock(&dev->mode_config.mutex);
        printk(KERN_ERR "Failed find\n");
-       if (gma_encoder->ddc_bus)
-               psb_intel_i2c_destroy(gma_encoder->ddc_bus);
+       psb_intel_i2c_destroy(gma_encoder->ddc_bus);
 failed_ddc:
        printk(KERN_ERR "Failed DDC\n");
-       if (gma_encoder->i2c_bus)
-               psb_intel_i2c_destroy(gma_encoder->i2c_bus);
+       psb_intel_i2c_destroy(gma_encoder->i2c_bus);
 failed_blc_i2c:
        printk(KERN_ERR "Failed BLC\n");
        drm_encoder_cleanup(encoder);
index 82b8ce418b276bae50b94c75f1b2b8f40af6b417..50eb944fb78a8e80fe81df7f1dc291f14e16e0f8 100644 (file)
@@ -210,10 +210,8 @@ static int psb_driver_unload(struct drm_device *dev)
                        iounmap(dev_priv->aux_reg);
                        dev_priv->aux_reg = NULL;
                }
-               if (dev_priv->aux_pdev)
-                       pci_dev_put(dev_priv->aux_pdev);
-               if (dev_priv->lpc_pdev)
-                       pci_dev_put(dev_priv->lpc_pdev);
+               pci_dev_put(dev_priv->aux_pdev);
+               pci_dev_put(dev_priv->lpc_pdev);
 
                /* Destroy VBT data */
                psb_intel_destroy_bios(dev);
index b1b93317d054f83c69e1b9c176987d899c24beff..e55733ca46d2a51be77dcaa6ca0b9de39cb632c4 100644 (file)
@@ -561,8 +561,7 @@ void psb_intel_lvds_destroy(struct drm_connector *connector)
        struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
        struct psb_intel_lvds_priv *lvds_priv = gma_encoder->dev_priv;
 
-       if (lvds_priv->ddc_bus)
-               psb_intel_i2c_destroy(lvds_priv->ddc_bus);
+       psb_intel_i2c_destroy(lvds_priv->ddc_bus);
        drm_connector_unregister(connector);
        drm_connector_cleanup(connector);
        kfree(connector);
@@ -835,11 +834,9 @@ out:
 
 failed_find:
        mutex_unlock(&dev->mode_config.mutex);
-       if (lvds_priv->ddc_bus)
-               psb_intel_i2c_destroy(lvds_priv->ddc_bus);
+       psb_intel_i2c_destroy(lvds_priv->ddc_bus);
 failed_ddc:
-       if (lvds_priv->i2c_bus)
-               psb_intel_i2c_destroy(lvds_priv->i2c_bus);
+       psb_intel_i2c_destroy(lvds_priv->i2c_bus);
 failed_blc_i2c:
        drm_encoder_cleanup(encoder);
        drm_connector_cleanup(connector);