.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * NCI based driver for Samsung S3FWRN5 NFC chip |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2015 Samsung Electrnoics |
---|
5 | 6 | * Robert Baldyga <r.baldyga@samsung.com> |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or modify it |
---|
8 | | - * under the terms and conditions of the GNU General Public License, |
---|
9 | | - * version 2 or later, as published by the Free Software Foundation. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License |
---|
17 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
---|
18 | 7 | */ |
---|
19 | 8 | |
---|
20 | 9 | #include <linux/completion.h> |
---|
.. | .. |
---|
361 | 350 | } |
---|
362 | 351 | |
---|
363 | 352 | static inline bool |
---|
364 | | -s3fwrn5_fw_is_custom(struct s3fwrn5_fw_cmd_get_bootinfo_rsp *bootinfo) |
---|
| 353 | +s3fwrn5_fw_is_custom(const struct s3fwrn5_fw_cmd_get_bootinfo_rsp *bootinfo) |
---|
365 | 354 | { |
---|
366 | 355 | return !!bootinfo->hw_version[2]; |
---|
367 | 356 | } |
---|
.. | .. |
---|
412 | 401 | return ret; |
---|
413 | 402 | } |
---|
414 | 403 | |
---|
415 | | -bool s3fwrn5_fw_check_version(struct s3fwrn5_fw_info *fw_info, u32 version) |
---|
| 404 | +bool s3fwrn5_fw_check_version(const struct s3fwrn5_fw_info *fw_info, u32 version) |
---|
416 | 405 | { |
---|
417 | 406 | struct s3fwrn5_fw_version *new = (void *) &fw_info->fw.version; |
---|
418 | 407 | struct s3fwrn5_fw_version *old = (void *) &version; |
---|
.. | .. |
---|
447 | 436 | goto out; |
---|
448 | 437 | } |
---|
449 | 438 | |
---|
450 | | - { |
---|
451 | | - SHASH_DESC_ON_STACK(desc, tfm); |
---|
452 | | - |
---|
453 | | - desc->tfm = tfm; |
---|
454 | | - desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP; |
---|
455 | | - |
---|
456 | | - ret = crypto_shash_digest(desc, fw->image, image_size, |
---|
457 | | - hash_data); |
---|
458 | | - shash_desc_zero(desc); |
---|
459 | | - } |
---|
| 439 | + ret = crypto_shash_tfm_digest(tfm, fw->image, image_size, hash_data); |
---|
460 | 440 | |
---|
461 | 441 | crypto_free_shash(tfm); |
---|
462 | 442 | if (ret) { |
---|
.. | .. |
---|
521 | 501 | struct s3fwrn5_info *info = nci_get_drvdata(ndev); |
---|
522 | 502 | struct s3fwrn5_fw_info *fw_info = &info->fw_info; |
---|
523 | 503 | |
---|
524 | | - BUG_ON(fw_info->rsp); |
---|
| 504 | + if (WARN_ON(fw_info->rsp)) { |
---|
| 505 | + kfree_skb(skb); |
---|
| 506 | + return -EINVAL; |
---|
| 507 | + } |
---|
525 | 508 | |
---|
526 | 509 | fw_info->rsp = skb; |
---|
527 | 510 | |
---|