Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1386350ioo; Sun, 22 May 2022 12:50:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2W4OZ0v5JBk+hkptviThlbMZkbyqFdqOG9J5Be1amJ5BQ7cOZjrNb2UCyc9ouRI1GVV7d X-Received: by 2002:aa7:d04d:0:b0:42a:acac:2cf7 with SMTP id n13-20020aa7d04d000000b0042aacac2cf7mr21022420edo.424.1653249024526; Sun, 22 May 2022 12:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653249024; cv=none; d=google.com; s=arc-20160816; b=ZT/8OZg7oeksI+55C7qHssrjDHlzTvHmgPfLQJqyOvKbWyA5YAml+l/37B98TOzbWO wAvAlIyJLwGCpcTx52rQ/LrRWYLXmtjihaTHGABFaUkIX5STCGQU4wSKgwrSQVWLPC5b 4cCEGRICB7wAPTWjRycQd9KbG6rzOR+7sC1FhZ92dS1oWC+J0xXg7ZAjLJG69KqpYV5/ yeveP/LY1R+6/jX9QchNxrCn2B6BcBXqreSFDV22mYS1uchQXzg2lbXJTZOTXOKoRnhm 772PNlU8Tve7zVEEJsWYhnvm+MSGx8ZFN8GTglJkkk7wNUqL4maL/8mm1xpWyjUE8aSo X3Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=1VkQ8luVxAQauKdKKcqBpP8/ZxMn+CLFGLeduxoQTLE=; b=mQapdsVx+Qy4j/VEuh6c2rRiDGea/1ZSu94GDoUq1jjL/4uW5BBl1xsZnE+0Fle0s2 vU9ij6x6kWNI0WrNQlCpEVHuoHCNFZ8McWJ+mv0Yxww1oxkaySOWGU2eDzecKgp6ixF6 yX6P/0xZF2g9uEmGKl4e4mjWYBwMoiFQI1VZyY1r+H05ds0eKARprrdHIxZhf54c+Fc8 v0f62ccWN5x6Y2acgQ9uzXU82dVZ/mTNTe55z+SijxPIR+jxcylRRKKjNSa4zmmFpmys eairOTOPGYIbDBlRGIA5Ph+Uk2+xUwKGtFSbNiC2WWArq6bNbnW3colbfDC3n8C5s8cx 4nVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i20-20020a05640242d400b0042aaae1f965si17472256edc.572.2022.05.22.12.49.58; Sun, 22 May 2022 12:50:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343804AbiEVNOg (ORCPT + 99 others); Sun, 22 May 2022 09:14:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241266AbiEVNOc (ORCPT ); Sun, 22 May 2022 09:14:32 -0400 Received: from smtp.smtpout.orange.fr (smtp05.smtpout.orange.fr [80.12.242.127]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F14A239B8C for ; Sun, 22 May 2022 06:14:29 -0700 (PDT) Received: from pop-os.home ([86.243.180.246]) by smtp.orange.fr with ESMTPA id slPcnkcVJZDzUslPcn67gX; Sun, 22 May 2022 15:14:28 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 22 May 2022 15:14:28 +0200 X-ME-IP: 86.243.180.246 From: Christophe JAILLET To: dan.carpenter@oracle.com, Aleksa Savic , Jack Doan , Jean Delvare , Guenter Roeck Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-hwmon@vger.kernel.org Subject: [PATCH] hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe() Date: Sun, 22 May 2022 15:14:23 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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 --- 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); -- 2.34.1