Message ID | 20220209045035.380615-5-tzungbi@google.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | platform/chrome: cros_ec: miscellaneous cleanups | expand |
Hi, On Tue, Feb 8, 2022 at 8:51 PM Tzung-Bi Shih <tzungbi@google.com> wrote: > > `err` in cros_ec_register() doesn't need to be initialized. What is the issue with it being initialized to 0? This doesn't strike me as necessary.
On Tue, Feb 08, 2022 at 10:08:59PM -0800, Prashant Malani wrote: > On Tue, Feb 8, 2022 at 8:51 PM Tzung-Bi Shih <tzungbi@google.com> wrote: > > > > `err` in cros_ec_register() doesn't need to be initialized. > > What is the issue with it being initialized to 0? This doesn't strike > me as necessary. Although it might be optimized out, the initialization is redundant. `err` is going to be overridden soon at [1]. [1]: https://elixir.bootlin.com/linux/v5.17-rc3/source/drivers/platform/chrome/cros_ec.c#L203 The patch makes the code concise and reduces the code size (hopefully!). It's fine to drop the change if the code wouldn't bother you.
diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index a97a47ae0472..c2105621b368 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -182,7 +182,7 @@ static int cros_ec_ready_event(struct notifier_block *nb, int cros_ec_register(struct cros_ec_device *ec_dev) { struct device *dev = ec_dev->dev; - int err = 0; + int err; BLOCKING_INIT_NOTIFIER_HEAD(&ec_dev->event_notifier);
`err` in cros_ec_register() doesn't need to be initialized. Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> --- drivers/platform/chrome/cros_ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)