diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-19 11:00:23 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-21 06:52:57 -0400 |
commit | e584f9d61ea0aefa81ddd3faf53100536ba4057e (patch) | |
tree | e3fc553dfa9fa583d26c7d799f0f2f8b9f63849c /drivers/media/common | |
parent | 9711a8a600a12d2895c18f31be1fc5b3c4d9b209 (diff) |
[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>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/siano/smscoreapi.c | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c index 44040a60cd77..d57df9170ae1 100644 --- a/drivers/media/common/siano/smscoreapi.c +++ b/drivers/media/common/siano/smscoreapi.c | |||
@@ -1048,7 +1048,7 @@ exit_fw_download: | |||
1048 | 1048 | ||
1049 | 1049 | ||
1050 | static char *smscore_get_fw_filename(struct smscore_device_t *coredev, | 1050 | static char *smscore_get_fw_filename(struct smscore_device_t *coredev, |
1051 | int mode, int lookup); | 1051 | int mode); |
1052 | 1052 | ||
1053 | /** | 1053 | /** |
1054 | * loads specified firmware into a buffer and calls device loadfirmware_handler | 1054 | * 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, | |||
1061 | * @return 0 on success, <0 on error. | 1061 | * @return 0 on success, <0 on error. |
1062 | */ | 1062 | */ |
1063 | static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, | 1063 | static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, |
1064 | int mode, int lookup, | 1064 | int mode, |
1065 | loadfirmware_t loadfirmware_handler) | 1065 | loadfirmware_t loadfirmware_handler) |
1066 | { | 1066 | { |
1067 | int rc = -ENOENT; | 1067 | int rc = -ENOENT; |
@@ -1069,7 +1069,7 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, | |||
1069 | u32 fw_buf_size; | 1069 | u32 fw_buf_size; |
1070 | const struct firmware *fw; | 1070 | const struct firmware *fw; |
1071 | 1071 | ||
1072 | char *fw_filename = smscore_get_fw_filename(coredev, mode, lookup); | 1072 | char *fw_filename = smscore_get_fw_filename(coredev, mode); |
1073 | if (!fw_filename) { | 1073 | if (!fw_filename) { |
1074 | sms_info("mode %d not supported on this device", mode); | 1074 | sms_info("mode %d not supported on this device", mode); |
1075 | return -ENOENT; | 1075 | return -ENOENT; |
@@ -1268,7 +1268,7 @@ static char *smscore_fw_lkup[][DEVICE_MODE_MAX] = { | |||
1268 | * @return 0 on success, <0 on error. | 1268 | * @return 0 on success, <0 on error. |
1269 | */ | 1269 | */ |
1270 | static char *smscore_get_fw_filename(struct smscore_device_t *coredev, | 1270 | static char *smscore_get_fw_filename(struct smscore_device_t *coredev, |
1271 | int mode, int lookup) | 1271 | int mode) |
1272 | { | 1272 | { |
1273 | char **fw; | 1273 | char **fw; |
1274 | int board_id = smscore_get_board_id(coredev); | 1274 | int board_id = smscore_get_board_id(coredev); |
@@ -1282,12 +1282,6 @@ static char *smscore_get_fw_filename(struct smscore_device_t *coredev, | |||
1282 | if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX) | 1282 | if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX) |
1283 | return NULL; | 1283 | return NULL; |
1284 | 1284 | ||
1285 | if ((board_id == SMS_BOARD_UNKNOWN) || (lookup == 1)) { | ||
1286 | sms_debug("trying to get fw name from lookup table mode %d type %d", | ||
1287 | mode, type); | ||
1288 | return smscore_fw_lkup[type][mode]; | ||
1289 | } | ||
1290 | |||
1291 | sms_debug("trying to get fw name from sms_boards board_id %d mode %d", | 1285 | sms_debug("trying to get fw name from sms_boards board_id %d mode %d", |
1292 | board_id, mode); | 1286 | board_id, mode); |
1293 | fw = sms_get_board(board_id)->fw; | 1287 | fw = sms_get_board(board_id)->fw; |
@@ -1373,24 +1367,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) | |||
1373 | 1367 | ||
1374 | if (!(coredev->modes_supported & (1 << mode))) { | 1368 | if (!(coredev->modes_supported & (1 << mode))) { |
1375 | rc = smscore_load_firmware_from_file(coredev, | 1369 | rc = smscore_load_firmware_from_file(coredev, |
1376 | mode, 0, NULL); | 1370 | mode, NULL); |
1377 | |||
1378 | /* | ||
1379 | * try again with the default firmware - | ||
1380 | * get the fw filename from look-up table | ||
1381 | */ | ||
1382 | if (rc < 0) { | ||
1383 | sms_debug("error %d loading firmware, trying again with default firmware", | ||
1384 | rc); | ||
1385 | rc = smscore_load_firmware_from_file(coredev, | ||
1386 | mode, 1, | ||
1387 | NULL); | ||
1388 | if (rc < 0) { | ||
1389 | sms_debug("error %d loading firmware", | ||
1390 | rc); | ||
1391 | return rc; | ||
1392 | } | ||
1393 | } | ||
1394 | if (rc >= 0) | 1371 | if (rc >= 0) |
1395 | sms_info("firmware download success"); | 1372 | sms_info("firmware download success"); |
1396 | } else { | 1373 | } else { |