mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-22 23:21:31 +00:00
fpga: Simplify error path in fpga_add
Check !desc earlier to simplify code. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com> Reviewed-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>
This commit is contained in:
parent
734bf172e9
commit
cda1e3fb0f
1 changed files with 11 additions and 10 deletions
|
@ -148,20 +148,21 @@ int fpga_add(fpga_type devtype, void *desc)
|
||||||
{
|
{
|
||||||
int devnum = FPGA_INVALID_DEVICE;
|
int devnum = FPGA_INVALID_DEVICE;
|
||||||
|
|
||||||
|
if (!desc) {
|
||||||
|
printf("%s: NULL device descriptor\n", __func__);
|
||||||
|
return devnum;
|
||||||
|
}
|
||||||
|
|
||||||
if (next_desc < 0) {
|
if (next_desc < 0) {
|
||||||
printf("%s: FPGA support not initialized!\n", __func__);
|
printf("%s: FPGA support not initialized!\n", __func__);
|
||||||
} else if ((devtype > fpga_min_type) && (devtype < fpga_undefined)) {
|
} else if ((devtype > fpga_min_type) && (devtype < fpga_undefined)) {
|
||||||
if (desc) {
|
if (next_desc < CONFIG_MAX_FPGA_DEVICES) {
|
||||||
if (next_desc < CONFIG_MAX_FPGA_DEVICES) {
|
devnum = next_desc;
|
||||||
devnum = next_desc;
|
desc_table[next_desc].devtype = devtype;
|
||||||
desc_table[next_desc].devtype = devtype;
|
desc_table[next_desc++].devdesc = desc;
|
||||||
desc_table[next_desc++].devdesc = desc;
|
|
||||||
} else {
|
|
||||||
printf("%s: Exceeded Max FPGA device count\n",
|
|
||||||
__func__);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
printf("%s: NULL device descriptor\n", __func__);
|
printf("%s: Exceeded Max FPGA device count\n",
|
||||||
|
__func__);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("%s: Unsupported FPGA type %d\n", __func__, devtype);
|
printf("%s: Unsupported FPGA type %d\n", __func__, devtype);
|
||||||
|
|
Loading…
Add table
Reference in a new issue