Re: [PATCH] shared: Fix not calling destroy callback while clearing up handlers

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

 



Hi Szymon,

On Thu, Jan 09, 2014, Szymon Janc wrote:
> @@ -191,8 +191,10 @@ bool io_set_read_handler(struct io *io, io_callback_func_t callback,
>  
>  done:
>  	io->read_callback = callback;
> -	io->read_destroy = destroy;
> -	io->read_data = user_data;
> +	if (callback) {
> +		io->read_destroy = destroy;
> +		io->read_data = user_data;
> +	}
>  
>  	return true;
>  }

You're already checking for the value of callback earlier in the
function, so to avoid another check how about just move these
assignments right before the done: label?

> @@ -252,8 +254,10 @@ bool io_set_write_handler(struct io *io, io_callback_func_t callback,
>  
>  done:
>  	io->write_callback = callback;
> -	io->write_destroy = destroy;
> -	io->write_data = user_data;
> +	if (callback) {
> +		io->write_destroy = destroy;
> +		io->write_data = user_data;
> +	}
>  
>  	return true;
>  }

Same here.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux