]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: gadget: storage: get rid of fsg_num_buffers_validate()
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 12 May 2016 13:06:41 +0000 (16:06 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 20 Jun 2016 09:30:03 +0000 (12:30 +0300)
valid range for storage buffers is encoded in
Kconfig already. Instead of checking again, let's
drop fsg_num_buffers_validate() altogether.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/f_mass_storage.c

index 5c6d4d7ca6052553faaa3edbbba1f3109593b34f..2505117e88e8bad0f1ce98a49498731634ceaf88 100644 (file)
@@ -2655,18 +2655,6 @@ void fsg_common_put(struct fsg_common *common)
 }
 EXPORT_SYMBOL_GPL(fsg_common_put);
 
-/* check if fsg_num_buffers is within a valid range */
-static inline int fsg_num_buffers_validate(unsigned int fsg_num_buffers)
-{
-#define FSG_MAX_NUM_BUFFERS    32
-
-       if (fsg_num_buffers >= 2 && fsg_num_buffers <= FSG_MAX_NUM_BUFFERS)
-               return 0;
-       pr_err("fsg_num_buffers %u is out of range (%d to %d)\n",
-              fsg_num_buffers, 2, FSG_MAX_NUM_BUFFERS);
-       return -EINVAL;
-}
-
 static struct fsg_common *fsg_common_setup(struct fsg_common *common)
 {
        if (!common) {
@@ -2709,11 +2697,7 @@ static void _fsg_common_free_buffers(struct fsg_buffhd *buffhds, unsigned n)
 int fsg_common_set_num_buffers(struct fsg_common *common, unsigned int n)
 {
        struct fsg_buffhd *bh, *buffhds;
-       int i, rc;
-
-       rc = fsg_num_buffers_validate(n);
-       if (rc != 0)
-               return rc;
+       int i;
 
        buffhds = kcalloc(n, sizeof(*buffhds), GFP_KERNEL);
        if (!buffhds)
@@ -3401,10 +3385,6 @@ static ssize_t fsg_opts_num_buffers_store(struct config_item *item,
        if (ret)
                goto end;
 
-       ret = fsg_num_buffers_validate(num);
-       if (ret)
-               goto end;
-
        fsg_common_set_num_buffers(opts->common, num);
        ret = len;