Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: light: tsl2563: Simplify with dev_err_probe

Code can be a bit simpler with dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Ferry Toth <ftoth@exalondelft.nl>
Link: https://lore.kernel.org/r/20221207190348.9347-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
2080c8d3 bbabf919

+11 -18
+11 -18
drivers/iio/light/tsl2563.c
··· 695 695 696 696 static int tsl2563_probe(struct i2c_client *client) 697 697 { 698 + struct device *dev = &client->dev; 698 699 struct iio_dev *indio_dev; 699 700 struct tsl2563_chip *chip; 700 701 struct tsl2563_platform_data *pdata = client->dev.platform_data; 701 702 unsigned long irq_flags; 702 - int err = 0; 703 703 u8 id = 0; 704 + int err; 704 705 705 706 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); 706 707 if (!indio_dev) ··· 713 712 chip->client = client; 714 713 715 714 err = tsl2563_detect(chip); 716 - if (err) { 717 - dev_err(&client->dev, "detect error %d\n", -err); 718 - return err; 719 - } 715 + if (err) 716 + return dev_err_probe(dev, err, "detect error\n"); 720 717 721 718 err = tsl2563_read_id(chip, &id); 722 - if (err) { 723 - dev_err(&client->dev, "read id error %d\n", -err); 724 - return err; 725 - } 719 + if (err) 720 + return dev_err_probe(dev, err, "read id error\n"); 726 721 727 722 mutex_init(&chip->lock); 728 723 ··· 762 765 irq_flags, 763 766 "tsl2563_event", 764 767 indio_dev); 765 - if (err) { 766 - dev_err(&client->dev, "irq request error %d\n", -err); 767 - return err; 768 - } 768 + if (err) 769 + return dev_err_probe(dev, err, "irq request error\n"); 769 770 } 770 771 771 772 err = tsl2563_configure(chip); 772 - if (err) { 773 - dev_err(&client->dev, "configure error %d\n", -err); 774 - return err; 775 - } 773 + if (err) 774 + return dev_err_probe(dev, err, "configure error\n"); 776 775 777 776 INIT_DELAYED_WORK(&chip->poweroff_work, tsl2563_poweroff_work); 778 777 ··· 777 784 778 785 err = iio_device_register(indio_dev); 779 786 if (err) { 780 - dev_err(&client->dev, "iio registration error %d\n", -err); 787 + dev_err_probe(dev, err, "iio registration error\n"); 781 788 goto fail; 782 789 } 783 790