[jpirko-mlxsw:linecards 92/112] drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c:398 mlxfw_firmware_flash() warn: missing error code 'err'
From: Dan Carpenter
Date: Fri Aug 27 2021 - 03:40:37 EST
tree: https://github.com/jpirko/linux_mlxsw linecards
head: a37df1af1f3e6a47a9718298d5e50b842f79b2d2
commit: 6865f62b66dc9b887cfdf27a5a465cc286e8cfcc [92/112] mlxfw: Get the PSID value using op instead of passing it in struct
config: i386-randconfig-m021-20210826 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
smatch warnings:
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c:398 mlxfw_firmware_flash() warn: missing error code 'err'
vim +/err +398 drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c
410ed13cae39df Yotam Gigi 2017-05-23 347 int mlxfw_firmware_flash(struct mlxfw_dev *mlxfw_dev,
44f18db5c16a83 Jiri Pirko 2019-06-04 348 const struct firmware *firmware,
44f18db5c16a83 Jiri Pirko 2019-06-04 349 struct netlink_ext_ack *extack)
410ed13cae39df Yotam Gigi 2017-05-23 350 {
410ed13cae39df Yotam Gigi 2017-05-23 351 struct mlxfw_mfa2_file *mfa2_file;
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 352 bool reactivate_supp = true;
6865f62b66dc9b Jiri Pirko 2021-06-04 353 const char *psid;
6865f62b66dc9b Jiri Pirko 2021-06-04 354 u16 psid_size;
410ed13cae39df Yotam Gigi 2017-05-23 355 u32 fwhandle;
410ed13cae39df Yotam Gigi 2017-05-23 356 int err;
410ed13cae39df Yotam Gigi 2017-05-23 357
410ed13cae39df Yotam Gigi 2017-05-23 358 if (!mlxfw_mfa2_check(firmware)) {
5042e8b97d4176 Saeed Mahameed 2020-02-21 359 MLXFW_ERR_MSG(mlxfw_dev, extack,
5042e8b97d4176 Saeed Mahameed 2020-02-21 360 "Firmware file is not MFA2", -EINVAL);
410ed13cae39df Yotam Gigi 2017-05-23 361 return -EINVAL;
410ed13cae39df Yotam Gigi 2017-05-23 362 }
410ed13cae39df Yotam Gigi 2017-05-23 363
410ed13cae39df Yotam Gigi 2017-05-23 364 mfa2_file = mlxfw_mfa2_file_init(firmware);
f7fe7aa88fa25e Saeed Mahameed 2020-02-21 365 if (IS_ERR(mfa2_file)) {
f7fe7aa88fa25e Saeed Mahameed 2020-02-21 366 err = PTR_ERR(mfa2_file);
5042e8b97d4176 Saeed Mahameed 2020-02-21 367 MLXFW_ERR_MSG(mlxfw_dev, extack,
5042e8b97d4176 Saeed Mahameed 2020-02-21 368 "Failed to initialize MFA2 firmware file", err);
f7fe7aa88fa25e Saeed Mahameed 2020-02-21 369 return err;
f7fe7aa88fa25e Saeed Mahameed 2020-02-21 370 }
410ed13cae39df Yotam Gigi 2017-05-23 371
6a3f707c0051a5 Saeed Mahameed 2020-02-21 372 mlxfw_info(mlxfw_dev, "Initialize firmware flash process\n");
5853c41823ddbf Jiri Pirko 2019-06-04 373 mlxfw_status_notify(mlxfw_dev, "Initializing firmware flash process",
5853c41823ddbf Jiri Pirko 2019-06-04 374 NULL, 0, 0);
410ed13cae39df Yotam Gigi 2017-05-23 375 err = mlxfw_dev->ops->fsm_lock(mlxfw_dev, &fwhandle);
410ed13cae39df Yotam Gigi 2017-05-23 376 if (err) {
5042e8b97d4176 Saeed Mahameed 2020-02-21 377 MLXFW_ERR_MSG(mlxfw_dev, extack,
5042e8b97d4176 Saeed Mahameed 2020-02-21 378 "Could not lock the firmware FSM", err);
410ed13cae39df Yotam Gigi 2017-05-23 379 goto err_fsm_lock;
410ed13cae39df Yotam Gigi 2017-05-23 380 }
410ed13cae39df Yotam Gigi 2017-05-23 381
410ed13cae39df Yotam Gigi 2017-05-23 382 err = mlxfw_fsm_state_wait(mlxfw_dev, fwhandle,
44f18db5c16a83 Jiri Pirko 2019-06-04 383 MLXFW_FSM_STATE_LOCKED, extack);
410ed13cae39df Yotam Gigi 2017-05-23 384 if (err)
410ed13cae39df Yotam Gigi 2017-05-23 385 goto err_state_wait_idle_to_locked;
410ed13cae39df Yotam Gigi 2017-05-23 386
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 387 err = mlxfw_fsm_reactivate(mlxfw_dev, extack, &reactivate_supp);
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 388 if (err)
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 389 goto err_fsm_reactivate;
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 390
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 391 err = mlxfw_fsm_state_wait(mlxfw_dev, fwhandle,
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 392 MLXFW_FSM_STATE_LOCKED, extack);
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 393 if (err)
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 394 goto err_state_wait_reactivate_to_locked;
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 395
6865f62b66dc9b Jiri Pirko 2021-06-04 396 psid = mlxfw_dev->ops->psid_get(mlxfw_dev, &psid_size);
6865f62b66dc9b Jiri Pirko 2021-06-04 397 if (IS_ERR(psid))
6865f62b66dc9b Jiri Pirko 2021-06-04 @398 goto err_psid_get;
err = PTR_ERR(psid);
6865f62b66dc9b Jiri Pirko 2021-06-04 399
6865f62b66dc9b Jiri Pirko 2021-06-04 400 err = mlxfw_flash_components(mlxfw_dev, psid, psid_size,
6865f62b66dc9b Jiri Pirko 2021-06-04 401 fwhandle, mfa2_file,
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 402 reactivate_supp, extack);
6865f62b66dc9b Jiri Pirko 2021-06-04 403 mlxfw_dev->ops->psid_put(psid);
410ed13cae39df Yotam Gigi 2017-05-23 404 if (err)
410ed13cae39df Yotam Gigi 2017-05-23 405 goto err_flash_components;
410ed13cae39df Yotam Gigi 2017-05-23 406
6a3f707c0051a5 Saeed Mahameed 2020-02-21 407 mlxfw_dbg(mlxfw_dev, "Activate image\n");
5853c41823ddbf Jiri Pirko 2019-06-04 408 mlxfw_status_notify(mlxfw_dev, "Activating image", NULL, 0, 0);
410ed13cae39df Yotam Gigi 2017-05-23 409 err = mlxfw_dev->ops->fsm_activate(mlxfw_dev, fwhandle);
410ed13cae39df Yotam Gigi 2017-05-23 410 if (err) {
5042e8b97d4176 Saeed Mahameed 2020-02-21 411 MLXFW_ERR_MSG(mlxfw_dev, extack,
5042e8b97d4176 Saeed Mahameed 2020-02-21 412 "Could not activate the downloaded image", err);
410ed13cae39df Yotam Gigi 2017-05-23 413 goto err_fsm_activate;
410ed13cae39df Yotam Gigi 2017-05-23 414 }
410ed13cae39df Yotam Gigi 2017-05-23 415
44f18db5c16a83 Jiri Pirko 2019-06-04 416 err = mlxfw_fsm_state_wait(mlxfw_dev, fwhandle,
44f18db5c16a83 Jiri Pirko 2019-06-04 417 MLXFW_FSM_STATE_LOCKED, extack);
410ed13cae39df Yotam Gigi 2017-05-23 418 if (err)
410ed13cae39df Yotam Gigi 2017-05-23 419 goto err_state_wait_activate_to_locked;
410ed13cae39df Yotam Gigi 2017-05-23 420
6a3f707c0051a5 Saeed Mahameed 2020-02-21 421 mlxfw_dbg(mlxfw_dev, "Handle release\n");
410ed13cae39df Yotam Gigi 2017-05-23 422 mlxfw_dev->ops->fsm_release(mlxfw_dev, fwhandle);
410ed13cae39df Yotam Gigi 2017-05-23 423
6a3f707c0051a5 Saeed Mahameed 2020-02-21 424 mlxfw_info(mlxfw_dev, "Firmware flash done\n");
5853c41823ddbf Jiri Pirko 2019-06-04 425 mlxfw_status_notify(mlxfw_dev, "Firmware flash done", NULL, 0, 0);
410ed13cae39df Yotam Gigi 2017-05-23 426 mlxfw_mfa2_file_fini(mfa2_file);
410ed13cae39df Yotam Gigi 2017-05-23 427 return 0;
410ed13cae39df Yotam Gigi 2017-05-23 428
410ed13cae39df Yotam Gigi 2017-05-23 429 err_state_wait_activate_to_locked:
410ed13cae39df Yotam Gigi 2017-05-23 430 err_fsm_activate:
410ed13cae39df Yotam Gigi 2017-05-23 431 err_flash_components:
6865f62b66dc9b Jiri Pirko 2021-06-04 432 err_psid_get:
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 433 err_state_wait_reactivate_to_locked:
958dfd0dc6d845 Eran Ben Elisha 2020-02-21 434 err_fsm_reactivate:
410ed13cae39df Yotam Gigi 2017-05-23 435 err_state_wait_idle_to_locked:
410ed13cae39df Yotam Gigi 2017-05-23 436 mlxfw_dev->ops->fsm_release(mlxfw_dev, fwhandle);
410ed13cae39df Yotam Gigi 2017-05-23 437 err_fsm_lock:
410ed13cae39df Yotam Gigi 2017-05-23 438 mlxfw_mfa2_file_fini(mfa2_file);
410ed13cae39df Yotam Gigi 2017-05-23 439 return err;
410ed13cae39df Yotam Gigi 2017-05-23 440 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx