On Tue, Oct 30, 2012 at 3:07 PM, Philip Rakity <[email protected]> wrote:
> The intent is if there is no regulator should hit this if statement.
>
> + if (IS_ERR(host->vqmmc)) {
> + pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc));
> + host->vqmmc = NULL;
There's a bug here then.
When there is no regulator, host->vqmmc is NULL.
NULL is not an error recognised by IS_ERR.
Double checked this with a simple test:
#include <stdio.h>
#define MAX_ERRNO 4095
#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)
static inline long IS_ERR(const void *ptr)
{
return IS_ERR_VALUE((unsigned long)ptr);
}
int main(void)
{
if (IS_ERR(NULL))
printf("NULL is error\n");
else
printf("NULL is not error\n");
}
result: NULL is not error
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html