summaryrefslogtreecommitdiff
path: root/drivers/net/wwan
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2021-08-11 16:39:32 +0300
committerDavid S. Miller <davem@davemloft.net>2021-08-12 10:55:07 +0100
commit0de6fd5fd51c8c3bbc8e023111ea4fba9b72816b (patch)
treed48bd365e51f0fab56d09f66edcf14f73cc56db4 /drivers/net/wwan
parent7428022b50d0fbb4846dd0f00639ea09d36dff02 (diff)
wwan: core: Unshadow error code returned by ida_alloc_range()
ida_alloc_range() may return other than -ENOMEM error code. Unshadow it in the wwan_create_port(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> Reviewed-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wwan')
-rw-r--r--drivers/net/wwan/wwan_core.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index 674a81d79db3..5f9f57e59b70 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -355,8 +355,8 @@ struct wwan_port *wwan_create_port(struct device *parent,
{
struct wwan_device *wwandev;
struct wwan_port *port;
- int minor, err = -ENOMEM;
char namefmt[0x20];
+ int minor, err;
if (type > WWAN_PORT_MAX || !ops)
return ERR_PTR(-EINVAL);
@@ -370,11 +370,14 @@ struct wwan_port *wwan_create_port(struct device *parent,
/* A port is exposed as character device, get a minor */
minor = ida_alloc_range(&minors, 0, WWAN_MAX_MINORS - 1, GFP_KERNEL);
- if (minor < 0)
+ if (minor < 0) {
+ err = minor;
goto error_wwandev_remove;
+ }
port = kzalloc(sizeof(*port), GFP_KERNEL);
if (!port) {
+ err = -ENOMEM;
ida_free(&minors, minor);
goto error_wwandev_remove;
}