diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/ethosu_network.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/ethosu_network.c b/kernel/ethosu_network.c index 94354ed..f7871de 100644 --- a/kernel/ethosu_network.c +++ b/kernel/ethosu_network.c @@ -15,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, you can access it online at * http://www.gnu.org/licenses/gpl-2.0.html. - * */ /**************************************************************************** @@ -163,14 +162,21 @@ int ethosu_network_create(struct device *dev, net->buf = NULL; kref_init(&net->kref); - if (uapi->type == ETHOSU_UAPI_NETWORK_BUFFER) { + switch (uapi->type) { + case ETHOSU_UAPI_NETWORK_BUFFER: net->buf = ethosu_buffer_get_from_fd(uapi->fd); if (IS_ERR(net->buf)) { ret = PTR_ERR(net->buf); goto free_net; } - } else { + + break; + case ETHOSU_UAPI_NETWORK_INDEX: net->index = uapi->index; + break; + default: + ret = -EINVAL; + goto free_net; } ret = anon_inode_getfd("ethosu-network", ðosu_network_fops, net, |