[media] siano: remove the bogus firmware lookup code
There is an special lookup code that is called when SMS_BOARD_UNKNOWN. The logic there is bogus and will cause an oops, as .type is SMS_UNKNOWN_TYPE (-1). As the code would do: return smscore_fw_lkup[type][mode]; That would mean that it would try to go past the smscore_fw_lkup table. So, just remove that bogus code, simplifying the logic. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
9711a8a600
commit
e584f9d61e
@ -1048,7 +1048,7 @@ exit_fw_download:
|
|||||||
|
|
||||||
|
|
||||||
static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
|
static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
|
||||||
int mode, int lookup);
|
int mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* loads specified firmware into a buffer and calls device loadfirmware_handler
|
* loads specified firmware into a buffer and calls device loadfirmware_handler
|
||||||
@ -1061,7 +1061,7 @@ static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
|
|||||||
* @return 0 on success, <0 on error.
|
* @return 0 on success, <0 on error.
|
||||||
*/
|
*/
|
||||||
static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
|
static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
|
||||||
int mode, int lookup,
|
int mode,
|
||||||
loadfirmware_t loadfirmware_handler)
|
loadfirmware_t loadfirmware_handler)
|
||||||
{
|
{
|
||||||
int rc = -ENOENT;
|
int rc = -ENOENT;
|
||||||
@ -1069,7 +1069,7 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
|
|||||||
u32 fw_buf_size;
|
u32 fw_buf_size;
|
||||||
const struct firmware *fw;
|
const struct firmware *fw;
|
||||||
|
|
||||||
char *fw_filename = smscore_get_fw_filename(coredev, mode, lookup);
|
char *fw_filename = smscore_get_fw_filename(coredev, mode);
|
||||||
if (!fw_filename) {
|
if (!fw_filename) {
|
||||||
sms_info("mode %d not supported on this device", mode);
|
sms_info("mode %d not supported on this device", mode);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
@ -1268,7 +1268,7 @@ static char *smscore_fw_lkup[][DEVICE_MODE_MAX] = {
|
|||||||
* @return 0 on success, <0 on error.
|
* @return 0 on success, <0 on error.
|
||||||
*/
|
*/
|
||||||
static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
|
static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
|
||||||
int mode, int lookup)
|
int mode)
|
||||||
{
|
{
|
||||||
char **fw;
|
char **fw;
|
||||||
int board_id = smscore_get_board_id(coredev);
|
int board_id = smscore_get_board_id(coredev);
|
||||||
@ -1282,12 +1282,6 @@ static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
|
|||||||
if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX)
|
if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ((board_id == SMS_BOARD_UNKNOWN) || (lookup == 1)) {
|
|
||||||
sms_debug("trying to get fw name from lookup table mode %d type %d",
|
|
||||||
mode, type);
|
|
||||||
return smscore_fw_lkup[type][mode];
|
|
||||||
}
|
|
||||||
|
|
||||||
sms_debug("trying to get fw name from sms_boards board_id %d mode %d",
|
sms_debug("trying to get fw name from sms_boards board_id %d mode %d",
|
||||||
board_id, mode);
|
board_id, mode);
|
||||||
fw = sms_get_board(board_id)->fw;
|
fw = sms_get_board(board_id)->fw;
|
||||||
@ -1373,24 +1367,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
|
|||||||
|
|
||||||
if (!(coredev->modes_supported & (1 << mode))) {
|
if (!(coredev->modes_supported & (1 << mode))) {
|
||||||
rc = smscore_load_firmware_from_file(coredev,
|
rc = smscore_load_firmware_from_file(coredev,
|
||||||
mode, 0, NULL);
|
mode, NULL);
|
||||||
|
|
||||||
/*
|
|
||||||
* try again with the default firmware -
|
|
||||||
* get the fw filename from look-up table
|
|
||||||
*/
|
|
||||||
if (rc < 0) {
|
|
||||||
sms_debug("error %d loading firmware, trying again with default firmware",
|
|
||||||
rc);
|
|
||||||
rc = smscore_load_firmware_from_file(coredev,
|
|
||||||
mode, 1,
|
|
||||||
NULL);
|
|
||||||
if (rc < 0) {
|
|
||||||
sms_debug("error %d loading firmware",
|
|
||||||
rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (rc >= 0)
|
if (rc >= 0)
|
||||||
sms_info("firmware download success");
|
sms_info("firmware download success");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user