On Fri, Oct 15, 2021 at 5:49 PM Eugene Shalygin <eugene.shalygin@xxxxxxxxx> wrote: > On Fri, 15 Oct 2021 at 16:37, Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote: ... > > I didn't get it. If there is a strong endianess expected the parameter > > should be __le16 or __be16, moreover it seems it missed the const > > qualifier. Any preparatory stuff should be done in the > > asus_wmi_ec_make_block_read_query() which prepares the input buffer, > > doesn't it? > > We need to produce and parse a, roughly speaking, hex-BSTR to pass it > to the WMI function (save for its size parameter of 16 bits instead of > 32 for the BSTR). bin/hex conversion functions accept/output UTF-8 > strings and thus require an intermediate buffer and additional utf-8 > <-> utf-16 conversion. Do you insist that a loop with a stride of 4 is > a homegrown library already? The code deserves a very good comment. And even if you want to keep functionality, replace homegrown library calls. ... > > > > What's the point of calling acpi_os_free(obj) when you already know it's NULL? > > > > > > The case when obj->type != ACPI_TYPE_BUFFER > > > > Read my comment again, please. > > I did it twice already and still can't understand. The WMI method can > return a string, for example, which is an error for our code, but the > buffer needs to be freed. You cut the context, but I think I meant if (!obj) return -ENOMEM; if (!obj->...) { free(); return -EIO; } -- With Best Regards, Andy Shevchenko