From patchwork Fri Jul 5 10:40:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13724925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1C42C30658 for ; Fri, 5 Jul 2024 10:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mPUGB6WWLvSgcH0G9Q4p2N02Tp+SMaWAilQNUIzP9x8=; b=T4r3kVOyxDiZfxaTtWWuUscB5d uvdamH0iRizWy1V3ReKlSEoi/6eg9W6HufkXEzV2vPkYNDHfGiZfIKTVgALBPEU2x1tsKWI9hETXq W4TqpDoVG5armSWJv82XULG93YU5wPOyIFBIn4drJP7C2/9OSGsjqh88gOOwr0UmXwGvi1iZzjGvY ec5/B0CSrDlLZjEaqBRro8bM2HzT5LvG7E9qzMvCxPcsDvaw+ENGSjAwdYE+R3NcI7pOylszo1tvw O0/4Petv3gI8yQM2uOv/fhKuj7OHZHbYXdjeSAFgEQgUhGjL+/8PbxzNu5idpDz6lIGVox2TdbtiC 6id6C3mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgNT-0000000FfpV-4Aff; Fri, 05 Jul 2024 10:41:19 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgN6-0000000Ffjh-2pWG for linux-arm-kernel@lists.infradead.org; Fri, 05 Jul 2024 10:40:58 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42562fde108so10077535e9.0 for ; Fri, 05 Jul 2024 03:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720176055; x=1720780855; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=mPUGB6WWLvSgcH0G9Q4p2N02Tp+SMaWAilQNUIzP9x8=; b=kCdo+1u+gv+ww7FdIexnEk0pnFIBK8k4YkU6N8EF9T1k8NGA6+8GNnIEJZar/oz/S3 BSUVT/WMPinbhcEgWoNeosKBSc2lj+MudKY91a3oQbHwKvV/1M/wYp7POR+F+U2WHtBe cTZVxbsLDrhsZN3ceslwO022PKpP0briuw/d4W58eenejlFRTO2ANoxZq/lqtjfd4XHT 8MBicUu6wIClGyNsohuNc3TTaydj58KK3PrBT5GklYUgmaRHniGv2tb9kMSNtmnlyptr HQetIvYQcAoWmRieTy98pQFitYSmrSw9yrTzAW573SB410qO7iJ5WERT73AO/OXaFw9D OPRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720176055; x=1720780855; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mPUGB6WWLvSgcH0G9Q4p2N02Tp+SMaWAilQNUIzP9x8=; b=jtZ1GkbqnngDvI2quViCzK3T0F1Q5yPrn27upA5llG419fbGUVcEFtUIpZIWOpHbSv lQCQMt9xPS0pN352q4cUzY2uF812TIGtR6Fo/Cl5f9fHUrXZZ61Om0zqVSOFM7qt5psO Z6rf3rPN9rH3GdLCkVRyWCz6GINk5+kUvmP4efkXqaqvQESvNSopaHznPUnukaxu1clm zeNTJRU8k8j4GK2EorSJXIg04DnIEMQnYQ8M4NvwJAGjqNnmAA7oXSKhK0yi5zNYhaoJ 94Y50jMOXJx7NYLcb8qtRuL9hTq0FjfaYOcLuMd8FX9pLW9dP3CkVhicIsyRDa4WNkGR kINg== X-Forwarded-Encrypted: i=1; AJvYcCX+KfwzvjuSUiTJnmj3dCVzciN5VYGBHT5iaoXRaqFiM2hyrW5sPJ/t9mMayWT/EMp1hobPdWThWBFzVXWmJpYDTSer1etwh7TeUWYK9lsx2Msubfs= X-Gm-Message-State: AOJu0Yw6BL8Nydv8gJXxOnklTuG1LpohPHPd/t+779ZI21fEwJsVs4nh mF0Gun3Ox837t6j9LhY2Aq2H4aOobj9N06MK7bYn0fDPu/xPnZoGkOODCF4lTlg= X-Google-Smtp-Source: AGHT+IG91L1QiQgNWqSWoacLRT/4TO/Dx2hLrfRAQx3fZ6Bx/+xCR5Xz6K+GVEbHWRxKNEP2hp8MbA== X-Received: by 2002:a05:600c:3b87:b0:425:6bea:8554 with SMTP id 5b1f17b1804b1-4264a44dd7emr27116585e9.27.1720176055057; Fri, 05 Jul 2024 03:40:55 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36789d5ec1csm8680446f8f.37.2024.07.05.03.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 03:40:54 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 05 Jul 2024 12:40:44 +0200 Subject: [PATCH 1/6] iio: accel: bma400: simplify with cleanup.h MIME-Version: 1.0 Message-Id: <20240705-cleanup-h-iio-v1-1-77114c7e84c5@linaro.org> References: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> In-Reply-To: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> To: Dan Robertson , Jonathan Cameron , Lars-Peter Clausen , Michael Hennerich , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Oleksij Rempel , kernel@pengutronix.de Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1335; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=2JNEEDT0yqg0ZpezS+vJkAIFphubIucu2CrwWdLhExA=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmh82t2yoLgw7U/d/3WF1lw6Sbpe0R3WznQ7bXQ zvidEQNGzqJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZofNrQAKCRDBN2bmhouD 18eFD/99kCbJW7rMBIrokTGQp+teP0OMxk9HEiucDrZMQqy964A/H6w6db7bxlu/FqpIge6xQfZ pgShtD2t06mxtvYqI8U7yZJgNkkNoOY8Mzy1NJncQrBuEXHf66NEGrsoMYwpPl31WIGH7LN6EsI Ghx3oPDxEmtAAuHBGsEhdCdDzuartmIyR0WnmgMSBT43VYTwVglMAg0Ep48AuxCZnm4PDQD89zo bPvUgyFgchmkNQEFwAByBkrlygUVTQ+IPLRa2TlVN+gsau951q2k5VgHgWhtzwqk+5uEWLZHYf6 wc6adZUHqX43cgbEfSaINs2Mszebw7ONrWbCMLyJLtJsYEAo/UyDrSk8AwM3CXeCzFjkKUE0gem N4LryYcpQ0eZ+PKKK/2HL50uDBF+MoMhmJQyOrb5MWFCTQ4Yo54ImehbKCayJSNQg6wx+0fE1OY I5KBjLZbj579jh2iLHlCdWNuDwDG6JugmcbLsnJt9D/ZxzDLrGWU3nphOqADk6rOpFUARMuc3ms ZLcIPlDzNFu0ntch5S3pAJ5mSW8zKSv65ZGz4qcHkVlVysAPcs4/pKU2ewf0L4x8LOano98sgKg /Wp5hbOhQDKwhrdvno18IAYmmFh+9K4rLxikmurZbqTx43Y1luTowQ57+5oh4A5yl4L8c6+DW6P 7AiqGyaPLAdiiwA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_034056_852288_A8B191FE X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/iio/accel/bma400_core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_core.c index e90e2f01550a..89db242f06e0 100644 --- a/drivers/iio/accel/bma400_core.c +++ b/drivers/iio/accel/bma400_core.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -795,21 +796,19 @@ static int bma400_enable_steps(struct bma400_data *data, int val) static int bma400_get_steps_reg(struct bma400_data *data, int *val) { - u8 *steps_raw; int ret; - steps_raw = kmalloc(BMA400_STEP_RAW_LEN, GFP_KERNEL); + u8 *steps_raw __free(kfree) = kmalloc(BMA400_STEP_RAW_LEN, GFP_KERNEL); if (!steps_raw) return -ENOMEM; ret = regmap_bulk_read(data->regmap, BMA400_STEP_CNT0_REG, steps_raw, BMA400_STEP_RAW_LEN); - if (ret) { - kfree(steps_raw); + if (ret) return ret; - } + *val = get_unaligned_le24(steps_raw); - kfree(steps_raw); + return IIO_VAL_INT; } From patchwork Fri Jul 5 10:40:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13724926 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A5C0C3271F for ; Fri, 5 Jul 2024 10:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1eXR3A0Apjdz/ufMLdA1641K3n5tF+YJ5/SI81Vd25s=; b=icZR/W3U66T07pWBxLH9RBY0fr jSLBNqnA0CqjtzcxGfpSWkG4hhVqnAWEyYKhkIPphapmCWOP4BYCx8B2Y0wEa+HXRhFljmgFOfV/s FUq2I1xZzWsJ+nw3UkWb58MKXFx2mvs8FiwuPZ1D0xvwURUP1QP4f334pbBBv/n26uMkFN8IByLRY G8sUuBF88YmWWI38rBdntF2mWfp6euMbI051d6nW4FpyM9O1qy7CBUcGhoEPf+oVWoXhVtdOp5/JM 1qm4/O2lQFvR1D4/kwk891+eLLHToF3QLHuObtBvs2g8JsmA/OwlxYtP4P/zEIVwUXw6W3iUbPwmn We9cW3ow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgNf-0000000Ffuz-47Y9; Fri, 05 Jul 2024 10:41:31 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgN8-0000000Ffk6-27aZ for linux-arm-kernel@lists.infradead.org; Fri, 05 Jul 2024 10:40:59 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-52e9c55febcso1950421e87.2 for ; Fri, 05 Jul 2024 03:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720176057; x=1720780857; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=1eXR3A0Apjdz/ufMLdA1641K3n5tF+YJ5/SI81Vd25s=; b=HdIfkXmnLMrEjVI+hKgD56M+HTN/RE4620aHJfwwEm9b82duuSkWFdZGJV9Zsl6c6z RCUkHskSPjTyUTcm78/oFA99R8fBUuUlsW4zvkmW/ndSasVB4Y65LGo4Q71JBhA8IWoc ou2hUWuFgQWDYoe9vB7+vVs0AZSCBl39z9Kuv4UCGAZMXYEUpV9iUN++cpq3MJtE2nym VqQ+TKWRdprRHS5MYjwgH5Cehg6qGgQH7sigWd6Pop3CxVY1j3qilcIIMV3dwz7u53hD cF67hxXNauNscxN2LpP061/5BWHNfeIs2fli84P4ueLLtYag7pqk+aXyehi3JiwRJc/s DWRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720176057; x=1720780857; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1eXR3A0Apjdz/ufMLdA1641K3n5tF+YJ5/SI81Vd25s=; b=ckMfmsdlZZYzaAaqjjLcuYPMO47rDNpZM5+NHQAjB+RoZMMO5VeZMc0GJEah38kHpC AHVl2E6NaIla2uXtZ72sTT8IZOVanz1yfzZKZmURCxoDfaoKhw4nFe6Ue4cW2l4WeiVU z2biPcc9VuGGIVj/v4tWG8zgZMFZRrSKPB6KebwCNAb9drLZR3G+Z+s91nRq1lxC5Q+d ImnlIhwUObJP4AMrjJZJvDQOt80yan7qnKW0SmwFKzf4E5sMppvC2cY+UBFI50VEzvaQ 9b/TJxjOjTY9mgmJCbmwHT4aWk3ZBoJRenD7kIqwGMTXDRy/nJNy2szURCjjjoVeGEgX j4LA== X-Forwarded-Encrypted: i=1; AJvYcCV0/HpO2B+mgyNivbV3Wq7RVqQsD0j35LApMBgwvvMW6gYNem2YgWoiwden6bXl3wdogPIV3CAKp+wePFFKHyvqzgIV5ykiThdYGG+APnyCdKRfDRI= X-Gm-Message-State: AOJu0YzkcnanJHfcWqq/LZSBP1z0PzkORNnrsb6g9jkbkXaSxqYrNziA k8ddKM8H8pGjkun014AG/DFSy/XR+sIwuTNCEVvyJWYBG2gpr5sRxNuGf85yjQ4= X-Google-Smtp-Source: AGHT+IEuhBIHVHatXqi8z2wyYNIT9Lh+Ls2S9+zIz61+j9staS9hXEuX+FfBkFJ8fOmyILywkwPT4Q== X-Received: by 2002:ac2:5e6a:0:b0:52e:9b92:4999 with SMTP id 2adb3069b0e04-52ea0636e2fmr2584439e87.2.1720176056640; Fri, 05 Jul 2024 03:40:56 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36789d5ec1csm8680446f8f.37.2024.07.05.03.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 03:40:55 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 05 Jul 2024 12:40:45 +0200 Subject: [PATCH 2/6] iio: adc: ad7280a: simplify with cleanup.h MIME-Version: 1.0 Message-Id: <20240705-cleanup-h-iio-v1-2-77114c7e84c5@linaro.org> References: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> In-Reply-To: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> To: Dan Robertson , Jonathan Cameron , Lars-Peter Clausen , Michael Hennerich , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Oleksij Rempel , kernel@pengutronix.de Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1441; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=QARo7BUFibdiwmopTR5ANV4tiDr14JhYaFByIK5Byzw=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmh82uDOsWBkZE1MS94UeFMZdoWUjtORN8+1Oef iInuGL8Z3eJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZofNrgAKCRDBN2bmhouD 11beD/98CTFr2lTq/EVP4vRTt2IiXlvOrBvBMcJmJPzXzLJ8bIkeaqjo06OJLaIDRQZYBNPnVuh iCB2ROEzC7zxYyVsUR/0PLtX3CUYblcKXaJRB2eUx5EnKv2muKesTT1f8imdJLzkdd+yt5A/pqZ ttpJvI70vmv7h0XO0Lu+kjHrXA3dtkGsRIfvIKaFNs261+GuLAKylmm89b7TraS72nPGqu103En iaTXldI75WXk97F7pU5M8adFpOoZ4BjRUtjgvY7nfQOzJ+dGhFcyLRPg187QTHs1SiYEaIIRZCl kozqwrmXIU3ST2+IfKoCE609dvgGWzi43Aq9g3nHvV3JmXdo9WjXbER/iQlSDIHx6L69gUYlD14 WsrYJX3w8jqpNmeXQY6z2RBjMRMJu6lrrETwaTNlpbBp3bnXPyKqsuOAwSP9k8o/orNrGU1goof R7znoCoTfOU+/wFgaBKBWhvGMiTZhSiAJf8Ai0TQ04VuEBYYOUik4LBgaDyf5UziepsKEbPw2FP IrYwDIvRTRujbE096pInBQS5Qg9tu7N5ZYXPy8zFL/d+qotPVgUmSr1q3yH5a59Bid6jgB6hvmc 6DsuaNdFpC1fBtjgUFZ9viCxxX80G7AFRkWHz1LEYU9RgLeQRecmLe9LBr4K6XyMoG2J0n+HOnv EtHG2o0AIPzSVRg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_034058_577968_8B709D06 X-CRM114-Status: GOOD ( 15.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Nuno Sa --- drivers/iio/adc/ad7280a.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/ad7280a.c b/drivers/iio/adc/ad7280a.c index d4a4e15c8244..7bfa090da4df 100644 --- a/drivers/iio/adc/ad7280a.c +++ b/drivers/iio/adc/ad7280a.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -803,16 +804,16 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) { struct iio_dev *indio_dev = private; struct ad7280_state *st = iio_priv(indio_dev); - unsigned int *channels; int i, ret; - channels = kcalloc(st->scan_cnt, sizeof(*channels), GFP_KERNEL); + unsigned int *channels __free(kfree) = kcalloc(st->scan_cnt, sizeof(*channels), + GFP_KERNEL); if (!channels) return IRQ_HANDLED; ret = ad7280_read_all_channels(st, st->scan_cnt, channels); if (ret < 0) - goto out; + return IRQ_HANDLED; for (i = 0; i < st->scan_cnt; i++) { unsigned int val; @@ -852,9 +853,6 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) } } -out: - kfree(channels); - return IRQ_HANDLED; } From patchwork Fri Jul 5 10:40:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13724927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7196C3271F for ; Fri, 5 Jul 2024 10:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O7oWBhtqk3xwW6JyxZwaMMLkFEk7F/Zbtq+Lnku9XgY=; b=HGcDGqvEDUtSGCqX0j7D4YDU2c C10xWFCQlDgwJVbyrVmuPklrnB01FZCWJnJVPxaPPsUqALVMt0cfYw2Mf4CKSOED97Pe/MCvwGWdM r7ENFfPQe8hHqKUjyZGjjlybCSucy5zy3NFH/TF5dpxmvh7spEhDb8gUhAAn65qXbV4jO9Gu3Si2F m6Hp1UgKn8GC2vMkyyM6YR+P9Q+bcdLn2Ix2Hvak0xCXp0GWvBNPFnz994UHSD5unZEAJIr4O3vCW 5432djwankBS/r7b9snErtnBJwe+64J2g6PM/k/7jg9xLjSI1sITP/RoorLIp+Xe3stb5BGuKRt8E kuNLAV4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgNr-0000000Ffyo-0r8O; Fri, 05 Jul 2024 10:41:43 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgN9-0000000FfkT-3FY4 for linux-arm-kernel@lists.infradead.org; Fri, 05 Jul 2024 10:41:01 +0000 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-367ab76d5e1so140026f8f.3 for ; Fri, 05 Jul 2024 03:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720176058; x=1720780858; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=O7oWBhtqk3xwW6JyxZwaMMLkFEk7F/Zbtq+Lnku9XgY=; b=OZ7DpXJvtxdDzmZdIt5Uv1xl3w8TIbVoGbbBqD0vAOk4eVlabvwuK9M/qiIjHplVrj 0IhZTuKBb3QTbgHfnWfVfgsF++nQeeqU++wQzCVfX0rhdVMt0dbOc5NUE6g3xGKfLOwP SJHtSwNCdUliiRhINGVmN/0vPW5FiDByKz6MvWDo3iUXVY1tC7Y8ZpRhUGk8mqXUufgy jztwgBWP9POt7lrAYAUETXIeXgoJv/C4zlBeKjBmKRcItQ0TW7BXhyPwZijR0Z++P0fX CkoCZZz7bCKDnhZ0Dc/Voph6lBlGzpL9SddkWcbYPZFQX+1kXO2WsQRJsXFZzJO+5lp6 5BMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720176058; x=1720780858; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O7oWBhtqk3xwW6JyxZwaMMLkFEk7F/Zbtq+Lnku9XgY=; b=AwbkXE7v+JWcn7m95svT1pKqxM8x9xBbX4t8h9gGve9q7cgFe3U0JML1mIC0jL3W+T lnymaDtHyr+ejX8lp0pH4FRauwhhN6lzhzLK6CUjNLUbM39N6R9ObE7nRglT6PBlEzQJ TCL10R9Y1zkxyfV4f6ZJngJe3pPgUyNXOuwCVbUkqaJWsPpCkoicKRBP6JCqW2YYC8cn raBqQOZoYs+D3LFK+yt8paIyiBN1v4va8vwuMRtRyGRRPuMkfWSGFnp0YNq+rHaMfmnn Nf0+rtet/ldyiHi+5JEDdxY2KK/fhyymNpH9tffi9t4mhCAqL3XNFxiPRvqDIqKSV263 FFPA== X-Forwarded-Encrypted: i=1; AJvYcCWnJOTYEnKkl5K4VEAxM917lOfIYjcLnZV6eGnOBFkt+51hJJ6q9x2Oe3oSTG1k+3W//VE2rWmZYniWjpp94/xwLwlR2B48Z/cKM52GL7poB8dYTTA= X-Gm-Message-State: AOJu0YxkHYFzAulRdAYesF42aomhgcBf/15FX27VWETi76oVbc4UijZm aeW4oAeoe2PfvePOKK+lWfc2aC8Pk/e+mGiEzORRFLQgWvN2+jRAY1/cbNhBkXw= X-Google-Smtp-Source: AGHT+IHPMMzu5kdlcoZYnKj2xBCDHrdAzNmKY1tb0qjEiMJJj0RsjyKrxPl+gMGzYZqJroN4prirIQ== X-Received: by 2002:adf:e68a:0:b0:35f:11c5:5c74 with SMTP id ffacd0b85a97d-3679dd34d4bmr3095033f8f.36.1720176058373; Fri, 05 Jul 2024 03:40:58 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36789d5ec1csm8680446f8f.37.2024.07.05.03.40.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 03:40:57 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 05 Jul 2024 12:40:46 +0200 Subject: [PATCH 3/6] iio: adc: at91: simplify with cleanup.h MIME-Version: 1.0 Message-Id: <20240705-cleanup-h-iio-v1-3-77114c7e84c5@linaro.org> References: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> In-Reply-To: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> To: Dan Robertson , Jonathan Cameron , Lars-Peter Clausen , Michael Hennerich , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Oleksij Rempel , kernel@pengutronix.de Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1335; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=p8oWdKJIvI/s9h6AmtHd1y9/mEFkDnWkbWLkspoDv58=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmh82v0r6Jh34sMwY1mn3FW86/CEhm6tM4W7RnL uiEVj4Vr+mJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZofNrwAKCRDBN2bmhouD 1/3TD/9Na/SvzzL4bKKGkbGVC3TdFpp+yHgCyH52qQr8o7KQlHBEJKaH1jYv9NZmWAfRjEp/6WM DX8l8spwS2QfhfjRD61w2RJxeNHKpMOhfRUVIL3iBAHrwDkv2wUlIi6iYH421pgx8LKaMK7Oadh ZI8wacXDVGz0RHyrdOt5dYKeE/bzhdXMc6PD3z/VfdipVRtAkyUqdkqaof9EW1cm24JddMncVl7 GgUa2VE6T9e59sqS3YfaM3QfvlZsxRdPFfGHba5PyoE4dUv0ppeTyKzWouv9GySZayvSnNVDQmd Sncvw4nm/LyKQKKIpLpjRv6t8r4aKWGastRB8/Xkq/6CaeR9geqf8/cepA6LiNsd5XqtTMgyCy0 x/tyceFDPl7QQaZXKGuD4CbscN2FxQyZYNsxx1YGEopceTWnUa09mmhHCGKCnCJplvXIlHGa2F+ fHZj0Z9dGL0kS8rP5ZdeEAZ+213jyU+fzDu9kapEegaH/3ycs+i/+6roOFLOONLTdJi3kbfykKl HwM/9WrCzw2ruPd5Kx1vu51mz7IU9QgbsKj9QqfhRRoxvK/9bKdWhvOLBSkz4ofs8CbE1zpJSFi eiARICHKU25nhyGaKKZUWQRdrUnt1N6n1Z5Xv7340vFdMMvK5C58k/NoPAoimRL1HlKPrF7Pery tEe0GOCnirntzpw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_034059_854031_6692BEF5 X-CRM114-Status: GOOD ( 14.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/iio/adc/at91_adc.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index eb501e3c86a5..7bcda203436b 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -543,22 +544,18 @@ static int at91_adc_get_trigger_value_by_name(struct iio_dev *idev, int i; for (i = 0; i < st->caps->trigger_number; i++) { - char *name = kasprintf(GFP_KERNEL, - "%s-dev%d-%s", - idev->name, - iio_device_id(idev), - triggers[i].name); + char *name __free(kfree) = kasprintf(GFP_KERNEL, "%s-dev%d-%s", + idev->name, + iio_device_id(idev), + triggers[i].name); if (!name) return -ENOMEM; if (strcmp(trigger_name, name) == 0) { - kfree(name); if (triggers[i].value == 0) return -EINVAL; return triggers[i].value; } - - kfree(name); } return -EINVAL; From patchwork Fri Jul 5 10:40:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13724928 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E47DC30658 for ; Fri, 5 Jul 2024 10:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oTC/Azk6QuGeCqi4nXZfSzWiS7YtP2rKGZn+knA+oxU=; b=sWjuPn9G8C3DzrkET/EbvjeIKv ALit8U1Bh3Y6TDCO+Ti9ZRzmTSyh4wmVPA/RfqPL3hLAic93GY/hYQMosIFi7+O4zuW6dgR0wU+wH MYDOs3rNkICXWm3wdfnTXGq1FWRMqcL7qZDZ7VSp+mSdJST1DIHXvCeJlTvuu4x1tflduxP4Ry772 H0KRIEVEb186QF69aOc7vZ1MqgMu+/ADbIjCAVNeVF3Zgkyoyl+Y78nb1Cj2jeGnvP8SnPq7Hv/N1 Tq0gWu7zYn8c/k7YRAPoF6XWtaaKXn+43NNsZ6HXDwpeViwlYuVLUH4aTCDTh0tfo6VXPie9c8UWY JXybrjOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgO3-0000000Fg4A-1o03; Fri, 05 Jul 2024 10:41:55 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgNB-0000000Ffks-3sTJ for linux-arm-kernel@lists.infradead.org; Fri, 05 Jul 2024 10:41:03 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-36796bbf687so875872f8f.0 for ; Fri, 05 Jul 2024 03:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720176060; x=1720780860; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oTC/Azk6QuGeCqi4nXZfSzWiS7YtP2rKGZn+knA+oxU=; b=AffIXeqI7gj6QBJGwc+S3mgn3oSCmMH41NQmpnsQWjTmOrjDPdWLvDiWqRBUSuJ+dF Xv8WKYraF3ec1KZqe1Y9nwmi7gjz2VPxpZCCLqNSVdmmSDbeLBawwYP9yXpBio8J6elr o5AircvNUrPzRg+5iDgJ+pb+WS7/79K596ALQFyRISl6871lBsaLADzcHEpkAS7p61T2 6OYx9u7vIOIMEugWZFgdoyvD/yEYPdMUzY3OOj1llWavRSwoX9cJypO106e4IjPRLCGL sLRFaDjOPq6Q++v4IgM4E5J3X6Qqc0Pbbsz6ZTtr4QvUjwWWbxyGg6UcqBh0pPb8oscG tgdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720176060; x=1720780860; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oTC/Azk6QuGeCqi4nXZfSzWiS7YtP2rKGZn+knA+oxU=; b=rE4gs0VTBFJRzxGU5Cs4mpEGMWcpktrT8WIT0DDDeIrz7edKO6P39NkfuE97/0xALq wegZUnCI/e0mzy2EtI99lza59uHkVGFmASsLrdfGnlJGJMk4wD9FZz1E9kI71jbzYKRY JAC8VlKTN5T5lQ/zaOSUzWOj5nKmsTLD1S5/hLHO3csH6G6/tjwYFGRptQIR1f66I2Y1 braCpecHGxQ17x/tJTYXD5ymIwQKiiRqUY+UlNIRhmq86FlvcNSQro0Qfhl7pvm9/q0e kQfiJByojqUwa9PGb7cOH2ptuNqujxd5UMk7CdmsQhmIssmn6cnBtlV/kqz7011bejrG 9c4Q== X-Forwarded-Encrypted: i=1; AJvYcCWII7FaN6PESX4ugqq8pDbbtsO3dx9mdcU4//Pa120lm67BVSwUCbg/uDDcGgc7obOY2RS08GptNymRbi9p9tZSuxNmYqDiKB55sI6953elLXq5dHg= X-Gm-Message-State: AOJu0YwzVJLYBalWj9Kwh421qK71g8eoHPMSJ0RuqLvsEwZ2Zxiq9Ew3 /uVSQnvp8RD0DUdbcGFuXRiNwYLlap1zqgxU4jZh49IAp5Mq34YSvHo87A6fB6E= X-Google-Smtp-Source: AGHT+IFpPHqmjxp2CPDg1mV84p7LQ3rhp2DLU/4rV2/xi9+XlRjQpCs244ba3YRg8O8NY0lubgaIhw== X-Received: by 2002:adf:f7d1:0:b0:366:eade:bfbb with SMTP id ffacd0b85a97d-3679dd651ddmr2544484f8f.46.1720176060011; Fri, 05 Jul 2024 03:41:00 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36789d5ec1csm8680446f8f.37.2024.07.05.03.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 03:40:59 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 05 Jul 2024 12:40:47 +0200 Subject: [PATCH 4/6] iio: adc: max1363: simplify with cleanup.h MIME-Version: 1.0 Message-Id: <20240705-cleanup-h-iio-v1-4-77114c7e84c5@linaro.org> References: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> In-Reply-To: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> To: Dan Robertson , Jonathan Cameron , Lars-Peter Clausen , Michael Hennerich , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Oleksij Rempel , kernel@pengutronix.de Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2264; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=8UqNvu97RyQCvnTqNuJYZZnXKv3X2QTRkCh8H7bl7SE=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmh82wGqZAMadIz1XR5aj+8tdWoDISp1r2Kw1oO rXfx9a4AMKJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZofNsAAKCRDBN2bmhouD 16lzD/9AhnxwXv5OrwJjGIWy8uU3qbq+Ay+EYJfL4l7G5eN2ahNnoKc2trvkQGgIk4WpPVAl/We GkkGk91bFiIseEUezi8Pq2WkeJE4jah4gZ1ygbkxeSoKAVnlO+SAGNANz7jDm41gc/Cdxfb7gfw RoxJrHybC9EUzc/Snj1m8vWzWcqbw6cMpbaZwsYGNA3hOxzdM41aC0zySf1oV/XpDuUoaAfthbA M0YWsOzOt987EMMYpFobfLLz9XC3M6CZ3vX4dvm/RRnGqtwg99piq5uPgVHV0lSgCi8EfyJLSZN zejEnA1hsYNUX8M22MABU7/A5LHcKcuT54Qm2bqIBl0vV4VqDMnHp1QcTyiVAG9TVcbk4ikpMCM iSd3V+bj1cxn2zQfR8C+UxzTzHX92pK5G0YYcL8x4MFdemOQ6VN0Icb46+2qHYmirioczwvybFJ 500larK7cxtaZ75pdWVz0Snsfwk6C7wcsPY7n1gf0NZOG14tx2Cc5K6LyWNsfoB9xFndwAAKiUJ WETcQ86+nEMU0vwIPBMsPc30EF36mLPmM1ImODNcM9VXC5Myq5luyWftG3KqH+BJXoGGg/KYA8+ rs9rV6DqNRDyFhplpy3WFo7+5A//cOVA98Oo548YWTh2Qgmbe/ynrm7kVPK6pVp6ACc5YkeH/sx FBbXnIJipqkVO6g== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_034101_997444_08CA13A5 X-CRM114-Status: GOOD ( 14.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Nuno Sa --- drivers/iio/adc/max1363.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c index bf4b6dc53fd2..d0c6e94f7204 100644 --- a/drivers/iio/adc/max1363.c +++ b/drivers/iio/adc/max1363.c @@ -13,6 +13,7 @@ */ #include +#include #include #include #include @@ -818,7 +819,6 @@ static int max1363_read_event_config(struct iio_dev *indio_dev, static int max1363_monitor_mode_update(struct max1363_state *st, int enabled) { - u8 *tx_buf; int ret, i = 3, j; unsigned long numelements; int len; @@ -850,11 +850,10 @@ static int max1363_monitor_mode_update(struct max1363_state *st, int enabled) } numelements = bitmap_weight(modemask, MAX1363_MAX_CHANNELS); len = 3 * numelements + 3; - tx_buf = kmalloc(len, GFP_KERNEL); - if (!tx_buf) { - ret = -ENOMEM; - goto error_ret; - } + u8 *tx_buf __free(kfree) = kmalloc(len, GFP_KERNEL); + if (!tx_buf) + return -ENOMEM; + tx_buf[0] = st->configbyte; tx_buf[1] = st->setupbyte; tx_buf[2] = (st->monitor_speed << 1); @@ -893,11 +892,9 @@ static int max1363_monitor_mode_update(struct max1363_state *st, int enabled) ret = st->send(st->client, tx_buf, len); if (ret < 0) - goto error_ret; - if (ret != len) { - ret = -EIO; - goto error_ret; - } + return ret; + if (ret != len) + return -EIO; /* * Now that we hopefully have sensible thresholds in place it is @@ -910,18 +907,13 @@ static int max1363_monitor_mode_update(struct max1363_state *st, int enabled) tx_buf[1] = MAX1363_MON_INT_ENABLE | (st->monitor_speed << 1) | 0xF0; ret = st->send(st->client, tx_buf, 2); if (ret < 0) - goto error_ret; - if (ret != 2) { - ret = -EIO; - goto error_ret; - } - ret = 0; + return ret; + if (ret != 2) + return -EIO; + st->monitor_on = true; -error_ret: - kfree(tx_buf); - - return ret; + return 0; } /* From patchwork Fri Jul 5 10:40:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13724931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3EC5CC3271F for ; Fri, 5 Jul 2024 10:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BhWBPupwX+ZV/PG2cNtfNm2papiU6MGLdZkiMCHlF1s=; b=fO5sdtqntzPiR7SrdkCdJG+Lz/ mUs+fTPyPuhaen23yGF04bvOSXv78UU3Pu6F9Bty8Dd3zGE/rb6aPU+J11CePjFVTYDroXRBNYYBd aa+oDBsrTfNCMPCdqfEjwHaESVI2DdYOa8RbpXZioK2BgrQDX3IVxoCyjATaMesbk2vGtfrNgTkc4 EjjgCCHhIGMkL81rzY5dk7KOuw50K25Wk3pooUwer0OLobZe3xKkGLVJC6Ml7ECbtqQp6E8vwCL01 NdJmv0lgqBzieaXWnTCACBxWp+ipOMsRFCM32aNdVwIK2VEovm2azk0dDbdoBNLCfYUVvb84EZzir oLHpnaNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgOF-0000000FgAI-3KMC; Fri, 05 Jul 2024 10:42:07 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgNC-0000000FflE-40R7 for linux-arm-kernel@lists.infradead.org; Fri, 05 Jul 2024 10:41:04 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-367a23462e6so771015f8f.3 for ; Fri, 05 Jul 2024 03:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720176062; x=1720780862; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BhWBPupwX+ZV/PG2cNtfNm2papiU6MGLdZkiMCHlF1s=; b=LmTZQMWfAZQEVY3TheyXbRaf6vwBTBpcHZmYYXCegsulDsvHuITVFhwJ30gZa0B/nv DBJfdSOUNwMouVx5opyh4McLkH6UOVHAGMWlcQVOwjRr+HaOp34/loXnmsKVB95/+Vai HILx/lj8JnvDVGW8G1PaXV/feNEZLHaodfrRmKuX9+Y4mfajoaQIMO3gYc8sLifSEfTA jbi5Vu5rvDF5cmD7LfnsqYkeVWP6KpPoye6JGj0fuptp+6y9Cdqwxf97cK2WkW+3D8Mg GNOQkckCXgwDzTaKnvvErE5IaD01adJDITUQhFvM0kqs3QfzHTGl0vJyGKdjj/zG1VkO DGMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720176062; x=1720780862; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BhWBPupwX+ZV/PG2cNtfNm2papiU6MGLdZkiMCHlF1s=; b=mI4A0k6vTLpY70BRuf3PiujpCno4qO45PMArWDoT0xtYI+27dPc7yyZuvQ9gwnocMR gpxw3EhYzLnjbjiLwNi8StiBBFwzDDrqK9RuQMWtCPbGb95syL6Sr4gK6EJgSxSOXwNZ AZjlegLf6KwKR7wvsBOfi6kU7MmvVRKZNWmKkCLZcyXmakdqLYo08SyUun8MYK7Bp+te Q9Z8JCXKNE7K5IhI2jWafnUfB8+yU0nyp3JLZzQVT2V9zIAw58Uh18ZxperldFvPwigS dpmAB9b97ZXkaW3vSJDDVqFWFOsDK17NYSTSJiPwG92VBfB5COKdtrVEL/rAB3odB5KD NjsA== X-Forwarded-Encrypted: i=1; AJvYcCUaqe8F4CWd8CQxgH+Bsm0Hae/dPTnIX1KFrwSWmUxalSVuGYJwMTesEjlvcimR0PeOk9RhDB9nOCCLIqZxA/eWaPHCuRecNN1vUyeLkQSP2/9HbUM= X-Gm-Message-State: AOJu0YyFORcX+sCGmm3wIc0XIkWRzOJ2gp6T9mwK24Br9M/5uAEf7Sl4 oHWa64HaX8fehTMGAWVGGFD8z3LOrrhjPoP6M8LvpDwaQ0a8hvWubse9jCkN31g= X-Google-Smtp-Source: AGHT+IGsdaXR6rm0bitoeZHc34IGbosRLdkp7efd1biuK+GLd9lJQp9j0A7j0UvRmz0KfTlDkj8IXw== X-Received: by 2002:a5d:5045:0:b0:367:437f:177f with SMTP id ffacd0b85a97d-3679dd66ce7mr3019783f8f.55.1720176061775; Fri, 05 Jul 2024 03:41:01 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36789d5ec1csm8680446f8f.37.2024.07.05.03.41.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 03:41:01 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 05 Jul 2024 12:40:48 +0200 Subject: [PATCH 5/6] iio: adc: ti-tsc2046: simplify with cleanup.h MIME-Version: 1.0 Message-Id: <20240705-cleanup-h-iio-v1-5-77114c7e84c5@linaro.org> References: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> In-Reply-To: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> To: Dan Robertson , Jonathan Cameron , Lars-Peter Clausen , Michael Hennerich , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Oleksij Rempel , kernel@pengutronix.de Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2566; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=Q9zojN0lSJs1YYfBNhUpVI/gmwKKpCb9hKgz9Y0tOzs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmh82xNTfAtLA3fFZQMr0Dq/c0vYqvqV7SsUlId 1rAnYusAfCJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZofNsQAKCRDBN2bmhouD 1+3fD/4sL/hhE1j5QMAxUYCzRGwqWbEQgfb3K7Uxn0NF7P0KlpULd+VsUVPo6hmvCmr24t6u21V xyuEaFBs4lFfKmOcJnLwAK+94+RwJ8ovC58O1sy3PGFiK9dNUXg/sMoYdU1LHPxGKSZkMFsZL3H XwsH7cCrp2kbN3S7qnpZhNZSsCJ3L7MMrPq3AxlDkc6whTwU30ykFeYBKC0ZgsSMVv6Vcl82N/B UpMdwksfdG9cGQ3NSJJngRM66Y653oTBCntzx/v5PJREsi/r7OgumHoWP1quy6zz/5j4JCu+3q3 8KEcxWohPAYEHyWBQ0oONbSSS++/Lm7C2v1MGer++Smb3MRL8lz8CPo4CmcN2R8aI8Av9GlLyDu KUTmN/QPl/pzMbAhdNPcx1d0aWV8Q5OZXwYUWK/cMpxsNAxz+Idogn54oYXUBTusHAZmOpFhnl9 ZmeydR7PZWiycGVwSygPMl/sI3/zKAOChwqDB/ZxcffM+hQzZe9tbU3RWLcgERasVQ2pwM+wTsq rWrakRDR7p9B3zDqWAfcWa5GUrtS6JAMQ2bOaCBkk9467AmSPZL7FCcyoW5uvSsFsd/w77UISWs kwp5AaeOy2m12nZ8kbWnf17pxeQPo4NYnRG9rPKq/SWjS+FjyEG/lu5ZL0gicUgObX8+CSljs+p N+CmDnovJrdSSbQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_034103_030289_D3EC4F7B X-CRM114-Status: GOOD ( 14.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Oleksij Rempel --- drivers/iio/adc/ti-tsc2046.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c index edcef8f11522..24b1d4390872 100644 --- a/drivers/iio/adc/ti-tsc2046.c +++ b/drivers/iio/adc/ti-tsc2046.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -273,7 +274,6 @@ static int tsc2046_adc_read_one(struct tsc2046_adc_priv *priv, int ch_idx, u32 *effective_speed_hz) { struct tsc2046_adc_ch_cfg *ch = &priv->ch_cfg[ch_idx]; - struct tsc2046_adc_atom *rx_buf, *tx_buf; unsigned int val, val_normalized = 0; int ret, i, count_skip = 0, max_count; struct spi_transfer xfer; @@ -287,18 +287,20 @@ static int tsc2046_adc_read_one(struct tsc2046_adc_priv *priv, int ch_idx, max_count = 1; } - if (sizeof(*tx_buf) * max_count > PAGE_SIZE) + if (sizeof(struct tsc2046_adc_atom) * max_count > PAGE_SIZE) return -ENOSPC; - tx_buf = kcalloc(max_count, sizeof(*tx_buf), GFP_KERNEL); + struct tsc2046_adc_atom *tx_buf __free(kfree) = kcalloc(max_count, + sizeof(*tx_buf), + GFP_KERNEL); if (!tx_buf) return -ENOMEM; - rx_buf = kcalloc(max_count, sizeof(*rx_buf), GFP_KERNEL); - if (!rx_buf) { - ret = -ENOMEM; - goto free_tx; - } + struct tsc2046_adc_atom *rx_buf __free(kfree) = kcalloc(max_count, + sizeof(*rx_buf), + GFP_KERNEL); + if (!rx_buf) + return -ENOMEM; /* * Do not enable automatic power down on working samples. Otherwise the @@ -326,7 +328,7 @@ static int tsc2046_adc_read_one(struct tsc2046_adc_priv *priv, int ch_idx, if (ret) { dev_err_ratelimited(&priv->spi->dev, "SPI transfer failed %pe\n", ERR_PTR(ret)); - goto free_bufs; + return ret; } if (effective_speed_hz) @@ -337,14 +339,7 @@ static int tsc2046_adc_read_one(struct tsc2046_adc_priv *priv, int ch_idx, val_normalized += val; } - ret = DIV_ROUND_UP(val_normalized, max_count - count_skip); - -free_bufs: - kfree(rx_buf); -free_tx: - kfree(tx_buf); - - return ret; + return DIV_ROUND_UP(val_normalized, max_count - count_skip); } static size_t tsc2046_adc_group_set_layout(struct tsc2046_adc_priv *priv, From patchwork Fri Jul 5 10:40:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13724932 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3E23C30658 for ; Fri, 5 Jul 2024 10:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=z9Np41486ZPQDGlzQweAJezAFo0bzffLP3y8AkeihYA=; b=JLXDd4RGvsZ5SK4TscxfiP1tDt 9AGMz1VT3c/Q4mF1FK7258AaWbWBPaV1KQQlcIRan4c9ukMn/269TeWt+HbQ12VoPxJIC8awMBs5I ikketXDvb0KKqQjl1Dh+Ll2NwdZPc+SYak2XiNiC+ZZJfbEh51DOJk8AcPWNhCJe5VUuktzMNFWte GJaps1G/HDRasilYykdZUp78Y1ksErlRVYs13hg/voFXUfNa+twzHNWiqXNeHPpVzmhHgPyJfligj hI34xu50v66Osqgh2LdR2VfDVp58oXUZLqdEiCmusGZ+V+nW03e0exkt3V1bjach5M4k62H1DaBtw V4FgO7Mw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgOR-0000000FgEz-009P; Fri, 05 Jul 2024 10:42:19 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPgNE-0000000Ffla-3yFr for linux-arm-kernel@lists.infradead.org; Fri, 05 Jul 2024 10:41:06 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-36799fb93baso1012944f8f.0 for ; Fri, 05 Jul 2024 03:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720176063; x=1720780863; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=z9Np41486ZPQDGlzQweAJezAFo0bzffLP3y8AkeihYA=; b=bj7LFZdK/lCVLPcc9UHLBsZC6BjTf21T5slqwwQ0/KQ7W9l6cxBKEvDs4/Kg1IAueT zYj/THxcUQw2qe91pyEhboQswfQyN7Z+qruVwnqz9AizX59XxmkML5xD9O9oZamm4XcC cwb9w0sq3YbBkpGVcNmoMonhUTdEk4P9EUXMM2mj0lo4/wiEHQIBmjjuU8Y99ob1gOfU GLd9a2aIpgZc5C7eCVjaAWOtX8MTOrJsBvb50mc/r1H9c8JEji4aXiOq5tOfsS3mn0oD KfjBVRIOzqUobz0zIpYS/c9rldlifTXkOEvTS/++oKA4BG1arJC0IIFr2XHHWYiF+93V Bx6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720176063; x=1720780863; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z9Np41486ZPQDGlzQweAJezAFo0bzffLP3y8AkeihYA=; b=SmK25Xd8mQ4Xt+gtNu349Wo4EWQmB+qAQaMWT4uNuvQNtjOo6A6dKhMJgE/U1g+opo sNGpphrv/PSno2XR7hZU7Cq+P2W522FBx8ka5sFWwH8tCo/EqTUuNf3QsJAlb1j0PFNm OJUbEFmu1gOeTNqLkjwXwnIkepoI4T7jj4QQAQrASR+hnTBYowbHkuuSvSO/kkINHKpk WvifbX8xY/Dt6yBzfTR3hmjSVR3hY/Tn5hN0Aysn3FbTiEZCd1G5F+OgzAew/R/Qkl2O LJ4WBzvfxSCps1k5Uni8uS1AFH3Sx1FZxho5/HnokgWkizpnzRf3AfQ4Pv9n2JDaclLo c0pg== X-Forwarded-Encrypted: i=1; AJvYcCXFlrei/heqVbLGq2DFTwg+eTVc5EGoAGGLo2piMaPKxx3Afj5CA1fQK/cQNUDXg2qQdjy8312TaygqEdOvCMN4k7JE+bVU80QqvCKVUmgjL557MhI= X-Gm-Message-State: AOJu0YyXP1aWZtdsLKKu7Z9eEulCbQLr/cVDONcJ/z7Id0UCL317Yzk3 WkzdwWRQTA37cW/p2Yde2HPl2AYyclYLdHD+GhH4unbR8nxXSWEpfwGIIvk+VhE= X-Google-Smtp-Source: AGHT+IGJmF2yz6CclwNaZobfkh+KzmhezsSI6pZ1+CVEOHBJkhN00D9Q5QVyJPreYMVR2oHvYBqtxQ== X-Received: by 2002:a5d:6849:0:b0:367:9614:fb99 with SMTP id ffacd0b85a97d-3679dd31137mr2795078f8f.10.1720176063285; Fri, 05 Jul 2024 03:41:03 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36789d5ec1csm8680446f8f.37.2024.07.05.03.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 03:41:02 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 05 Jul 2024 12:40:49 +0200 Subject: [PATCH 6/6] iio: adc: ad5755: drop redundant devm_kfree() MIME-Version: 1.0 Message-Id: <20240705-cleanup-h-iio-v1-6-77114c7e84c5@linaro.org> References: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> In-Reply-To: <20240705-cleanup-h-iio-v1-0-77114c7e84c5@linaro.org> To: Dan Robertson , Jonathan Cameron , Lars-Peter Clausen , Michael Hennerich , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Oleksij Rempel , kernel@pengutronix.de Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=661; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=wAVpbgQ5bIpyCcGTaGFP8RLhuVeOqnrOwZ6oTfnW4nw=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmh82yqE4WDfmxPDBzauwZ3Iq6vku5GtvtWvYVd MK7kTqYSIKJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZofNsgAKCRDBN2bmhouD 1+4WD/0QMoTcaJIkRnw0sl/FKPn/9xu4+bNaTVtxm3Oxvxf02oev5VhaxB/RJzKUopuc9Cv9TPc t5V+qudWwmVC3/6vIMZGISLvYkNkpTBIg7SZs74tbZ//7NGVeYfC8s4ev8SJ9r5X3TvMgihmu32 JDEMyQ0+klT275tvSKA+cYiaBmUDRGolzvO+uLc/ZMTdTrBOvajCSrjP1LNCSNVaCX7uc4gvXQ0 I6VGNMb1glQMD+CqNQQ2/7wHcctG/vqmmMneeln6lYioC3njEV2NVJ7txWExIB3w4NhMQWyIswZ QzPh1o70THWr0Hv7KhbeC6o3777jFBthV8k66WA9cybDPF6SuNwzyFOAIhyuFrBv8q+NxhVeTDr +MUCHc90reVhXMlmtSxpU5I0apW01OHOThkXoKs6GE6/10879YqP4xAcpZYW1hIH52q4dsxmSzh 2J0fts9TPugTQvZO1IU4U4i/1Sk8N/WbyjCzbCuNgjsRXigEtrDALzXboSrFCr4LEijx8y/t8OQ EeYHwqDY8qrVPGVsRCTIg2XARx/A/0pC5G5CEB7vHDQ2IKCDSQ0Bs1f6bSgGXhNI6x5QFVg8Z94 zbF2g56BKULxngx2n4TgUEXShv3yzJR5xRh8rRncc0BIluerLglDleXmovbT3iCGLf4g/nWp/kE gfF4RCMThWVj7tQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_034105_022342_3B560C45 X-CRM114-Status: GOOD ( 10.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver calls ad5755_parse_fw() only from probe() function, so devm_kfree() during error path is not necessary and only makes code weirder. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Nuno Sa --- drivers/iio/dac/ad5755.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c index 0b24cb19ac9d..bfbfc3c1b6a5 100644 --- a/drivers/iio/dac/ad5755.c +++ b/drivers/iio/dac/ad5755.c @@ -803,7 +803,6 @@ static struct ad5755_platform_data *ad5755_parse_fw(struct device *dev) error_out: fwnode_handle_put(pp); - devm_kfree(dev, pdata); return NULL; }