From patchwork Wed Feb 21 19:28:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 204426 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1287818dyc; Wed, 21 Feb 2024 12:45:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXn19eRI0hH1pF7ECeiqHnpCb5FFPOimc1Z+q5g7suAfIpq3lBWYH2s40JYuAnvxVVE796Hibm+LohszaH3nlzLgbOUKg== X-Google-Smtp-Source: AGHT+IHmE6rGBadc95kmF7vlWfvefgtJbc5Wg2NzWaz2v99Zo5MuK4RO3G9qSqaro8hxQAgBprBY X-Received: by 2002:a05:6a20:ce4a:b0:19e:b6da:da1b with SMTP id id10-20020a056a20ce4a00b0019eb6dada1bmr772307pzb.4.1708548306936; Wed, 21 Feb 2024 12:45:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708548306; cv=pass; d=google.com; s=arc-20160816; b=cSD6tcD8r5kfo7nAggbjGfvGf7NtGGgpRZB7JWX1lQuOc3skQBTJtdBQvHhHBP4IG1 ZYwnEOTtujcFNTzwgtLGV2noE7UD3dL9WbPaHi2jCC0ZB/QemfzAg8iV49lhCIhNA1B/ OOXojwJtG6P+CfAexeUamYALO3KxBtEG5Ylti6N4WtR5DVMj62xM8X8IwIJlD3T7Yw5L lKinbIRccXZKLg8RJw896PJSlVPMi0OBnCi0sbYXmOKzFCs0+g0e63kLpI2VKf5bsz7N KlS6NDczjzKSy48koyJPVJvna38eeXulkSN9JfAGb4IrBnpnvgGeICvVK9x7F2FULp+O BdIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=U1K5qiXcmKhNMUfqte9CkwKq7hHEqd8cX5kzLe9Yt40=; fh=NPMp9GFIdVjeGPEuneJtItyZfXCAUr5mEOBv8M3Hyn8=; b=DGs+mp49lrC585zb85NhSMeKdZAlPYVwQe+9YrTMRGRcPUVcLRk2nc+9br3YJtDAfb xpOqIpnOACfETu0G6GxtAZyeCQdr0IEzM8vC96virDLrRNCXU/Dixj6QiRDi4Jf4REyW gEiLg/HAnXm6JuxUA8pkcvJgQPUWMphr7pTyX3hGB6QDN2jE8fFcPq1I2PofXcN5oRzX 1+FrS2+a67wzLwAR3rbXk/S5FggCjmJguMEs6L6FuHLdBVdQTsJkGrnKCLu2iDgiX37/ s+goXi1AUK1iBxfRZwosX+eP8CNnAq0ujrwVJw5XPV3uwltpBpiQ648t2gV4ma3ssH3R MRFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mqOjbfKL; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-75365-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75365-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b73-20020a63344c000000b005dbdce9d103si8809871pga.563.2024.02.21.12.45.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:45:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75365-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mqOjbfKL; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-75365-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75365-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0C1BD286FC3 for ; Wed, 21 Feb 2024 19:29:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2637F86620; Wed, 21 Feb 2024 19:28:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mqOjbfKL" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF7A583A06; Wed, 21 Feb 2024 19:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708543733; cv=none; b=N4VMuWzQRxvRdFMsC9jfTaQaPtOjruP0dK3Gq7zeOlLUjPcHANI9kkPrF66vUybhSxEF2npH7FoV1I5sWRafTB5T3G1alszhiMBtF9TO1BscIduoo/QP1Ndn02RjPMJbAT7I9aw4R1gftcZzyvcd3FACzesoOd/+s6lDZTSU7MM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708543733; c=relaxed/simple; bh=OCG/9QBJk/VuCn1UQ4bcO6gfWP+ArN9q7qEDy/bgmow=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gWw8uI9xDiBwvf2C6axxe3hJB81gGhqPlJRFn8E2oT6xh4/5GKxrh/CbjPbW8jz11MHXZgRdsiSfgQRnmeVQtYMmza6GUfjkjC1ibVzMbTl/ogp9V6tR+mQqnwNaCwV1TCUWd+UIvXdEuA5KMHZkE3LGU46r1xey9ihRBgCIem4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mqOjbfKL; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708543732; x=1740079732; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OCG/9QBJk/VuCn1UQ4bcO6gfWP+ArN9q7qEDy/bgmow=; b=mqOjbfKLNkbdgFwQRMWRUbN7hDvGe1od73w7rVzLiMP1GaxO7gGrRVsH ix+y3Z6mDz7AtzDb7CWXKHUZEMMYJ6aGQHgivSZuvteOIQ5/+NWeFM2p+ QnHFa5tkHrAPcnWXlWoXYTtI2IqfsYYXfkpWDs9DhZ9Q++ktoeyoVO/KM LPtwoKBLtpE+HC6mxk90uU77fT8nO3+FGNfdNXc1s0Md28pbIlfv8yX4u r5Zp1yQGVtI09xSzoMtzikd/nNama2K5eIRPzlt88j+MHsZkbd6BOy9ii BwAoJzt+xHdkJ5Cjqg+v2cGxG9cO/Pl5oe2Ys2sDsDgq8oytfsY/s7AHn Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="25191396" X-IronPort-AV: E=Sophos;i="6.06,176,1705392000"; d="scan'208";a="25191396" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2024 11:28:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="936692316" X-IronPort-AV: E=Sophos;i="6.06,176,1705392000"; d="scan'208";a="936692316" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 21 Feb 2024 11:28:49 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id DC92D2A0; Wed, 21 Feb 2024 21:28:47 +0200 (EET) From: Andy Shevchenko To: Bartosz Golaszewski , Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bartosz Golaszewski , Andy Shevchenko Subject: [PATCH v1 1/1] gpiolib: Fix the error path order in gpiochip_add_data_with_key() Date: Wed, 21 Feb 2024 21:28:46 +0200 Message-ID: <20240221192846.4156888-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791542749428889545 X-GMAIL-MSGID: 1791542749428889545 After shuffling the code, error path wasn't updated correctly. Fix it here. Fixes: ba5c5effe02c ("gpio: initialize descriptor SRCU structure before adding OF-based chips") Signed-off-by: Andy Shevchenko --- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4b4812bbcafd..1706edb3ee3f 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1056,6 +1056,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, gpiochip_irqchip_free_valid_mask(gc); err_remove_acpi_chip: acpi_gpiochip_remove(gc); + gpiochip_remove_pin_ranges(gc); err_remove_of_chip: gpiochip_free_hogs(gc); of_gpiochip_remove(gc); @@ -1063,7 +1064,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, for (i = 0; i < gdev->ngpio; i++) cleanup_srcu_struct(&gdev->descs[i].srcu); err_free_gpiochip_mask: - gpiochip_remove_pin_ranges(gc); gpiochip_free_valid_mask(gc); err_cleanup_gdev_srcu: cleanup_srcu_struct(&gdev->srcu);