Skip to content

Commit

Permalink
pch_phub: return -ENODATA if ROM can't be mapped
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Colin Ian King authored and Greg Kroah-Hartman committed Mar 5, 2016
1 parent 7268644 commit a75fa12
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/misc/pch_phub.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,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);
Expand Down

0 comments on commit a75fa12

Please sign in to comment.