summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-02-27 14:52:22 +0000
committerJiri Slaby <jslaby@suse.cz>2016-06-15 15:51:46 +0200
commit480268431f91855d05c419807793dd8b25ee4168 (patch)
tree69d4b1d2609f5f679de874d74dde9a671b925737
parent174c1dfbfc54facaa6fd45c28f7ae9adfe6d0f78 (diff)
downloadlwn-480268431f91855d05c419807793dd8b25ee4168.tar.gz
lwn-480268431f91855d05c419807793dd8b25ee4168.zip
pch_phub: return -ENODATA if ROM can't be mapped
commit a75fa128236bc2fdaa5e412145cbd577e42e14c2 upstream. The error return err is not initialized for the case when pci_map_rom fails and no ROM can me mapped. Fix this by setting ret to -ENODATA; (this is the same error value that is returned if the ROM data is successfully mapped but does not match the expected ROM signature.). Issue found from static code analysis using CoverityScan. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Oliver Neukum <oliver@neukum.org> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r--drivers/misc/pch_phub.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index a5925f7f17f6..829ca77c143e 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -512,8 +512,10 @@ static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj,
/* Get Rom signature */
chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size);
- if (!chip->pch_phub_extrom_base_address)
+ if (!chip->pch_phub_extrom_base_address) {
+ err = -ENODATA;
goto exrom_map_err;
+ }
pch_phub_read_serial_rom(chip, chip->pch_opt_rom_start_address,
(unsigned char *)&rom_signature);