On Fri, Jan 10, 2020 at 08:57:35AM +0100, Jens Wiklander wrote:
drivers/tee/amdtee/core.c 435 static int __init amdtee_driver_init(void) 436 { 437 struct amdtee *amdtee = NULL; ^^^^^^^^^^^^^ 438 struct tee_device *teedev; 439 struct tee_shm_pool *pool = ERR_PTR(-EINVAL); ^^^^^^^^^^^^^^^^^^^^^^^^
These look like they are left overs from one error label style error handling. We're trying to enable the warning about unused assignments so it would be good to get rid of these.
Okay, I will remove unused assignments in the driver.
Is this really such a good idea? I had the impression we were moving in the direction of always assigning default values to variables, unless they are implicitly zero initialized.
All that does is it disables GCC and other static analysis tools from finding uninitialized error bugs. It means we won't be able to turn on the GCC warning about unused assignments. That warning finds bugs where we accidentally use the wrong variable etc. Assigning bogus unused values makes the code more difficult to read.
regards, dan carpenter