@@ -193,7 +193,7 @@ struct sunxi_nand_hw_ecc {
193193struct sunxi_nand_chip {
194194 struct list_head node ;
195195 struct nand_chip nand ;
196- struct sunxi_nand_hw_ecc * ecc ;
196+ struct sunxi_nand_hw_ecc ecc ;
197197 unsigned long clk_rate ;
198198 u32 timing_cfg ;
199199 u32 timing_ctl ;
@@ -694,7 +694,7 @@ static void sunxi_nfc_hw_ecc_enable(struct nand_chip *nand)
694694 ecc_ctl = readl (nfc -> regs + NFC_REG_ECC_CTL );
695695 ecc_ctl &= ~(NFC_ECC_MODE_MSK | NFC_ECC_PIPELINE |
696696 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 ) |
698698 NFC_ECC_EXCEPTION | NFC_ECC_PIPELINE ;
699699
700700 if (nand -> ecc .size == 512 )
@@ -1626,11 +1626,6 @@ static const struct mtd_ooblayout_ops sunxi_nand_ooblayout_ops = {
16261626 .free = sunxi_nand_ooblayout_free ,
16271627};
16281628
1629- static void sunxi_nand_hw_ecc_ctrl_cleanup (struct sunxi_nand_chip * sunxi_nand )
1630- {
1631- kfree (sunxi_nand -> ecc );
1632- }
1633-
16341629static int sunxi_nand_hw_ecc_ctrl_init (struct nand_chip * nand ,
16351630 struct nand_ecc_ctrl * ecc ,
16361631 struct device_node * np )
@@ -1641,7 +1636,6 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
16411636 struct mtd_info * mtd = nand_to_mtd (nand );
16421637 struct nand_device * nanddev = mtd_to_nanddev (mtd );
16431638 int nsectors ;
1644- int ret ;
16451639 int i ;
16461640
16471641 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,
16761670 if (ecc -> size != 512 && ecc -> size != 1024 )
16771671 return - EINVAL ;
16781672
1679- sunxi_nand -> ecc = kzalloc (sizeof (* sunxi_nand -> ecc ), GFP_KERNEL );
1680- if (!sunxi_nand -> ecc )
1681- return - ENOMEM ;
1682-
16831673 /* Prefer 1k ECC chunk over 512 ones */
16841674 if (ecc -> size == 512 && mtd -> writesize > 512 ) {
16851675 ecc -> size = 1024 ;
@@ -1700,11 +1690,10 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
17001690
17011691 if (i >= ARRAY_SIZE (strengths )) {
17021692 dev_err (nfc -> dev , "unsupported strength\n" );
1703- ret = - ENOTSUPP ;
1704- goto err ;
1693+ return - ENOTSUPP ;
17051694 }
17061695
1707- sunxi_nand -> ecc -> mode = i ;
1696+ sunxi_nand -> ecc . mode = i ;
17081697
17091698 /* HW ECC always request ECC bytes for 1024 bytes blocks */
17101699 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,
17141703
17151704 nsectors = mtd -> writesize / ecc -> size ;
17161705
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 ;
17211708
17221709 ecc -> read_oob = sunxi_nfc_hw_ecc_read_oob ;
17231710 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,
17401727 ecc -> write_oob_raw = nand_write_oob_std ;
17411728
17421729 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- }
17621730}
17631731
17641732static int sunxi_nand_attach_chip (struct nand_chip * nand )
@@ -1971,7 +1939,6 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)
19711939 ret = mtd_device_unregister (nand_to_mtd (chip ));
19721940 WARN_ON (ret );
19731941 nand_cleanup (chip );
1974- sunxi_nand_ecc_cleanup (sunxi_nand );
19751942 list_del (& sunxi_nand -> node );
19761943 }
19771944}
0 commit comments