[PATCH 08/27] habanalabs: add info when FD released while device still in use

Stanislaw Gruszka stanislaw.gruszka at linux.intel.com
Mon Feb 20 15:54:43 UTC 2023


On Fri, Feb 17, 2023 at 11:34:39AM +0000, Tomer Tayar wrote:
 > 
> > Ok, just place replace compose_device_in_use_info() with snprintf().
> > I don't think you need custom implementation of snprintf().
> 
> compose_device_in_use_info() was added to handle in a single place the snprintf() return value and the buffer pointer moving.
> However, you are correct and it is too much here, as the local buffer size is set with a value that should be enough for max possible print.
> We will remove compose_device_in_use_info() and use snprintf() directly.

Actually the safer version would be scnprintf() since for that function
return value could not be bigger than passed len. Usage then could be
as simple as:

n += scnprintf(buf + n, len - n, ...);
n += scnprintf(buf + n, len - n, ...);

Regards
Stanislaw



More information about the dri-devel mailing list