Re: [PATCH 2/3 v3] P4080/mtd: Only make elbc nand driver detect nand flash partitions
From: Anton Vorontsov <hidden>
Date: 2010-09-16 10:14:34
From: Anton Vorontsov <hidden>
Date: 2010-09-16 10:14:34
On Thu, Sep 16, 2010 at 06:08:14PM +0800, Zang Roy-R61911 wrote: [...]
Interesting.
How about this?
#include <stdio.h>
#include <malloc.h>
char *foo;
void probe(void)
{
char *bar = NULL;
if (!foo) {
bar = malloc(sizeof(*bar));
if (!bar)
return;
foo = bar;
} else
bar = foo;This willl work of course; but I'd write it as foo_lock(); if (!foo) foo = alloc(); foo_unlock(); bar = foo; bar->baz; -- Anton Vorontsov email: cbouatmailru@gmail.com irc://irc.freenode.net/bd2