Make the function return either 0 or -EINVAL, that is, normal
expected error codes and success codes instead of true/false
nonsense.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <clsee@altera.com>
Cc: Dinh Nguyen <dinguyen@altera.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Tom Rini <trini@ti.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Pavel Machek <pavel@denx.de>
Acked-by: Pavel Machek <pavel@denx.de>
* Altera FPGA support
*/
#include <common.h>
* Altera FPGA support
*/
#include <common.h>
#include <ACEX1K.h>
#include <stratixII.h>
/* Define FPGA_DEBUG to 1 to get debug printf's */
#define FPGA_DEBUG 0
#include <ACEX1K.h>
#include <stratixII.h>
/* Define FPGA_DEBUG to 1 to get debug printf's */
#define FPGA_DEBUG 0
-/* Local Static Functions */
static int altera_validate(Altera_desc *desc, const char *fn)
{
if (!desc) {
printf("%s: NULL descriptor!\n", fn);
static int altera_validate(Altera_desc *desc, const char *fn)
{
if (!desc) {
printf("%s: NULL descriptor!\n", fn);
}
if ((desc->family < min_altera_type) ||
(desc->family > max_altera_type)) {
printf("%s: Invalid family type, %d\n", fn, desc->family);
}
if ((desc->family < min_altera_type) ||
(desc->family > max_altera_type)) {
printf("%s: Invalid family type, %d\n", fn, desc->family);
}
if ((desc->iface < min_altera_iface_type) ||
(desc->iface > max_altera_iface_type)) {
printf("%s: Invalid Interface type, %d\n", fn, desc->iface);
}
if ((desc->iface < min_altera_iface_type) ||
(desc->iface > max_altera_iface_type)) {
printf("%s: Invalid Interface type, %d\n", fn, desc->iface);
}
if (!desc->size) {
printf("%s: NULL part size\n", fn);
}
if (!desc->size) {
printf("%s: NULL part size\n", fn);
}
/* ------------------------------------------------------------------------- */
}
/* ------------------------------------------------------------------------- */
{
int ret_val = FPGA_FAIL; /* assume a failure */
{
int ret_val = FPGA_FAIL; /* assume a failure */
- if (!altera_validate(desc, (char *)__func__)) {
+ if (altera_validate(desc, (char *)__func__)) {
printf("%s: Invalid device descriptor\n", __func__);
return FPGA_FAIL;
}
printf("%s: Invalid device descriptor\n", __func__);
return FPGA_FAIL;
}
{
int ret_val = FPGA_FAIL; /* assume a failure */
{
int ret_val = FPGA_FAIL; /* assume a failure */
- if (!altera_validate (desc, (char *)__func__)) {
+ if (altera_validate(desc, (char *)__func__)) {
printf("%s: Invalid device descriptor\n", __func__);
return FPGA_FAIL;
}
printf("%s: Invalid device descriptor\n", __func__);
return FPGA_FAIL;
}
{
int ret_val = FPGA_FAIL;
{
int ret_val = FPGA_FAIL;
- if (!altera_validate (desc, (char *)__func__)) {
+ if (altera_validate (desc, (char *)__func__)) {
printf("%s: Invalid device descriptor\n", __func__);
return FPGA_FAIL;
}
printf("%s: Invalid device descriptor\n", __func__);
return FPGA_FAIL;
}