Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp965898rwd; Tue, 13 Jun 2023 02:58:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5eGxd50ZioB6P1EXCuCx6w2pqMN0YPFYfq+81RBydi6ePnvBDlNXFYTdtA8g3e6RqHkSQb X-Received: by 2002:a05:6a20:a124:b0:10e:de4f:3437 with SMTP id q36-20020a056a20a12400b0010ede4f3437mr14870921pzk.39.1686650284961; Tue, 13 Jun 2023 02:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686650284; cv=none; d=google.com; s=arc-20160816; b=OOfIup2HUGuSIF/35AoWGUyyF0uaa8+GWReVBSvhRdGbb0vJQZi2gmNGbl5Fj49bA2 +GAipGOIQUGGtOWlIOrYCjsoy/SnyILJIKBuIjY+qo+u0BD5c7nseexsQtWPDMYw4bd6 YlMEIxSirVJEqBh8a9J8vLb8vicFSP2EY5C4Jk6QJxNlKMOzelFt+IGsGSkTz0uOZe0e i+AKkEIB/K5o+vO4nzG0uTWFqHyrPiDv+RI4lo7h/1QWG7gQBQjx5jxT/hAa9++rWElq myzuBT6I5llJhTaYeovo6WopKFzqAf9RYSjIX7YNIZNHG8gVcBvYyEPxNbSu2kxxmErZ U0+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-id:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=gdtmbclTDGh4fLbd2WIfVvx2SFdPyVFmLPQqz+yBMpk=; b=cezJR9RM8MjReIgMdSiu3zy9Fzj6Ma6E/jZ+YLT4mMDmkRm6pOeS/4Q0NWIbSLj6wI 917gCe1WddLXSVE7u4f+KxNBFfU6GiFYklZaVuoE6vlgFk1Bu60W20dKJckWSNej54bm XxW7EASOYukMm7j6afg3VSSMJhd/s4OX82ZyRIfWTYlDeE37dpbB2tg3LgzuO2hLVa6g 1BDnwuGY5G+OQ4pzuNePANpQSMOJgElGIKZUc8vy2SoeXBRWAva2e8PHLYlIm94l2N57 OSZkW4bzgA5Dx/Ynt7yO/Ky3W5AvSSrobE4x7Sg+7MTbFDsciW/gTSpVpIxdbWkjgUut VnMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=j8vOGpsu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y82-20020a626455000000b00643652c8879si5270905pfb.326.2023.06.13.02.57.53; Tue, 13 Jun 2023 02:58:04 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=j8vOGpsu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239502AbjFMJ2K (ORCPT + 99 others); Tue, 13 Jun 2023 05:28:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233062AbjFMJ2I (ORCPT ); Tue, 13 Jun 2023 05:28:08 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FD2CE52; Tue, 13 Jun 2023 02:28:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686648487; x=1718184487; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version:content-id; bh=+94BmlOXXK9BhgybLoQlXD+SsDGq3jQslMKS/rV+7YI=; b=j8vOGpsuuH5cNj5ryiTBbaavIVd3RgLgPGbu2veeIROEg5ObgtXfAxwI AW+x+9zvEJRRIB5Qob6FXyUUzmwTDTOS6wPCQT+Z/4r+846KGawl8KSSS wAtb1qWXQjZDVrECrwP9/6ypA4tvkBaFXF4cHJ5dIFXiugGs3b6LvUBYG 0LTpfd7FuJGYcjvZeAXRx5Hnegiskf6sdYz/P2ZaJJ4t1ME49DVwSWQwG XmwBwd6AM51FlhLjKd9MMhkv4/V3LKu7b3RiZLnS5ssKcY6wFNTzIEuxR 6dkAeChLhPemDAEUVPbbab5shLCHiOvQw+pPR4VRn8AUcJmh6FqYpTIlp Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="444654230" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="444654230" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 02:28:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="856017131" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="856017131" Received: from abujor-mobl.ger.corp.intel.com ([10.249.44.113]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 02:28:03 -0700 Date: Tue, 13 Jun 2023 12:28:01 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Michal Wilczynski cc: linux-acpi@vger.kernel.org, rafael@kernel.org, andriy.shevchenko@intel.com, pali@kernel.org, hdegoede@redhat.com, markgross@kernel.org, fengguang.wu@intel.com, dvhart@linux.intel.com, platform-driver-x86@vger.kernel.org, LKML Subject: Re: [PATCH v1] platform/x86/dell/dell-rbtn: Fix resources leaking on error path In-Reply-To: <20230612090250.1417940-1-michal.wilczynski@intel.com> Message-ID: <27dfd35-1d9d-b52f-ee7-1a5b9b25794@linux.intel.com> References: <20230612090250.1417940-1-michal.wilczynski@intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1811702421-1686643242=:2099" Content-ID: <902feaef-9eb8-167d-8b1b-9a28d1c936b8@linux.intel.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1811702421-1686643242=:2099 Content-Type: text/plain; CHARSET=ISO-8859-15 Content-Transfer-Encoding: 8BIT Content-ID: On Mon, 12 Jun 2023, Michal Wilczynski wrote: > Currently rbtn_add() in case of failure is leaking resources. Fix this > by adding a proper rollback. While at it, remove unnecessary assignment > of NULL to device->driver_data and unnecessary whitespace, plus add a > break for the default case in a switch. > > Suggested-by: Ilpo J?rvinen > Fixes: 817a5cdb40c8 ("dell-rbtn: Dell Airplane Mode Switch driver") > Signed-off-by: Michal Wilczynski > Reviewed-by: Andy Shevchenko > --- > drivers/platform/x86/dell/dell-rbtn.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/x86/dell/dell-rbtn.c b/drivers/platform/x86/dell/dell-rbtn.c > index aa0e6c907494..e9b3f9c3ab7d 100644 > --- a/drivers/platform/x86/dell/dell-rbtn.c > +++ b/drivers/platform/x86/dell/dell-rbtn.c > @@ -420,10 +420,12 @@ static int rbtn_add(struct acpi_device *device) > break; > default: > ret = -EINVAL; > + break; > } > + if (ret) > + rbtn_acquire(device, false); > > return ret; > - > } > > static void rbtn_remove(struct acpi_device *device) > @@ -442,7 +444,6 @@ static void rbtn_remove(struct acpi_device *device) > } > > rbtn_acquire(device, false); > - device->driver_data = NULL; > } > > static void rbtn_notify(struct acpi_device *device, u32 event) I'm a bit worried the stable people might not like "these while at it parts". Those changes too are all good but unrelated to the actual fix so they should appear in their own patches. -- i. --8323329-1811702421-1686643242=:2099--