Commit fe5a6c48 authored by Felipe Balbi's avatar Felipe Balbi

usb: gadget: storage: get rid of fsg_num_buffers_validate()

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: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 33688abb
...@@ -2655,18 +2655,6 @@ void fsg_common_put(struct fsg_common *common) ...@@ -2655,18 +2655,6 @@ void fsg_common_put(struct fsg_common *common)
} }
EXPORT_SYMBOL_GPL(fsg_common_put); 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) static struct fsg_common *fsg_common_setup(struct fsg_common *common)
{ {
if (!common) { if (!common) {
...@@ -2709,11 +2697,7 @@ static void _fsg_common_free_buffers(struct fsg_buffhd *buffhds, unsigned n) ...@@ -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) int fsg_common_set_num_buffers(struct fsg_common *common, unsigned int n)
{ {
struct fsg_buffhd *bh, *buffhds; struct fsg_buffhd *bh, *buffhds;
int i, rc; int i;
rc = fsg_num_buffers_validate(n);
if (rc != 0)
return rc;
buffhds = kcalloc(n, sizeof(*buffhds), GFP_KERNEL); buffhds = kcalloc(n, sizeof(*buffhds), GFP_KERNEL);
if (!buffhds) if (!buffhds)
...@@ -3401,10 +3385,6 @@ static ssize_t fsg_opts_num_buffers_store(struct config_item *item, ...@@ -3401,10 +3385,6 @@ static ssize_t fsg_opts_num_buffers_store(struct config_item *item,
if (ret) if (ret)
goto end; goto end;
ret = fsg_num_buffers_validate(num);
if (ret)
goto end;
fsg_common_set_num_buffers(opts->common, num); fsg_common_set_num_buffers(opts->common, num);
ret = len; ret = len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment