Messages in this thread | | | Date | Thu, 9 Jun 2022 08:44:14 +0000 | From | Tzung-Bi Shih <> | Subject | Re: [PATCH v3 16/23] platform/chrome: cros_ec_proto: return 0 on getting cmd mask success |
| |
On Wed, Jun 08, 2022 at 09:20:29AM -0700, Guenter Roeck wrote: > On Wed, Jun 8, 2022 at 4:08 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote: > > > > cros_ec_get_host_command_version_mask() used to return value from > > send_command() which is number of available bytes for input payload on > > success (i.e. sizeof(struct ec_response_get_cmd_versions)). > > > > However, the callers don't need to know how many bytes are available. > > > > Don't return number of available bytes. Instead, return 0 on success; > > otherwise, negative integers on error. > > > > Also remove the unneeded `ver_mask` initialization as the callers should > > take it only if cros_ec_get_host_command_version_mask() returns 0. > > Make sure this compiles with W=1. Compilers may think that ver_mask > may be uninitialized when used.
If I tested it correctly, it compiles.
$ make mrproper $ make allmodconfig $ make W=1 drivers/platform/chrome/ ... CC drivers/platform/chrome/cros_ec_proto.o CC drivers/platform/chrome/cros_ec_trace.o AR drivers/platform/chrome/built-in.a CC [M] drivers/platform/chrome/chromeos_acpi.o CC [M] drivers/platform/chrome/chromeos_laptop.o CC [M] drivers/platform/chrome/chromeos_privacy_screen.o CC [M] drivers/platform/chrome/chromeos_pstore.o CC [M] drivers/platform/chrome/chromeos_tbmc.o CC [M] drivers/platform/chrome/cros_ec.o ...
| |