| .. | .. |
|---|
| 3 | 3 | |
|---|
| 4 | 4 | #include <linux/list.h> |
|---|
| 5 | 5 | #include <linux/errno.h> |
|---|
| 6 | +#include <linux/net/intel/i40e_client.h> |
|---|
| 6 | 7 | |
|---|
| 7 | 8 | #include "i40e.h" |
|---|
| 8 | 9 | #include "i40e_prototype.h" |
|---|
| 9 | | -#include "i40e_client.h" |
|---|
| 10 | 10 | |
|---|
| 11 | 11 | static const char i40e_client_interface_version_str[] = I40E_CLIENT_VERSION_STR; |
|---|
| 12 | 12 | static struct i40e_client *registered_client; |
|---|
| .. | .. |
|---|
| 178 | 178 | "Cannot locate client instance close routine\n"); |
|---|
| 179 | 179 | return; |
|---|
| 180 | 180 | } |
|---|
| 181 | + if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) { |
|---|
| 182 | + dev_dbg(&pf->pdev->dev, "Client is not open, abort close\n"); |
|---|
| 183 | + return; |
|---|
| 184 | + } |
|---|
| 181 | 185 | cdev->client->ops->close(&cdev->lan_info, cdev->client, reset); |
|---|
| 182 | 186 | clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state); |
|---|
| 183 | 187 | i40e_client_release_qvlist(&cdev->lan_info); |
|---|
| .. | .. |
|---|
| 278 | 282 | /** |
|---|
| 279 | 283 | * i40e_client_add_instance - add a client instance struct to the instance list |
|---|
| 280 | 284 | * @pf: pointer to the board struct |
|---|
| 281 | | - * @client: pointer to a client struct in the client list. |
|---|
| 282 | | - * @existing: if there was already an existing instance |
|---|
| 283 | 285 | * |
|---|
| 284 | 286 | **/ |
|---|
| 285 | 287 | static void i40e_client_add_instance(struct i40e_pf *pf) |
|---|
| .. | .. |
|---|
| 376 | 378 | /* Remove failed client instance */ |
|---|
| 377 | 379 | clear_bit(__I40E_CLIENT_INSTANCE_OPENED, |
|---|
| 378 | 380 | &cdev->state); |
|---|
| 379 | | - i40e_client_del_instance(pf); |
|---|
| 380 | 381 | return; |
|---|
| 381 | 382 | } |
|---|
| 382 | 383 | } |
|---|
| .. | .. |
|---|
| 579 | 580 | struct i40e_hw *hw = &pf->hw; |
|---|
| 580 | 581 | struct i40e_qv_info *qv_info; |
|---|
| 581 | 582 | u32 v_idx, i, reg_idx, reg; |
|---|
| 582 | | - u32 size; |
|---|
| 583 | 583 | |
|---|
| 584 | | - size = sizeof(struct i40e_qvlist_info) + |
|---|
| 585 | | - (sizeof(struct i40e_qv_info) * (qvlist_info->num_vectors - 1)); |
|---|
| 586 | | - ldev->qvlist_info = kzalloc(size, GFP_KERNEL); |
|---|
| 584 | + ldev->qvlist_info = kzalloc(struct_size(ldev->qvlist_info, qv_info, |
|---|
| 585 | + qvlist_info->num_vectors - 1), GFP_KERNEL); |
|---|
| 587 | 586 | if (!ldev->qvlist_info) |
|---|
| 588 | 587 | return -ENOMEM; |
|---|
| 589 | 588 | ldev->qvlist_info->num_vectors = qvlist_info->num_vectors; |
|---|