Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp2304783pxv; Sat, 17 Jul 2021 09:43:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCDNAFd5aN8TjBJu0NmyGRSGHysWw8H3FXc84qVaBQik/jSmXDRtwEhX/DAPX5SLM0dCKR X-Received: by 2002:a5e:9703:: with SMTP id w3mr11620565ioj.118.1626540188235; Sat, 17 Jul 2021 09:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626540188; cv=none; d=google.com; s=arc-20160816; b=CDjtN2+ZMjiXYt8C1zogVCWjGsjv+8OggrAhw0MS41B8YzHXoyBs/LunuFMB4bgjLa 1O9nNeH6ySoTL1LrKUOJ7bb3dnfdnZJL8mfmg8keRR/rAZk+YfrG8XsWtl/Ce403uGB8 lCrjwITmmlbqdv6qBYBgsCU8rC/V9yp86U2IJ5GIMpFLI3JBQvwnz+cbpro+MFQeyRRS 8mn/EE2u5FERwx+ZJ6DdNG13seE+I7L4KThJ62N1zTptJvfMpRfK5obcFVMvRVdHT3XW z8JOFs2GvmWiubiOIbKsIPm4YNEBTNdIXAXJfLXpgmwim4oU2rZWGG6lVb98TC3Co0o/ HfHg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=hhoE1r4XCmqCYdI/qIijZJUN66nMYTW6UbeXzoMj/jY=; b=r6Ys2cUCBisQvmT2/kk1phU++0P7mkwn5m+9C36xLKSIq5lMgkOI4sWb2FDUJwV28e dkDZocJq1rbE+WCP+siffg9grbIlpp9fJo8MJCMBKxwYqhgSnYFm1OlWmjHGtyzXk+om Zmb0A+NwR0GTfbUlWxHDuWSRHpDGFpdghZzjm+U4I6K9ypVkSS0I5gnRwN8hAsAcE1zq VEPpqSK0o1eRwJtQ3YrZP1VHb//fQVucMT8QXHDIm0tsBGSmyZf1X+GKLz2rE3xFMA19 JqMiSUhIFh7epGYFa3tAmWAoecsXvQTPjdmRr6uvlW1uK8z1wdHE4/fnrvmLkvauR33S sFAQ== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s12si14533365iog.99.2021.07.17.09.42.55; Sat, 17 Jul 2021 09:43:08 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231772AbhGQQpM (ORCPT + 99 others); Sat, 17 Jul 2021 12:45:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:59764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231346AbhGQQpL (ORCPT ); Sat, 17 Jul 2021 12:45:11 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 18D1E61159; Sat, 17 Jul 2021 16:42:08 +0000 (UTC) Date: Sat, 17 Jul 2021 17:44:32 +0100 From: Jonathan Cameron To: Hui Liu Cc: , , , , , , , , , , , , , , , Subject: Re: [PATCH] iio: mtk-auxadc: add mutex_destroy Message-ID: <20210717174432.7e69e4e9@jic23-huawei> In-Reply-To: <20210715093523.29844-2-hui.liu@mediatek.com> References: <20210715093523.29844-1-hui.liu@mediatek.com> <20210715093523.29844-2-hui.liu@mediatek.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Jul 2021 17:35:23 +0800 Hui Liu wrote: > Add mutex_destroy when probe fail and remove device. > > Signed-off-by: Hui Liu Hi Hui Liu, We very very rarely bother to call mutex_destroy(). The reason is that it is only a non noop in when mutex debugging is enabled and that is only useful if there is a plausible route in which it could be used after the mutex_destroy. Given these are both at the ends of removal paths, I don't think this is useful. That's why you will rarely find mutex_destroy() being called. Thanks, Jonathan > --- > drivers/iio/adc/mt6577_auxadc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c > index 79c1dd68b909..d57243037ad6 100644 > --- a/drivers/iio/adc/mt6577_auxadc.c > +++ b/drivers/iio/adc/mt6577_auxadc.c > @@ -289,6 +289,7 @@ static int mt6577_auxadc_probe(struct platform_device *pdev) > ret = iio_device_register(indio_dev); > if (ret < 0) { > dev_err(&pdev->dev, "failed to register iio device\n"); > + mutex_destroy(&adc_dev->lock); > goto err_power_off; > } > > @@ -313,6 +314,7 @@ static int mt6577_auxadc_remove(struct platform_device *pdev) > 0, MT6577_AUXADC_PDN_EN); > > clk_disable_unprepare(adc_dev->adc_clk); > + mutex_destroy(&adc_dev->lock); > > return 0; > }