i2c_new_device() is not propagating error codes up. Callers will need
to be fixed to use PTR_ERR() to recover the errors.

struct i2c_client *
i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
{
        struct i2c_client       *client;
        int                     status;

        client = kzalloc(sizeof *client, GFP_KERNEL);
        if (!client)
--should return -ENOMEM;
                return NULL;

        client->adapter = adap;

        client->dev.platform_data = info->platform_data;
        device_init_wakeup(&client->dev, info->flags & I2C_CLIENT_WAKE);

        client->flags = info->flags & ~I2C_CLIENT_WAKE;
        client->addr = info->addr;
        client->irq = info->irq;

        strlcpy(client->name, info->type, sizeof(client->name));

        /* a new style driver may be bound to this device when we
         * return from this function, or any later moment (e.g. maybe
         * hotplugging will load the driver module).  and the device
         * refcount model is the standard driver model one.
         */
        status = i2c_attach_client(client);
--error status is not propagated up
        if (status < 0) {
                kfree(client);
                client = NULL;
        }
        return client;
}
EXPORT_SYMBOL_GPL(i2c_new_device);


-- 
Jon Smirl
[EMAIL PROTECTED]

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

Reply via email to