Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2353412pxb; Mon, 20 Sep 2021 19:51:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzDRwkU9RylEu8jQYo1kPvPqw9xuV0qPej8QYkwTQ8r1zeY6GOGs5DmZ0uJMu6DINlp9Sh X-Received: by 2002:a17:906:40c3:: with SMTP id a3mr23478230ejk.38.1632192697481; Mon, 20 Sep 2021 19:51:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192697; cv=none; d=google.com; s=arc-20160816; b=ytblAs2S8lrSZhK+aIBK+ftwpSALiHdhazUKq6bocPO4S9oQ6E5nrnXe5v2NpWiUmp wYhnqQxoyob8XRJjDq33YA1H16VIZO+tPb4GDzjMVf4xOvTBfjLN0ZCb9WoZNRlRUWPf gO7HfE+DDLyWo4UCBQqaSP30rT1720SIEGhN+vocn5r1S8iJoZC0F67K/agWVPFqffwt ea+0tjzy8YUv/8qTzVuB1E07HzAHYcs6ryf1B/tEMDIin7NGdE7S+xBOiJMTNCOSSzBy 3e6M8uRl66Tv9hfVNoQovqpNDm3vTgFYiyNJzfVNtUoazndw3VT6WFQ3Vjr98n94qdVv jxtA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gbWbirerN1yXudRVj5Z5QKJl5ualPG7oqD90TpMW3z8=; b=ao35RFVfQybaiYGElPhmjZImw3lc0H3wIbjUhdAi9qYXsRo+hrgp3lohDjOTxcuSbR /MXmB5Vi8gyMQvntHaEjZguSJMD9+igh8SGQ6gBCjZPpuPHzhX+iqn1M/z8/XmOD2T8U t4fUr6Ytni+PE+piaFlqTOLt6B4PC6ydj/INVK+kccKnNND8s3fnSnGiwCZ3jMWf1ECT vUUmAC8seNyN/ePQTaI/bRoE26k+6z1ruLbZItAWhdarPFdnw9DfobrGF2rbmuNHFTCD sOBjGcIxErHNg6DsX84nOX+UCpQARXgMoK73+9fYxmFEFjptdNNYA7qmz4h2Axk5mFhQ HYLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GwJxpV9R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ml14si3041733ejb.459.2021.09.20.19.51.14; Mon, 20 Sep 2021 19:51:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GwJxpV9R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382423AbhITSkZ (ORCPT + 99 others); Mon, 20 Sep 2021 14:40:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:54226 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379309AbhITSgQ (ORCPT ); Mon, 20 Sep 2021 14:36:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A98026331A; Mon, 20 Sep 2021 17:29:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158944; bh=66xlvQD0Gb9FNYNhXTZe5EXDwOjLwO5ScT1YPxrSOsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GwJxpV9R3oJz2N4eZZhSsueHuRcEW3iPu975jrCOfnKaybvZfQL00ZknSDqV7VeIu fujsQdxgwhIKurcT9C/0XdixKx9RnjGsqiXuRaamD2Cr/Z5oDxb5umw+3pr1CIw0As 1BpiwmjmS61NS/ylef6AP7JjpFQn2kAWYLchdv5c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.10 101/122] gpio: mpc8xxx: Use devm_gpiochip_add_data() to simplify the code and avoid a leak Date: Mon, 20 Sep 2021 18:44:33 +0200 Message-Id: <20210920163919.100326398@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 889a1b3f35db6ba5ba6a0c23a3a55594570b6a17 ] If an error occurs after a 'gpiochip_add_data()' call it must be undone by a corresponding 'gpiochip_remove()' as already done in the remove function. To simplify the code a fix a leak in the error handling path of the probe, use the managed version instead (i.e. 'devm_gpiochip_add_data()') Fixes: 698b8eeaed72 ("gpio/mpc8xxx: change irq handler from chained to normal") Signed-off-by: Christophe JAILLET Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpio-mpc8xxx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index a4983c5d1f16..023b99bf098d 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -374,7 +374,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) of_device_is_compatible(np, "fsl,ls1088a-gpio")) gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE, 0xffffffff); - ret = gpiochip_add_data(gc, mpc8xxx_gc); + ret = devm_gpiochip_add_data(&pdev->dev, gc, mpc8xxx_gc); if (ret) { pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret); @@ -419,8 +419,6 @@ static int mpc8xxx_remove(struct platform_device *pdev) irq_domain_remove(mpc8xxx_gc->irq); } - gpiochip_remove(&mpc8xxx_gc->gc); - return 0; } -- 2.30.2