Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1491111lqo; Sun, 12 May 2024 05:10:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUekseOFThvZTdfGI5MGwEvMFgaJw+4a2PeUQbCLghAE8OarPwLoLOUDPd91BauaH8XPzp+KFRL99FdZnb+4ObDHxJF6mIuHXGDmKLfxA== X-Google-Smtp-Source: AGHT+IFgUnLrPShSDt69mp5jbhajOlB7ObmT1K780M1lROhYZpxsYK/es4iFL5K3aDUg+EkL2Owt X-Received: by 2002:a05:622a:c9:b0:43d:f531:8b4e with SMTP id d75a77b69052e-43dfdb1bc9emr87713681cf.34.1715515813868; Sun, 12 May 2024 05:10:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715515813; cv=pass; d=google.com; s=arc-20160816; b=nMrcDgQAl+M1DFRVS3ADImUE8oQM4/H8Wpum2z9RHzTBss6jDAIyh6KeK7ELRLtTyz fRXNArDpH1WOzQJO6koal5DtZhvMtv/zzyaGecWH4TC7D4TB2F0tNZPzW3ped8VfItpz pKfWJWpX5AOr8eYkcAoovfDIJoYzflt4fBXTJx2TYibt6cyvcyc2+tHzCi8j7vaHQtOh zhct3wQzKs0xsIqozDKm7TWx14yn9odRYhNCHIHKcTvtrXiHK+PkeO7bvg2GA81uc9z1 SHKoWWvNBjeqg7ixfPZ5NO/kjt8O2iTgKTBz3/oTUMnVYxn/o+uHMOqxNJ4BKsIUyvfz nvlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=vIsuNdE1/OyOXJ+M6t40jcsQZQcrp20C9xXp9rXxyYs=; fh=ULxNTxaaQIEX8Y9ih2rqqI9Lxn2bbvdaV8tkS1+QGD8=; b=ZPiDz+MSQOCPa+Ra16fk+yKeKXFmAx8hVI+5utlb6GgJOESu6CQI2vl8sbRAofvH+0 rcMyoHT42sbCJw43tF0d2ZMP8wO1B/FW4+xf0LWLUdssplyXZ1/G+EBybd0gZi5zwT/b e3JdtfKkFPlFfAVfnqG6vMREeQjCPGDBo/f2sQm3/zZbF48bAN452FKA2J6yDfehB5vh ygb5aQ5IS0iF8Q9LS0N5cR9iPNJ3wJQ3smFJRkCDmd7dDy1Ekak3iClsTws49RDYsFCX w6rzi6Z5bRi/SpaO9aL0CitBeDMCDYAk13VL8RRmI0CQ3I6Dx0+Y18NnAykvPRpQg2fx KruQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yb4Zqhv9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176867-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176867-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df549f963si80548551cf.43.2024.05.12.05.10.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 05:10:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176867-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yb4Zqhv9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176867-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176867-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8B75B1C2091A for ; Sun, 12 May 2024 12:10:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFC7F20B33; Sun, 12 May 2024 12:10:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Yb4Zqhv9" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBFFD208B8; Sun, 12 May 2024 12:10:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715515804; cv=none; b=QGTWK/BbQULeOpROiUoecJadRz2jquHXTt0/NgwcQA7yfgnOqnE2XWdg46JwDD8KmMQUpV2UVZqCcH7K45AQkvxjKRZzOdJXgHISdIJ7MRqQqOXq2o8WdkAu+PI1qWgZKROB7JatkJDGNdT3JYpMjGba0unpqE3sEmeULA9lY60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715515804; c=relaxed/simple; bh=9fg9w4sc2Wp7eS0TtPRk2TnReOIj6kdvPXdq3S8Qk5k=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ss8NmyvJ5W4+SOw3BoIR2xNg3uGiCAucPMtQsE+SPq9uRH1KuIXZknsV85/AqQnUhjchEEwWbG7bhLxOdIpq0LSrksUgbAqUCIDrgPXD0vv7Cg0c49yNiZXINJypKriqAGLhfeYU8eSyWUg2YNKyWCNQJJQDBmF2RpSak2LfZLU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Yb4Zqhv9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2B20C116B1; Sun, 12 May 2024 12:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715515804; bh=9fg9w4sc2Wp7eS0TtPRk2TnReOIj6kdvPXdq3S8Qk5k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Yb4Zqhv9je/El2N24vM4Ux+OPIHmA2RTlb+dewBJHDEgJVeeiM5Jo8RXd45rAZaAh yF8t7djOvglQKG5ENft8XdQ8JLJalhaXh4bfbdDMb3B4+czXRBJ3qmfxWNG8g0K2jm rzPMQ/GHv+VgJ3eaFSuExzNFms21vNyObiQzg1WoJz/jCsnminRPijEW3+0dHnystK UyWmhilR2Na09AMV0l2GDoKZW0DoFl1sH6EY2VBe/+O/tRzTrrco8wv3pxbzHEKUbK tTABtyuF3fZmocbojhw3MmR8aCwC3y7+/KXsD2EmQ0bgnJeXcw8tWUjuwM1f4HwIWR c2OABTmyHp1pw== Date: Sun, 12 May 2024 13:09:50 +0100 From: Jonathan Cameron To: Vasileios Amoiridis Cc: lars@metafoo.de, andriy.shevchenko@linux.intel.com, ang.iglesiasg@gmail.com, mazziesaccount@gmail.com, ak@it-klinger.de, petre.rodan@subdimension.ro, phil@raspberrypi.com, 579lpy@gmail.com, linus.walleij@linaro.org, semen.protsenko@linaro.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 2/9] iio: pressure: bmp280: Remove, add and update error messages Message-ID: <20240512130950.4d5ab874@jic23-huawei> In-Reply-To: <20240508165207.145554-3-vassilisamir@gmail.com> References: <20240508165207.145554-1-vassilisamir@gmail.com> <20240508165207.145554-3-vassilisamir@gmail.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 8 May 2024 18:52:00 +0200 Vasileios Amoiridis wrote: > Remove duplicate error messages, add missing error messages and > update redundant ones. > > Signed-off-by: Vasileios Amoiridis Hi Vasileios, Ideally the one case where you are adding a missing error check should have been a separate patch, but instead of splitting it I've just added a note on that to the commit message. Applied Jonathan > --- > drivers/iio/pressure/bmp280-core.c | 55 +++++++++++++++++++++--------- > 1 file changed, 38 insertions(+), 17 deletions(-) > > diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c > index 311a011604da..0aa16fb135c1 100644 > --- a/drivers/iio/pressure/bmp280-core.c > +++ b/drivers/iio/pressure/bmp280-core.c > @@ -222,10 +222,8 @@ static int bme280_read_calib(struct bmp280_data *data) > > /* Load shared calibration params with bmp280 first */ > ret = bmp280_read_calib(data); > - if (ret < 0) { > - dev_err(dev, "failed to read calibration parameters\n"); > + if (ret < 0) > return ret; > - } > > /* > * Read humidity calibration values. > @@ -841,8 +839,10 @@ static int bme280_chip_config(struct bmp280_data *data) > */ > ret = regmap_update_bits(data->regmap, BME280_REG_CTRL_HUMIDITY, > BME280_OSRS_HUMIDITY_MASK, osrs); > - if (ret < 0) > + if (ret < 0) { > + dev_err(data->dev, "failed to set humidity oversampling"); > return ret; > + } > > return bmp280_chip_config(data); > } > @@ -1071,7 +1071,7 @@ static int bmp380_read_calib(struct bmp280_data *data) > sizeof(data->bmp380_cal_buf)); > if (ret) { > dev_err(data->dev, > - "failed to read temperature calibration parameters\n"); > + "failed to read calibration parameters\n"); > return ret; > } > > @@ -1609,20 +1609,24 @@ static int bmp580_preinit(struct bmp280_data *data) > > /* Post powerup sequence */ > ret = regmap_read(data->regmap, BMP580_REG_CHIP_ID, ®); > - if (ret) > + if (ret) { > + dev_err(data->dev, "failed to establish comms with the chip\n"); > return ret; > + } > > /* Print warn message if we don't know the chip id */ > if (reg != BMP580_CHIP_ID && reg != BMP580_CHIP_ID_ALT) > - dev_warn(data->dev, "preinit: unexpected chip_id\n"); > + dev_warn(data->dev, "unexpected chip_id\n"); > > ret = regmap_read(data->regmap, BMP580_REG_STATUS, ®); > - if (ret) > + if (ret) { > + dev_err(data->dev, "failed to read nvm status\n"); > return ret; > + } > > /* Check nvm status */ > if (!(reg & BMP580_STATUS_NVM_RDY_MASK) || (reg & BMP580_STATUS_NVM_ERR_MASK)) { > - dev_err(data->dev, "preinit: nvm error on powerup sequence\n"); > + dev_err(data->dev, "nvm error on powerup sequence\n"); > return -EIO; > } > > @@ -1657,6 +1661,10 @@ static int bmp580_chip_config(struct bmp280_data *data) > BMP580_DSP_COMP_MASK | > BMP580_DSP_SHDW_IIR_TEMP_EN | > BMP580_DSP_SHDW_IIR_PRESS_EN, reg_val); > + if (ret) { > + dev_err(data->dev, "failed to change DSP mode settings\n"); > + return ret; > + } > > /* Configure oversampling */ > reg_val = FIELD_PREP(BMP580_OSR_TEMP_MASK, data->oversampling_temp) | > @@ -1778,8 +1786,10 @@ static int bmp180_wait_for_eoc(struct bmp280_data *data, u8 ctrl_meas) > reinit_completion(&data->done); > > ret = regmap_write(data->regmap, BMP280_REG_CTRL_MEAS, ctrl_meas); > - if (ret) > + if (ret) { > + dev_err(data->dev, "failed to write crtl_meas register\n"); > return ret; > + } > > if (data->use_eoc) { > /* > @@ -1802,12 +1812,16 @@ static int bmp180_wait_for_eoc(struct bmp280_data *data, u8 ctrl_meas) > } > > ret = regmap_read(data->regmap, BMP280_REG_CTRL_MEAS, &ctrl); > - if (ret) > + if (ret) { > + dev_err(data->dev, "failed to read ctrl_meas register\n"); > return ret; > + } > > /* The value of this bit reset to "0" after conversion is complete */ > - if (ctrl & BMP180_MEAS_SCO) > + if (ctrl & BMP180_MEAS_SCO) { > + dev_err(data->dev, "conversion didn't complete\n"); > return -EIO; > + } > > return 0; > } > @@ -1824,8 +1838,10 @@ static int bmp180_read_adc_temp(struct bmp280_data *data, int *val) > > ret = regmap_bulk_read(data->regmap, BMP180_REG_OUT_MSB, > &data->be16, sizeof(data->be16)); > - if (ret) > + if (ret) { > + dev_err(data->dev, "failed to read temperature\n"); > return ret; > + } > > *val = be16_to_cpu(data->be16); > > @@ -1840,9 +1856,10 @@ static int bmp180_read_calib(struct bmp280_data *data) > > ret = regmap_bulk_read(data->regmap, BMP180_REG_CALIB_START, > data->bmp180_cal_buf, sizeof(data->bmp180_cal_buf)); > - > - if (ret < 0) > + if (ret < 0) { > + dev_err(data->dev, "failed to read calibration parameters\n"); > return ret; > + } > > /* None of the words has the value 0 or 0xFFFF */ > for (i = 0; i < ARRAY_SIZE(data->bmp180_cal_buf); i++) { > @@ -1925,8 +1942,10 @@ static int bmp180_read_adc_press(struct bmp280_data *data, int *val) > > ret = regmap_bulk_read(data->regmap, BMP180_REG_OUT_MSB, > data->buf, sizeof(data->buf)); > - if (ret) > + if (ret) { > + dev_err(data->dev, "failed to read pressure\n"); > return ret; > + } > > *val = get_unaligned_be24(data->buf) >> (8 - oss); > > @@ -2158,8 +2177,10 @@ int bmp280_common_probe(struct device *dev, > data->regmap = regmap; > > ret = regmap_read(regmap, data->chip_info->id_reg, &chip_id); > - if (ret < 0) > + if (ret < 0) { > + dev_err(data->dev, "failed to read chip id\n"); > return ret; > + } > > for (i = 0; i < data->chip_info->num_chip_id; i++) { > if (chip_id == data->chip_info->chip_id[i]) {