Merge branch 'linus' into sched/devel
[pandora-kernel.git] / arch / powerpc / sysdev / qe_lib / ucc_slow.c
index b2870b2..e1d6a13 100644 (file)
@@ -142,7 +142,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
 
        /* check if the UCC port number is in range. */
        if ((us_info->ucc_num < 0) || (us_info->ucc_num > UCC_MAX_NUM - 1)) {
-               printk(KERN_ERR "%s: illegal UCC number\n", __FUNCTION__);
+               printk(KERN_ERR "%s: illegal UCC number\n", __func__);
                return -EINVAL;
        }
 
@@ -161,7 +161,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
        uccs = kzalloc(sizeof(struct ucc_slow_private), GFP_KERNEL);
        if (!uccs) {
                printk(KERN_ERR "%s: Cannot allocate private data\n",
-                       __FUNCTION__);
+                       __func__);
                return -ENOMEM;
        }
 
@@ -170,7 +170,8 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
        /* Set the PHY base address */
        uccs->us_regs = ioremap(us_info->regs, sizeof(struct ucc_slow));
        if (uccs->us_regs == NULL) {
-               printk(KERN_ERR "%s: Cannot map UCC registers\n", __FUNCTION__);
+               printk(KERN_ERR "%s: Cannot map UCC registers\n", __func__);
+               kfree(uccs);
                return -ENOMEM;
        }
 
@@ -189,7 +190,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
        uccs->us_pram_offset =
                qe_muram_alloc(UCC_SLOW_PRAM_SIZE, ALIGNMENT_OF_UCC_SLOW_PRAM);
        if (IS_ERR_VALUE(uccs->us_pram_offset)) {
-               printk(KERN_ERR "%s: cannot allocate MURAM for PRAM", __FUNCTION__);
+               printk(KERN_ERR "%s: cannot allocate MURAM for PRAM", __func__);
                ucc_slow_free(uccs);
                return -ENOMEM;
        }
@@ -202,7 +203,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
        /* Set UCC to slow type */
        ret = ucc_set_type(us_info->ucc_num, UCC_SPEED_TYPE_SLOW);
        if (ret) {
-               printk(KERN_ERR "%s: cannot set UCC type", __FUNCTION__);
+               printk(KERN_ERR "%s: cannot set UCC type", __func__);
                ucc_slow_free(uccs);
                return ret;
        }
@@ -216,7 +217,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
                qe_muram_alloc(us_info->rx_bd_ring_len * sizeof(struct qe_bd),
                                QE_ALIGNMENT_OF_BD);
        if (IS_ERR_VALUE(uccs->rx_base_offset)) {
-               printk(KERN_ERR "%s: cannot allocate %u RX BDs\n", __FUNCTION__,
+               printk(KERN_ERR "%s: cannot allocate %u RX BDs\n", __func__,
                        us_info->rx_bd_ring_len);
                uccs->rx_base_offset = 0;
                ucc_slow_free(uccs);
@@ -227,7 +228,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
                qe_muram_alloc(us_info->tx_bd_ring_len * sizeof(struct qe_bd),
                        QE_ALIGNMENT_OF_BD);
        if (IS_ERR_VALUE(uccs->tx_base_offset)) {
-               printk(KERN_ERR "%s: cannot allocate TX BDs", __FUNCTION__);
+               printk(KERN_ERR "%s: cannot allocate TX BDs", __func__);
                uccs->tx_base_offset = 0;
                ucc_slow_free(uccs);
                return -ENOMEM;
@@ -317,7 +318,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
                if (ucc_set_qe_mux_rxtx(us_info->ucc_num, us_info->rx_clock,
                                        COMM_DIR_RX)) {
                        printk(KERN_ERR "%s: illegal value for RX clock\n",
-                              __FUNCTION__);
+                              __func__);
                        ucc_slow_free(uccs);
                        return -EINVAL;
                }
@@ -325,7 +326,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
                if (ucc_set_qe_mux_rxtx(us_info->ucc_num, us_info->tx_clock,
                                        COMM_DIR_TX)) {
                        printk(KERN_ERR "%s: illegal value for TX clock\n",
-                              __FUNCTION__);
+                              __func__);
                        ucc_slow_free(uccs);
                        return -EINVAL;
                }
@@ -367,10 +368,11 @@ void ucc_slow_free(struct ucc_slow_private * uccs)
        if (uccs->tx_base_offset)
                qe_muram_free(uccs->tx_base_offset);
 
-       if (uccs->us_pram) {
+       if (uccs->us_pram)
                qe_muram_free(uccs->us_pram_offset);
-               uccs->us_pram = NULL;
-       }
+
+       if (uccs->us_regs)
+               iounmap(uccs->us_regs);
 
        kfree(uccs);
 }