When kzalloc() fails and state is NULL, no error return code is
assigned.
To fix this bug, __ret is assigned with -ENOMEM in this case.
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
        }                                                               \
        if (0 == __ret) {                                               \
                state = kzalloc(sizeof(type), GFP_KERNEL);              \
-               if (NULL == state)                                      \
+               if (!state) {                                           \
+                       __ret = -ENOMEM;                                \
                        goto __fail;                                    \
+               }                                                       \
                state->i2c_props.addr = i2caddr;                        \
                state->i2c_props.adap = i2cadap;                        \
                state->i2c_props.name = devname;                        \