Commit 44fb4b8a authored by Markus Elfring's avatar Markus Elfring Committed by Daniel Vetter

GPU-DRM-GMA500: Delete unnecessary checks before two function calls

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/f1a0fd83-4320-f3db-e1bb-3b9832a4429f@users.sourceforge.net
parent 76e4c327
...@@ -246,8 +246,7 @@ static void cdv_hdmi_destroy(struct drm_connector *connector) ...@@ -246,8 +246,7 @@ static void cdv_hdmi_destroy(struct drm_connector *connector)
{ {
struct gma_encoder *gma_encoder = gma_attached_encoder(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_unregister(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(connector); kfree(connector);
......
...@@ -444,8 +444,7 @@ static void cdv_intel_lvds_destroy(struct drm_connector *connector) ...@@ -444,8 +444,7 @@ static void cdv_intel_lvds_destroy(struct drm_connector *connector)
{ {
struct gma_encoder *gma_encoder = gma_attached_encoder(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_unregister(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(connector); kfree(connector);
...@@ -780,12 +779,10 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -780,12 +779,10 @@ void cdv_intel_lvds_init(struct drm_device *dev,
failed_find: failed_find:
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
printk(KERN_ERR "Failed find\n"); 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: failed_ddc:
printk(KERN_ERR "Failed DDC\n"); 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: failed_blc_i2c:
printk(KERN_ERR "Failed BLC\n"); printk(KERN_ERR "Failed BLC\n");
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
......
...@@ -210,10 +210,8 @@ static int psb_driver_unload(struct drm_device *dev) ...@@ -210,10 +210,8 @@ static int psb_driver_unload(struct drm_device *dev)
iounmap(dev_priv->aux_reg); iounmap(dev_priv->aux_reg);
dev_priv->aux_reg = NULL; dev_priv->aux_reg = NULL;
} }
if (dev_priv->aux_pdev) pci_dev_put(dev_priv->aux_pdev);
pci_dev_put(dev_priv->aux_pdev); pci_dev_put(dev_priv->lpc_pdev);
if (dev_priv->lpc_pdev)
pci_dev_put(dev_priv->lpc_pdev);
/* Destroy VBT data */ /* Destroy VBT data */
psb_intel_destroy_bios(dev); psb_intel_destroy_bios(dev);
......
...@@ -561,8 +561,7 @@ void psb_intel_lvds_destroy(struct drm_connector *connector) ...@@ -561,8 +561,7 @@ void psb_intel_lvds_destroy(struct drm_connector *connector)
struct gma_encoder *gma_encoder = gma_attached_encoder(connector); struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
struct psb_intel_lvds_priv *lvds_priv = gma_encoder->dev_priv; 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_unregister(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(connector); kfree(connector);
...@@ -835,11 +834,9 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -835,11 +834,9 @@ void psb_intel_lvds_init(struct drm_device *dev,
failed_find: failed_find:
mutex_unlock(&dev->mode_config.mutex); 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: 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: failed_blc_i2c:
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
......
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