| .. | .. |
|---|
| 1803 | 1803 | rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE], |
|---|
| 1804 | 1804 | 0, 0xffff); |
|---|
| 1805 | 1805 | err = rio_add_device(rdev); |
|---|
| 1806 | | - if (err) |
|---|
| 1807 | | - goto cleanup; |
|---|
| 1806 | + if (err) { |
|---|
| 1807 | + put_device(&rdev->dev); |
|---|
| 1808 | + return err; |
|---|
| 1809 | + } |
|---|
| 1810 | + |
|---|
| 1808 | 1811 | rio_dev_get(rdev); |
|---|
| 1809 | 1812 | |
|---|
| 1810 | 1813 | return 0; |
|---|
| .. | .. |
|---|
| 1900 | 1903 | |
|---|
| 1901 | 1904 | priv->md = chdev; |
|---|
| 1902 | 1905 | |
|---|
| 1903 | | - mutex_lock(&chdev->file_mutex); |
|---|
| 1904 | | - list_add_tail(&priv->list, &chdev->file_list); |
|---|
| 1905 | | - mutex_unlock(&chdev->file_mutex); |
|---|
| 1906 | | - |
|---|
| 1907 | 1906 | INIT_LIST_HEAD(&priv->db_filters); |
|---|
| 1908 | 1907 | INIT_LIST_HEAD(&priv->pw_filters); |
|---|
| 1909 | 1908 | spin_lock_init(&priv->fifo_lock); |
|---|
| .. | .. |
|---|
| 1912 | 1911 | sizeof(struct rio_event) * MPORT_EVENT_DEPTH, |
|---|
| 1913 | 1912 | GFP_KERNEL); |
|---|
| 1914 | 1913 | if (ret < 0) { |
|---|
| 1914 | + put_device(&chdev->dev); |
|---|
| 1915 | 1915 | dev_err(&chdev->dev, DRV_NAME ": kfifo_alloc failed\n"); |
|---|
| 1916 | 1916 | ret = -ENOMEM; |
|---|
| 1917 | 1917 | goto err_fifo; |
|---|
| .. | .. |
|---|
| 1922 | 1922 | spin_lock_init(&priv->req_lock); |
|---|
| 1923 | 1923 | mutex_init(&priv->dma_lock); |
|---|
| 1924 | 1924 | #endif |
|---|
| 1925 | + mutex_lock(&chdev->file_mutex); |
|---|
| 1926 | + list_add_tail(&priv->list, &chdev->file_list); |
|---|
| 1927 | + mutex_unlock(&chdev->file_mutex); |
|---|
| 1925 | 1928 | |
|---|
| 1926 | 1929 | filp->private_data = priv; |
|---|
| 1927 | 1930 | goto out; |
|---|