From patchwork Mon Oct 12 19:46:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Parent X-Patchwork-Id: 11833661 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AAE78139F for ; Mon, 12 Oct 2020 19:48:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67CA52074A for ; Mon, 12 Oct 2020 19:48:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XWb50YnW"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="xQrjEJD7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67CA52074A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=6WbC+oeFIYPCuXeT1TKk6UyJupvZk5MlAiurD/7nWG8=; b=XWb50YnWw4BKvIyoqTK1f8MWrr Ex27AO+hzdaTyvBDD7tFQLXS39JE8Bk7wpqlVRvSXkNdIRJ+pM+5a2KnCM3nUU4ChRXosM/pmBe3K 3m7cWjfYl8DwPJ4NfD+1NdCmy42hI1YvIYgtc0LsE2UcMh8cS/rGaKtwK4ndTKpqtNRtFHBfxv12w wsM9Kv5ZJVY0gG+e+ROvKlLwA6TBRBWftUzwoQgqnD913qTLdjOOjQ0RZb7q4/iJV2RJJm2nSS8Qk iN4QpNL2poWJjpQIniY7giNCekQQEXO3Nm6+z827JtSzjx8YMqFmWkjF5nIXEBfioG89HJVbhk7Nw 2k/CRhvQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kS3m9-00058A-35; Mon, 12 Oct 2020 19:46:29 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kS3m3-00057G-T4 for linux-arm-kernel@lists.infradead.org; Mon, 12 Oct 2020 19:46:26 +0000 Received: by mail-wm1-x341.google.com with SMTP id j136so18771273wmj.2 for ; Mon, 12 Oct 2020 12:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lJUgYY1wIsYehEysHd2Kh8lV4o685yjBc0pclwWahLQ=; b=xQrjEJD7DwGgvhsePMttKT1lbjtB/P+TL5KwJS6udeu8lwG2/PiJwn0HQIIk4EVLPw 3Aj2fF36QqZwby7SLpRW3F1hTOLziJPhbnv/qnWYYWWpy4e5RFkRdola0lwLjODrTxHi W/U3wFnc5gz/qqlA93pG1CIw0XxnJjjvhQfas5lMnWUh7HgNoZfok7DW+c+4IuQg5Q4N sRXW96q5CyL1vReb3Q9Db0lwCZigR2AeoOT6YDzCB6atz5quv7BCwvUqU0uCraF1hKhZ O6yHHgx/nol8/hUBpVhIeihEXKfu5LkfVHVZ9W98lAQ/vUiEtCu+AraE+VGhcAmkkzAB xY4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lJUgYY1wIsYehEysHd2Kh8lV4o685yjBc0pclwWahLQ=; b=ldmDpv6UZi3aHfFXQ6RKkPr9aIKKlvFUm/gvGosPUJEYwkbY8fOSR/leWWz6ND/5y2 +gc360lSBPq8Ifrj4cBKS3wBlra2nRtLYgwaG9Y16z+hL4IxeebTg8vVtY41FwdjQDPE e0l8dyhGFaanab1ji4dM4xUiAG6PzHFC4RGtcsLVKJ3pGPibs1XXIF7UCq5tysyJLwTu Vr/yYG1Ycsg/puY3mtCX8eyC/2jitTOd/C6qaRYMipbUi1oPUlcLBeJAp1XaQRQ9kRH0 dVaChvQVybvzfQ8Mrsq63j0h7YkcpFjSgUVtKl2buePEvPAiK5XA2rVHZdyNEdr8yCr1 r4qA== X-Gm-Message-State: AOAM530n0ibxg2T5oX2ce3OwxSzmcR11XlqqIjbLszz6zWk7WT/kT2am nBgxdHG4WKC9M04xEI5KiPxfWQ== X-Google-Smtp-Source: ABdhPJxE4rAMqZqFJQmBSrB789tdjZKukj9/n7g9ecDb/QcaExAQWtKUFEeX0l7QGMLG2PJ1ll5eMA== X-Received: by 2002:a1c:3d46:: with SMTP id k67mr293583wma.150.1602531982526; Mon, 12 Oct 2020 12:46:22 -0700 (PDT) Received: from localhost.localdomain (170.175.185.81.rev.sfr.net. [81.185.175.170]) by smtp.gmail.com with ESMTPSA id p13sm24590363wmb.5.2020.10.12.12.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 12:46:21 -0700 (PDT) From: Fabien Parent To: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org Subject: [PATCH] iio: adc: mediatek: fix unset field Date: Mon, 12 Oct 2020 21:46:18 +0200 Message-Id: <20201012194618.2170970-1-fparent@baylibre.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201012_154624_261956_483909AE X-CRM114-Status: GOOD ( 13.48 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lars@metafoo.de, chun-hung.wu@mediatek.com, Fabien Parent , pmeerw@pmeerw.net, knaack.h@gmx.de, matthias.bgg@gmail.com, alexandru.ardelean@analog.com, jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 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); + mutex_init(&adc_dev->lock); mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC,