]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mmc: debugfs: remove BUG_ON from mmc_ext_csd_open
authorShawn Lin <shawn.lin@rock-chips.com>
Wed, 2 Nov 2016 07:24:39 +0000 (15:24 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 5 Dec 2016 09:31:09 +0000 (10:31 +0100)
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>
drivers/mmc/core/debugfs.c

index c8451ce557ae69da2d01aed9a06c9ca6efbc556f..30623b8b86a42589ed462b5625fd99d546a43b7d 100644 (file)
@@ -321,7 +321,11 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp)
        for (i = 0; i < 512; i++)
                n += sprintf(buf + n, "%02x", ext_csd[i]);
        n += sprintf(buf + n, "\n");
-       BUG_ON(n != EXT_CSD_STR_LEN);
+
+       if (n != EXT_CSD_STR_LEN) {
+               err = -EINVAL;
+               goto out_free;
+       }
 
        filp->private_data = buf;
        kfree(ext_csd);