diff options
author | Bartosz Golaszewski <brgl@bgdev.pl> | 2018-03-19 10:17:13 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-23 16:25:00 +0100 |
commit | 11288b7c70d89b2587cca3dc5dd004df49ff8daf (patch) | |
tree | 484e30744a0ec46fb5e2a3166f3d22cd274cdf11 /drivers/misc/eeprom/at24.c | |
parent | eeprom: at24: use a helper variable for dev (diff) | |
download | linux-11288b7c70d89b2587cca3dc5dd004df49ff8daf.tar.xz linux-11288b7c70d89b2587cca3dc5dd004df49ff8daf.zip |
eeprom: at24: readability tweak in at24_probe()
Use a helper variable for the size we want to allocate with
devm_kzalloc() and save an ugly line break.
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/eeprom/at24.c')
-rw-r--r-- | drivers/misc/eeprom/at24.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 89b610ac22d3..90adca1251cc 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -523,6 +523,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) struct device *dev = &client->dev; unsigned int i, num_addresses; struct at24_data *at24; + size_t at24_size; bool writable; u8 test_byte; int err; @@ -576,8 +577,8 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) regmap_config.reg_bits = (pdata.flags & AT24_FLAG_ADDR16) ? 16 : 8; regmap_config.disable_locking = true; - at24 = devm_kzalloc(dev, sizeof(struct at24_data) + num_addresses * - sizeof(struct at24_client), GFP_KERNEL); + at24_size = sizeof(*at24) + num_addresses * sizeof(struct at24_client); + at24 = devm_kzalloc(dev, at24_size, GFP_KERNEL); if (!at24) return -ENOMEM; |