Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: debugfs: remove BUG_ON from mmc_ext_csd_open

Return error value for file_operations callback instead
of triggering BUG_ON which is meaningless. Personally I
don't believe n != EXT_CSD_STR_LEN could happen. Anyway,
propagate the error to the caller.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Shawn Lin and committed by
Ulf Hansson
a48ee3e6 5df0e823

+5 -1
+5 -1
drivers/mmc/core/debugfs.c
··· 321 321 for (i = 0; i < 512; i++) 322 322 n += sprintf(buf + n, "%02x", ext_csd[i]); 323 323 n += sprintf(buf + n, "\n"); 324 - BUG_ON(n != EXT_CSD_STR_LEN); 324 + 325 + if (n != EXT_CSD_STR_LEN) { 326 + err = -EINVAL; 327 + goto out_free; 328 + } 325 329 326 330 filp->private_data = buf; 327 331 kfree(ext_csd);