Skip to content

Commit e1b4729

Browse files
andy-shevlinusw
authored andcommitted
pinctrl: cy8c95x0: Use temporary variable for struct device
Use a temporary variable for the struct device pointers to avoid dereferencing. This makes code a bit neater. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent f8bd538 commit e1b4729

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/pinctrl/pinctrl-cy8c95x0.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,16 +1429,17 @@ static int cy8c95x0_detect(struct i2c_client *client,
14291429

14301430
static int cy8c95x0_probe(struct i2c_client *client)
14311431
{
1432+
struct device *dev = &client->dev;
14321433
struct cy8c95x0_pinctrl *chip;
14331434
struct regmap_config regmap_conf;
14341435
struct regmap_range_cfg regmap_range_conf;
14351436
int ret;
14361437

1437-
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
1438+
chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
14381439
if (!chip)
14391440
return -ENOMEM;
14401441

1441-
chip->dev = &client->dev;
1442+
chip->dev = dev;
14421443

14431444
/* Set the device type */
14441445
chip->driver_data = (uintptr_t)i2c_get_match_data(client);
@@ -1467,14 +1468,14 @@ static int cy8c95x0_probe(struct i2c_client *client)
14671468
return -ENODEV;
14681469
}
14691470

1470-
ret = devm_regulator_get_enable(&client->dev, "vdd");
1471+
ret = devm_regulator_get_enable(dev, "vdd");
14711472
if (ret)
1472-
return dev_err_probe(&client->dev, ret, "failed to enable regulator vdd\n");
1473+
return dev_err_probe(dev, ret, "failed to enable regulator vdd\n");
14731474

14741475
/* bring the chip out of reset if reset pin is provided */
1475-
chip->gpio_reset = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH);
1476+
chip->gpio_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
14761477
if (IS_ERR(chip->gpio_reset))
1477-
return dev_err_probe(chip->dev, PTR_ERR(chip->gpio_reset), "Failed to get GPIO 'reset'\n");
1478+
return dev_err_probe(dev, PTR_ERR(chip->gpio_reset), "Failed to get GPIO 'reset'\n");
14781479
gpiod_set_consumer_name(chip->gpio_reset, "CY8C95X0 RESET");
14791480
if (chip->gpio_reset) {
14801481
fsleep(1000);

0 commit comments

Comments
 (0)