Re: [PATCH] sh: maple: add Maple controller as a joystick device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 20 December 2008 13:26:54 Adrian McMenamin wrote:
> +static int probe_maple_controller(struct device *dev)
> +{
> ...
> +	mdev = to_maple_dev(dev);
> +	if (!mdev) {
> +		error = EINVAL;
> +		goto fail;
> +	}
> +
> +	mdrv = to_maple_driver(dev->driver);
> +	if (!mdrv) {
> +		error = EINVAL;
> +		goto fail;
> +	}

like Dmitry said, these NULL checks make no sense

> +	pad = kzalloc(sizeof(struct dc_pad), GFP_KERNEL);
> +	if (!pad) {
> +		error = ENOMEM;
> +		goto fail;
> +	}
> +	idev = input_allocate_device();
> +	if (!idev){
> +		error = ENOMEM;
> +		goto fail_idev;
> +	}
> ...
> +	error = input_register_device(idev);
> +	if (error)
> +		goto fail_register;
> ...
> +fail_register:
> +	maple_set_drvdata(mdev, NULL);
> +	input_free_device(pad->dev);
> +fail_idev:
> +	kfree(pad);
> +fail:
> +	return -error;
> +}

this -error stuff is weird and i think wrong.  for constants, you're adding 
overhead, and for the input_register_device(), i think you're negating an 
already negative value thus breaking it.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux