diff options
author | Colin Ian King <colin.king@canonical.com> | 2021-02-18 20:28:37 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-23 14:56:50 +0100 |
commit | 6b72cf128282a4c2191fc2278ba5010c85b51fb6 (patch) | |
tree | ada29bc90f13b1c0bc3c3f949621db8f89ffc11d /drivers | |
parent | 2c137388d685e11cf621b56bf06c4f3a1a8ff7be (diff) | |
download | linux-6b72cf128282a4c2191fc2278ba5010c85b51fb6.tar.bz2 |
drivers/base/cpu: remove redundant assignment of variable retval
The variable retval is being initialized with a value that is never read
and it is being updated later with a new value. Clean this up by
initializing retval to -ENOMEM and remove the assignment to retval
on the !dev failure path.
Kudos to Rafael for the improved fix suggestion.
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210218202837.516231-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/cpu.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 8f1d6569564c..2b9e41377a07 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -409,13 +409,11 @@ __cpu_device_create(struct device *parent, void *drvdata, const char *fmt, va_list args) { struct device *dev = NULL; - int retval = -ENODEV; + int retval = -ENOMEM; dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - retval = -ENOMEM; + if (!dev) goto error; - } device_initialize(dev); dev->parent = parent; |