Commit 50c7ad36 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'fpga-fixes-5.15' of...

Merge tag 'fpga-fixes-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/mdf/linux-fpga into char-misc-linus

FPGA Manager fixes for 5.15

Tom and Jiapeng's fixes address smatch warnings around missing return
values in error cases.

Russ' change addresses an issue where registers are being accessed too
early resulting in invalid data being read.

All patches have been reviewed on the mailing list, and have been in the
last few linux-next releases (as part of my fixes branch) without issues.
Signed-off-by: default avatarMoritz Fischer <mdf@kernel.org>

* tag 'fpga-fixes-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/mdf/linux-fpga:
  fpga: dfl: Avoid reads to AFU CSRs during enumeration
  fpga: machxo2-spi: Fix missing error code in machxo2_write_complete()
  fpga: machxo2-spi: Return an error on failure
parents 3e1d5b0f e9a9970b
......@@ -1019,16 +1019,18 @@ create_feature_instance(struct build_feature_devs_info *binfo,
{
unsigned int irq_base, nr_irqs;
struct dfl_feature_info *finfo;
u8 revision = 0;
int ret;
u8 revision;
u64 v;
v = readq(binfo->ioaddr + ofst);
revision = FIELD_GET(DFH_REVISION, v);
if (fid != FEATURE_ID_AFU) {
v = readq(binfo->ioaddr + ofst);
revision = FIELD_GET(DFH_REVISION, v);
/* read feature size and id if inputs are invalid */
size = size ? size : feature_size(v);
fid = fid ? fid : feature_id(v);
/* read feature size and id if inputs are invalid */
size = size ? size : feature_size(v);
fid = fid ? fid : feature_id(v);
}
if (binfo->len - ofst < size)
return -EINVAL;
......
......@@ -225,8 +225,10 @@ static int machxo2_write_init(struct fpga_manager *mgr,
goto fail;
get_status(spi, &status);
if (test_bit(FAIL, &status))
if (test_bit(FAIL, &status)) {
ret = -EINVAL;
goto fail;
}
dump_status_reg(&status);
spi_message_init(&msg);
......@@ -313,6 +315,7 @@ static int machxo2_write_complete(struct fpga_manager *mgr,
dump_status_reg(&status);
if (!test_bit(DONE, &status)) {
machxo2_cleanup(mgr);
ret = -EINVAL;
goto fail;
}
......@@ -335,6 +338,7 @@ static int machxo2_write_complete(struct fpga_manager *mgr,
break;
if (++refreshloop == MACHXO2_MAX_REFRESH_LOOP) {
machxo2_cleanup(mgr);
ret = -EINVAL;
goto fail;
}
} while (1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment