Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2459014pxu; Sun, 18 Oct 2020 03:24:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4/YSw7W37998ZwaGVz2ngppVmDiGTrhCLmLahGuZI0CjWo1ykvn82FoeISlFLGZyMpTBq X-Received: by 2002:a17:906:f8d4:: with SMTP id lh20mr12170749ejb.188.1603016676018; Sun, 18 Oct 2020 03:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603016676; cv=none; d=google.com; s=arc-20160816; b=SlX9KWZMfAz/kkbAg/4PWD6NHwr/byFQlEVQtQlaycFFayb+nd7MfI00H147jD2HU+ LsTrhH/eOWUDNu/3/ZY2C7Lg4+/JgATo6fgei8FP1F8GhlFsJhWD+n0fmoAyyW9R4JY+ f6sq0WDJ6/udHtg+mWPxmY6xByBetKe9pw8/F7gPa1K50cZHDtRq2jxhmkmLwySxs+dx E5j41328tBmPTCQLbXdGjP4XbjcK/k91KwNA/ImCMsgDw9pIzGICdognn53cbjNbx/s8 kUTGRQrM1yRfmLv9gD3HGd0KAfeKv5hmIX9HzKtGH6Fgxr7OZywtuAIhDchV/3SftXqj bwPA== 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 :dkim-signature; bh=eEuD2zsHQjmXO46wBkvcLLebgg9E7rii/XCsv5nQBgU=; b=N10e2KWF7kTNMGo1t2lpiMbdbOn154VyQ+dCjTUwCrRor5B7Jd9g91wJUqMh1eS7KT ZTIlYXGOphrzHxDOv6y6EqsHcNEX98qcHtOvL2G8J5Oib49kQqEZmuKc3c75xMg80Nbl Ame5PiVxGICUWy++0E3VNpKG6fFvwApqOWhbxxvc6jGxd5IZp4LahczJ3BfjidQ+NCiu 9HgHmHwq+seTk6KjM8YKCrzwa6E2M7OwEBBLWL0jraqE8f0XugXhHTkdaqAKxzthLAN1 yUeap7y8bE6e1bjXP7ghGeFsrE/RqdzYJH3UbO7CzW1PUubdxN0N79LwoV4+jCDv0P7H 93nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pufOCh9L; 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 u23si5553995edo.41.2020.10.18.03.24.13; Sun, 18 Oct 2020 03:24:36 -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=@kernel.org header.s=default header.b=pufOCh9L; 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 S1726280AbgJRKHi (ORCPT + 99 others); Sun, 18 Oct 2020 06:07:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:40088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725320AbgJRKHi (ORCPT ); Sun, 18 Oct 2020 06:07:38 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 0993621582; Sun, 18 Oct 2020 10:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603015658; bh=wIiA9KBDcc136KGq4f/BMgcBH20BwV1jX2a9QCEH+uw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pufOCh9Lhfwp+boIkjf7lnup05nEyglSaMVcpi5nrWVcWPlxyt06Z25c4wqDjPtSw WtwAA6D2IC66P5MMXjRxtebomvVCyPopbAFurz76ZrsTJRy3UGj5EbdX1tMxeW6jlt 3jI75MAxOjA0D9BBP0MsArqiEtXRYK/yDIlNUY+4= Date: Sun, 18 Oct 2020 11:07:38 +0100 From: Jonathan Cameron To: Matthias Brugger Cc: Fabien Parent , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, chun-hung.wu@mediatek.com, alexandru.ardelean@analog.com, pmeerw@pmeerw.net, lars@metafoo.de, knaack.h@gmx.de Subject: Re: [PATCH] iio: adc: mediatek: fix unset field Message-ID: <20201018110738.36e3de38@archlinux> In-Reply-To: <61fe6278-a628-820c-6bbd-eeac51b1e7c3@gmail.com> References: <20201012194618.2170970-1-fparent@baylibre.com> <61fe6278-a628-820c-6bbd-eeac51b1e7c3@gmail.com> X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; 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 Tue, 13 Oct 2020 17:37:12 +0200 Matthias Brugger wrote: > On 12/10/2020 21:46, Fabien Parent wrote: > > dev_comp field is used in a couple of places but it is never set. This > > results in kernel oops when dereferencing a NULL pointer. Set the > > `dev_comp` field correctly in the probe function. > > > > Fixes: 6d97024dce23 ("iio: adc: mediatek: mt6577-auxadc, add mt6765 support") > > > > Signed-off-by: Fabien Parent > > Ouch. > > Reviewed-by: Matthias Brugger > > > --- > > 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 ac415cb089cd..7bd48377cd79 100644 > > --- a/drivers/iio/adc/mt6577_auxadc.c > > +++ b/drivers/iio/adc/mt6577_auxadc.c > > @@ -276,6 +276,8 @@ static int mt6577_auxadc_probe(struct platform_device *pdev) > > goto err_disable_clk; > > } > > > > + adc_dev->dev_comp = of_device_get_match_data(&pdev->dev); > > + Could we switch this to device_get_match_data(&pdev->dev)? Whilst is unlikely this driver will used in a platform using ACPI, there is nothing inside the driver itself preventing this (which is good as no reason to do so!) My main motivation for this is to reduce the chances of cut and paste of the of_* functions in future driver. Also switch the headers to linux/property.h and linux/mod_devicetable.h to more tightly reflect what we are using in the driver. Thanks, Jonathan > > mutex_init(&adc_dev->lock); > > > > mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC, > >