Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3275561lfo; Mon, 23 May 2022 00:28:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYcUJrUc/lRTwmD2G1IgsOMuSWk9FCAmYI+1onqEPpsc/d7G1tgzawdvs6X8lND0Acpg9D X-Received: by 2002:a62:8349:0:b0:518:143e:235c with SMTP id h70-20020a628349000000b00518143e235cmr22187848pfe.82.1653290914716; Mon, 23 May 2022 00:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653290914; cv=none; d=google.com; s=arc-20160816; b=nLCqVCgVANTGKSr5XQYn8gh+7vqkfN1ch8qHTMNsnhftrreWgWiZaympRYl8NJlU+6 3mjUDirpJaVaR0XfvTqj3AyiD+eD8CJi3TV9hFSgLxdl4Iame5DKIge2MZd2JV1tV3cs l7KoG4gJ8ZSxRivaN/ec5YjazwtfoQofOYapF5nLuWsiLWosTZPClCYG0VFNzxxIfSD5 39K/YiDjRotP6s2A/09Dww0Dtgv/vpilzEX5HlKwJ0pv1EelJ2kMQpocOwBjiPR5G79F fnknq2j4YgP+pSGojGh3UGrICR9cMAyqFTEYkfpLUa0Pusk8G454RKUtjTmI1jrCQ56T TI+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=RjBoRtJ9rZ9SbhlMIrKNDfXCMj6QJFpi/1uxRxKT1L4=; b=qoIbDvuPraTIrhZ6xlJwMK3CwWR0AD19I7OwFiXRIETApgYtMKvmzbWb+IWVhWR7jC vrc4GpKlADwhtUtdVvyFjRPdepXMa3Z5J0G5FujFDO4EJ9zrT6fx5r1CX9S1jldOJnI3 vdDQptK7NXnlfhgHoBcoaLBrHz+s0hWfqcL5zQt6tRSuRAMlk1sERF9SujYC+osMkxZP pyrFz4yqq4uT005dqawTCsXUpcId8KFHjPUMuKbBUR2MnkU2YXakuujlQ3O5/t+0valY vezlEnTZ8Y5qFo4xO76H3RQzpm6CFNSsgkNgsJapoXQuRKV5eqs1oJ9WCpnM6ZHRsdYA wSrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="LFb/2bSw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w22-20020a056a0014d600b00518b91753b2si261541pfu.207.2022.05.23.00.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="LFb/2bSw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4F69D3526F; Sun, 22 May 2022 23:41:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346870AbiEVOfV (ORCPT + 99 others); Sun, 22 May 2022 10:35:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234015AbiEVOfT (ORCPT ); Sun, 22 May 2022 10:35:19 -0400 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED99836E39; Sun, 22 May 2022 07:35:17 -0700 (PDT) Received: by mail-oi1-x22a.google.com with SMTP id e189so15174031oia.8; Sun, 22 May 2022 07:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RjBoRtJ9rZ9SbhlMIrKNDfXCMj6QJFpi/1uxRxKT1L4=; b=LFb/2bSwFk3msFQ+ogdHWsYHKKSoWvo50E8hISdryt0WB93qAs4QD7Ta8h/0lNiliu 34JUG7iAKd0jTg5vxovpAvstRGRkyioP5kwlfqdY4Wxp1uLx4ENBa1YRhMAd3CzuRb/r UJNqplFufD9JahRcuJFp3tmRRYJxiy7CJ2YpIQcdLLK+OgCsSIoRqqN90eJ65W4irjfG f2ZtcNOdntZk9r+iyF5MYCFOgItmUQy9O2cXTCDWvQFDUdO24j6FzJGVhnaldzAJHUbO s3VXivECykXvwbuX1rFMtkFEen8Y2oj8g0ajfN71d0XLZD4xiNewE+jvlhmLIdXn+S1E nkGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=RjBoRtJ9rZ9SbhlMIrKNDfXCMj6QJFpi/1uxRxKT1L4=; b=lmdQipZrYmmCe3yRHmUeb2UASyb1P+gsiqUiE8uzHr0MvNvMNIcROyRdC+G7bqfXWo KQ5EI6OUaXOkaDpoByDVhOoueUrwiveYtTML/TWZuZBFz2bGiEL0rQ9d2qCwN08P4v0O OvWoqOyXBNCu9LDRpt2tUmH80GqkPWeFcd4jf4tEkFkuKSet7chIUfc9zMkpIY8J6KFq lB7JgPd+HdH2HrLiMhQLKBdyWboAgZeXor1jCGiAoVd6bWXU4hNF0q6L3ibYpa4fuJje zkHE4uIV+H+ai3/DgLaK08qzaDNgkF4ZKdtgChrv1vmVS5AjU+QNlzi6cC5GmNLwpi12 BdEQ== X-Gm-Message-State: AOAM531eQgf1VY9a3R6zjJSNlXE6moodyBQXkszpCE3tBKJGaZRqvrA/ Ynd7wT85+ueK+I5S/twc7B8= X-Received: by 2002:a05:6808:1287:b0:326:d23f:f251 with SMTP id a7-20020a056808128700b00326d23ff251mr9636155oiw.155.1653230117198; Sun, 22 May 2022 07:35:17 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id q196-20020a4a33cd000000b0035eb4e5a6d2sm3332387ooq.40.2022.05.22.07.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 07:35:16 -0700 (PDT) Sender: Guenter Roeck Date: Sun, 22 May 2022 07:35:14 -0700 From: Guenter Roeck To: Christophe JAILLET Cc: dan.carpenter@oracle.com, Aleksa Savic , Jack Doan , Jean Delvare , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: Re: [PATCH] hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe() Message-ID: <20220522143514.GA242830@roeck-us.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 22, 2022 at 03:14:23PM +0200, Christophe JAILLET wrote: > If no memory can be allocated, some resources still need to be released as > already done in the other error handling paths. > > Fixes: 752b927951ea ("hwmon: (aquacomputer_d5next) Add support for Aquacomputer Octo") > Signed-off-by: Christophe JAILLET Applied. Thanks, Guenter > --- > drivers/hwmon/aquacomputer_d5next.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c > index 7d2e7279abfb..a0e69f7ece36 100644 > --- a/drivers/hwmon/aquacomputer_d5next.c > +++ b/drivers/hwmon/aquacomputer_d5next.c > @@ -783,8 +783,10 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) > priv->name = aqc_device_names[priv->kind]; > > priv->buffer = devm_kzalloc(&hdev->dev, priv->buffer_size, GFP_KERNEL); > - if (!priv->buffer) > - return -ENOMEM; > + if (!priv->buffer) { > + ret = -ENOMEM; > + goto fail_and_close; > + } > > mutex_init(&priv->mutex); >