@@ -193,7 +193,7 @@ struct sunxi_nand_hw_ecc {
193
193
struct sunxi_nand_chip {
194
194
struct list_head node ;
195
195
struct nand_chip nand ;
196
- struct sunxi_nand_hw_ecc * ecc ;
196
+ struct sunxi_nand_hw_ecc ecc ;
197
197
unsigned long clk_rate ;
198
198
u32 timing_cfg ;
199
199
u32 timing_ctl ;
@@ -694,7 +694,7 @@ static void sunxi_nfc_hw_ecc_enable(struct nand_chip *nand)
694
694
ecc_ctl = readl (nfc -> regs + NFC_REG_ECC_CTL );
695
695
ecc_ctl &= ~(NFC_ECC_MODE_MSK | NFC_ECC_PIPELINE |
696
696
NFC_ECC_BLOCK_SIZE_MSK );
697
- ecc_ctl |= NFC_ECC_EN | NFC_ECC_MODE (sunxi_nand -> ecc -> mode ) |
697
+ ecc_ctl |= NFC_ECC_EN | NFC_ECC_MODE (sunxi_nand -> ecc . mode ) |
698
698
NFC_ECC_EXCEPTION | NFC_ECC_PIPELINE ;
699
699
700
700
if (nand -> ecc .size == 512 )
@@ -1626,11 +1626,6 @@ static const struct mtd_ooblayout_ops sunxi_nand_ooblayout_ops = {
1626
1626
.free = sunxi_nand_ooblayout_free ,
1627
1627
};
1628
1628
1629
- static void sunxi_nand_hw_ecc_ctrl_cleanup (struct sunxi_nand_chip * sunxi_nand )
1630
- {
1631
- kfree (sunxi_nand -> ecc );
1632
- }
1633
-
1634
1629
static int sunxi_nand_hw_ecc_ctrl_init (struct nand_chip * nand ,
1635
1630
struct nand_ecc_ctrl * ecc ,
1636
1631
struct device_node * np )
@@ -1641,7 +1636,6 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
1641
1636
struct mtd_info * mtd = nand_to_mtd (nand );
1642
1637
struct nand_device * nanddev = mtd_to_nanddev (mtd );
1643
1638
int nsectors ;
1644
- int ret ;
1645
1639
int i ;
1646
1640
1647
1641
if (nanddev -> ecc .user_conf .flags & NAND_ECC_MAXIMIZE_STRENGTH ) {
@@ -1676,10 +1670,6 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
1676
1670
if (ecc -> size != 512 && ecc -> size != 1024 )
1677
1671
return - EINVAL ;
1678
1672
1679
- sunxi_nand -> ecc = kzalloc (sizeof (* sunxi_nand -> ecc ), GFP_KERNEL );
1680
- if (!sunxi_nand -> ecc )
1681
- return - ENOMEM ;
1682
-
1683
1673
/* Prefer 1k ECC chunk over 512 ones */
1684
1674
if (ecc -> size == 512 && mtd -> writesize > 512 ) {
1685
1675
ecc -> size = 1024 ;
@@ -1700,11 +1690,10 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
1700
1690
1701
1691
if (i >= ARRAY_SIZE (strengths )) {
1702
1692
dev_err (nfc -> dev , "unsupported strength\n" );
1703
- ret = - ENOTSUPP ;
1704
- goto err ;
1693
+ return - ENOTSUPP ;
1705
1694
}
1706
1695
1707
- sunxi_nand -> ecc -> mode = i ;
1696
+ sunxi_nand -> ecc . mode = i ;
1708
1697
1709
1698
/* HW ECC always request ECC bytes for 1024 bytes blocks */
1710
1699
ecc -> bytes = DIV_ROUND_UP (ecc -> strength * fls (8 * 1024 ), 8 );
@@ -1714,10 +1703,8 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
1714
1703
1715
1704
nsectors = mtd -> writesize / ecc -> size ;
1716
1705
1717
- if (mtd -> oobsize < ((ecc -> bytes + 4 ) * nsectors )) {
1718
- ret = - EINVAL ;
1719
- goto err ;
1720
- }
1706
+ if (mtd -> oobsize < ((ecc -> bytes + 4 ) * nsectors ))
1707
+ return - EINVAL ;
1721
1708
1722
1709
ecc -> read_oob = sunxi_nfc_hw_ecc_read_oob ;
1723
1710
ecc -> write_oob = sunxi_nfc_hw_ecc_write_oob ;
@@ -1740,25 +1727,6 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
1740
1727
ecc -> write_oob_raw = nand_write_oob_std ;
1741
1728
1742
1729
return 0 ;
1743
-
1744
- err :
1745
- kfree (sunxi_nand -> ecc );
1746
-
1747
- return ret ;
1748
- }
1749
-
1750
- static void sunxi_nand_ecc_cleanup (struct sunxi_nand_chip * sunxi_nand )
1751
- {
1752
- struct nand_ecc_ctrl * ecc = & sunxi_nand -> nand .ecc ;
1753
-
1754
- switch (ecc -> engine_type ) {
1755
- case NAND_ECC_ENGINE_TYPE_ON_HOST :
1756
- sunxi_nand_hw_ecc_ctrl_cleanup (sunxi_nand );
1757
- break ;
1758
- case NAND_ECC_ENGINE_TYPE_NONE :
1759
- default :
1760
- break ;
1761
- }
1762
1730
}
1763
1731
1764
1732
static int sunxi_nand_attach_chip (struct nand_chip * nand )
@@ -1971,7 +1939,6 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)
1971
1939
ret = mtd_device_unregister (nand_to_mtd (chip ));
1972
1940
WARN_ON (ret );
1973
1941
nand_cleanup (chip );
1974
- sunxi_nand_ecc_cleanup (sunxi_nand );
1975
1942
list_del (& sunxi_nand -> node );
1976
1943
}
1977
1944
}
0 commit comments