From nobody Wed Dec 17 02:56:32 2025 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DED7D17C7B1 for ; Fri, 21 Jun 2024 22:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719007928; cv=none; b=brD7p5xHmBiw1lFQXYKwO7QKnc401zTKk/io+iHbdBfXE3yzW17PdtCu8I/yUgDgEopVe6YgOWlV4mjAYE8IH1W6AHx4OFm/KfNFKWAF/6CFIkRpGIXW0pcD6L4oNmSgldmRdfMbvCgW8osDY2luEOjbxjQp2zHOF1DT7o4hFv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719007928; c=relaxed/simple; bh=CcbNgyVwV5vKSCeUsrgyuEfUik5bQgu+/dXklWHWjMA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JKL86lYY+BiMRST985QZJZGyft6yy6EdcR0eszwF5HLH20Mhb0BzqtZXLC7IzlyxN70mCnzl0+yDDFybIoK7QuRgG7tugqLJS11qxU5Yo5sVkUd70e56eght/HUUGayGzpFZYk0osfiUhi17XlcHSiyGREM3SF1k6+9mr6C5eYs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=Q64kclxz; arc=none smtp.client-ip=209.85.161.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="Q64kclxz" Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5c1d42d4470so617976eaf.1 for ; Fri, 21 Jun 2024 15:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1719007926; x=1719612726; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PD+YDF/bIrSJ5as8z+S1ghdz1Anzvn+XbfX57fqHPgE=; b=Q64kclxzabbRvObs89ZdGByVGmalFethJ2NP7Bm00yUF7u7MnEtLTXVetgjyNN6Qpi uzK3vNjdlXBkLOK1SoXsdgf3oOSmLEzCfeMPPfJhI5tyJK3ySmdVeNaUKHUg8U3/zwsx tFvDNeVnlESkz/u7fRq5vIqK01+r4A4qELwE4jbU45qpg4ikabvTSHrKlIQSlCx2nS9S yQKVNDUqUvQEg5QvTudX4hUebSjJnrkHk+5haHm7bX6fwWEtxWsBDv5BRPOQypgpN3Bl m5PCmC5NvOLryyY5d5lMOTCskskBkB12lKPVvoRr6T+7qT+zjfEVU5XospGQjN750G45 UmKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719007926; x=1719612726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PD+YDF/bIrSJ5as8z+S1ghdz1Anzvn+XbfX57fqHPgE=; b=AYp5HiKYVArU6DXnt0qYT6ivfRP01ZxvmAWusJUVGCd7XT9gs6HWtVPXi3X8A/ESrT xRMzEbT+aGI7RJSTJr2Oehak5lEr1PGDGFUjKTVYBANHW4iPsHzjZ5bVrcJNgk7gQuMo qkQXTzl+lfnCyMxUGntXcDwARlHi92EIB1R5ablYIudipR5Mgv7fFqObqj4l/76oJ/0s GLJM3b4fD/EIxas0X04xl0MjuL6n0Dw/7tBgT0GgtrRMJIl1WZdaWIFmv+dKMP3sCYq9 b5cAzkyz2jgtpNge/QMO4NERDfm9rUPyRwYIQb25nV67O3CMjV2qHBMiIsBz3EGLtS+5 /6TA== X-Forwarded-Encrypted: i=1; AJvYcCVQc7rx9SG+J5jM2xGVDVkTqWO/71w2HhHu6hb7SkFgML+wwQDDiAqD58USHh6z13VNJxkDgOz4yoMxRcBbK3nX1zT8GaaIOg4g5Cp+ X-Gm-Message-State: AOJu0YxDFPdT2f2mTJNwLr4Wd+uue3sSEzGoEKam6+JscLRckwhy5BNr E3cy+ENduJmalmk8xDvsAIABfLz1ovazxikUo4Bxm9w+d1rNo+RAda8KVAMU8sk= X-Google-Smtp-Source: AGHT+IG8VExe3m+Cltyn4mwfelEWS/KdStFcap+oMybDTEkuUDcJh0MBpt38tdnWmKzNqDCnxsogbA== X-Received: by 2002:a4a:dcd7:0:b0:5ba:ffcb:c756 with SMTP id 006d021491bc7-5c1b8b70a91mr8440535eaf.1.1719007926083; Fri, 21 Jun 2024 15:12:06 -0700 (PDT) Received: from freyr.lechnology.com (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5c1d94fb2a4sm329837eaf.10.2024.06.21.15.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 15:12:05 -0700 (PDT) From: David Lechner To: Jonathan Cameron Cc: David Lechner , Joel Stanley , Andrew Jeffery , Liam Girdwood , Mark Brown , Andreas Klinger , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/10] iio: adc: hx711: use dev_err_probe() Date: Fri, 21 Jun 2024 17:11:51 -0500 Message-ID: <20240621-iio-regulator-refactor-round-2-v1-4-49e50cd0b99a@baylibre.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240621-iio-regulator-refactor-round-2-v1-0-49e50cd0b99a@baylibre.com> References: <20240621-iio-regulator-refactor-round-2-v1-0-49e50cd0b99a@baylibre.com> 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="utf-8" X-Mailer: b4 0.12.4 Content-Transfer-Encoding: quoted-printable Use dev_err_probe() to simplify error returns in the probe function. Signed-off-by: David Lechner Reviewed-by: Andreas Klinger --- drivers/iio/adc/hx711.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c index 8461b1fe6bad..b3372ccff7d5 100644 --- a/drivers/iio/adc/hx711.c +++ b/drivers/iio/adc/hx711.c @@ -464,10 +464,8 @@ static int hx711_probe(struct platform_device *pdev) int i; =20 indio_dev =3D devm_iio_device_alloc(dev, sizeof(struct hx711_data)); - if (!indio_dev) { - dev_err(dev, "failed to allocate IIO device\n"); - return -ENOMEM; - } + if (!indio_dev) + return dev_err_probe(dev, -ENOMEM, "failed to allocate IIO device\n"); =20 hx711_data =3D iio_priv(indio_dev); hx711_data->dev =3D dev; @@ -479,22 +477,18 @@ static int hx711_probe(struct platform_device *pdev) * in the driver it is an output */ hx711_data->gpiod_pd_sck =3D devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW); - if (IS_ERR(hx711_data->gpiod_pd_sck)) { - dev_err(dev, "failed to get sck-gpiod: err=3D%ld\n", - PTR_ERR(hx711_data->gpiod_pd_sck)); - return PTR_ERR(hx711_data->gpiod_pd_sck); - } + if (IS_ERR(hx711_data->gpiod_pd_sck)) + return dev_err_probe(dev, PTR_ERR(hx711_data->gpiod_pd_sck), + "failed to get sck-gpiod\n"); =20 /* * DOUT stands for serial data output of HX711 * for the driver it is an input */ hx711_data->gpiod_dout =3D devm_gpiod_get(dev, "dout", GPIOD_IN); - if (IS_ERR(hx711_data->gpiod_dout)) { - dev_err(dev, "failed to get dout-gpiod: err=3D%ld\n", - PTR_ERR(hx711_data->gpiod_dout)); - return PTR_ERR(hx711_data->gpiod_dout); - } + if (IS_ERR(hx711_data->gpiod_dout)) + return dev_err_probe(dev, PTR_ERR(hx711_data->gpiod_dout), + "failed to get dout-gpiod\n"); =20 ret =3D devm_regulator_get_enable_read_voltage(dev, "avdd"); if (ret < 0) @@ -548,16 +542,13 @@ static int hx711_probe(struct platform_device *pdev) ret =3D devm_iio_triggered_buffer_setup(dev, indio_dev, iio_pollfunc_store_time, hx711_trigger, NULL); - if (ret < 0) { - dev_err(dev, "setup of iio triggered buffer failed\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, + "setup of iio triggered buffer failed\n"); =20 ret =3D devm_iio_device_register(dev, indio_dev); - if (ret < 0) { - dev_err(dev, "Couldn't register the device\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Couldn't register the device\n"); =20 return 0; } --=20 2.45.2