asdf

Dan Carpenter
2011-12-06T08:09:22Z

There is a new gcc warning in this function:

drivers/mmc/card/block.c:836:18: warning: ‘arg’ may be used uninitialized in this function [-Wuninitialized]

810 /* The sanitize operation is supported at v4.5 only */
811 if (mmc_can_sanitize(card)) {
812 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
813 EXT_CSD_SANITIZE_START, 1, 0);

1) arg is uninitialized here. mmc_switch() can return -EIO.

814 goto out;
815 }
816
817 from = blk_rq_pos(req);
818 nr = blk_rq_sectors(req);
819
820 if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr))
821 arg = MMC_SECURE_TRIM1_ARG;
822 else
823 arg = MMC_SECURE_ERASE_ARG;
824 retry:
825 if (card->quirks & MMC_QUIRK_INAND_CMD38) {
826 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
827 INAND_CMD38_ARG_EXT_CSD,
828 arg == MMC_SECURE_TRIM1_ARG ?
^^^

3) uninitialized.

829 INAND_CMD38_ARG_SECTRIM1 :
830 INAND_CMD38_ARG_SECERASE,
831 0);
832 if (err)
833 goto out;
834 }
835 err = mmc_erase(card, from, nr, arg);
836 if (!err && arg == MMC_SECURE_TRIM1_ARG) {
837 if (card->quirks & MMC_QUIRK_INAND_CMD38) {
838 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
839 INAND_CMD38_ARG_EXT_CSD,
840 INAND_CMD38_ARG_SECTRIM2,
841 0);
842 if (err)
843 goto out;
844 }
845 err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG);
846 }
847 out:
848 if (err == -EIO && !mmc_blk_reset(md, card->host, type))
849 goto retry;

2) We could maybe hit the goto retry here if the reset works.

regards,
dan carpenter