lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240805110116.177686b0@foz.lan>
Date: Mon, 5 Aug 2024 11:01:26 +0200
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Ricardo Ribalda <ribalda@...omium.org>
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>, Hans Verkuil
 <hverkuil-cisco@...all.nl>, linux-media@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: siano: Simplify smscore_load_firmware_from_file

Em Mon, 05 Aug 2024 07:59:43 +0000
Ricardo Ribalda <ribalda@...omium.org> escreveu:

> The function is never called with a loadfirmware_handler, so we can
> remove some dead code.
> 
> We can also use this as a excuse to remove some unused type definitions.
> 
> This fixes the following smatch warning:
> drivers/media/common/siano/smscoreapi.c:1172 smscore_load_firmware_from_file() error: we previously assumed 'loadfirmware_handler' could be null (see line 1150)
> 
> Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
LGTM.



> ---
> Originally reported by Hans.

Please add a reported-by field.

> ---
>  drivers/media/common/siano/smscoreapi.c | 15 +++++----------
>  drivers/media/common/siano/smscoreapi.h |  4 ----
>  2 files changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c
> index b6f1eb5dbbdf..3732367e0c62 100644
> --- a/drivers/media/common/siano/smscoreapi.c
> +++ b/drivers/media/common/siano/smscoreapi.c
> @@ -1132,8 +1132,7 @@ static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
>   * return: 0 on success, <0 on error.
>   */
>  static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
> -					   int mode,
> -					   loadfirmware_t loadfirmware_handler)
> +					   int mode)
>  {
>  	int rc = -ENOENT;
>  	u8 *fw_buf;
> @@ -1147,8 +1146,7 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
>  	}
>  	pr_debug("Firmware name: %s\n", fw_filename);
>  
> -	if (!loadfirmware_handler &&
> -	    !(coredev->device_flags & SMS_DEVICE_FAMILY2))
> +	if (!(coredev->device_flags & SMS_DEVICE_FAMILY2))
>  		return -EINVAL;
>  
>  	rc = request_firmware(&fw, fw_filename, coredev->device);
> @@ -1166,10 +1164,8 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
>  		memcpy(fw_buf, fw->data, fw->size);
>  		fw_buf_size = fw->size;
>  
> -		rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ?
> -			smscore_load_firmware_family2(coredev, fw_buf, fw_buf_size)
> -			: loadfirmware_handler(coredev->context, fw_buf,
> -			fw_buf_size);
> +		rc = smscore_load_firmware_family2(coredev, fw_buf,
> +						   fw_buf_size);
>  	}
>  
>  	kfree(fw_buf);
> @@ -1353,8 +1349,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
>  		}
>  
>  		if (!(coredev->modes_supported & (1 << mode))) {
> -			rc = smscore_load_firmware_from_file(coredev,
> -							     mode, NULL);
> +			rc = smscore_load_firmware_from_file(coredev, mode);
>  			if (rc >= 0)
>  				pr_debug("firmware download success\n");
>  		} else {
> diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h
> index 82d9f8a64d99..3c15082ce0e3 100644
> --- a/drivers/media/common/siano/smscoreapi.h
> +++ b/drivers/media/common/siano/smscoreapi.h
> @@ -97,7 +97,6 @@ typedef int (*hotplug_t)(struct smscore_device_t *coredev,
>  typedef int (*setmode_t)(void *context, int mode);
>  typedef void (*detectmode_t)(void *context, int *mode);
>  typedef int (*sendrequest_t)(void *context, void *buffer, size_t size);
> -typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size);
>  typedef int (*preload_t)(void *context);
>  typedef int (*postload_t)(void *context);
>  
> @@ -1102,9 +1101,6 @@ extern int smscore_register_device(struct smsdevice_params_t *params,
>  extern void smscore_unregister_device(struct smscore_device_t *coredev);
>  
>  extern int smscore_start_device(struct smscore_device_t *coredev);
> -extern int smscore_load_firmware(struct smscore_device_t *coredev,
> -				 char *filename,
> -				 loadfirmware_t loadfirmware_handler);
>  
>  extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode);
>  extern int smscore_get_device_mode(struct smscore_device_t *coredev);
> 
> ---
> base-commit: 2c25dcc2361949bc7da730d22de36c019c6bf1e3
> change-id: 20240805-siano-c4c6a1106a39
> 
> Best regards,



Thanks,
Mauro

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ