From patchwork Thu Oct 31 11:54:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?U2h1bWluZyBb6IyD5pu46YqYXQ==?= X-Patchwork-Id: 11221097 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 2D12615AB for ; Thu, 31 Oct 2019 12:10:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 9F88F21925 for ; Thu, 31 Oct 2019 12:10:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="UHRz4woT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F88F21925 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D251220A4; Thu, 31 Oct 2019 13:09:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D251220A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572523802; bh=RkswG6uL0Qqpp5UXidwXoQ7oDSmsjgxQ4EMoK/0qGeE=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=UHRz4woToVtWsWpr6vg92TRgX/K1w9guruSpSvH3MdNsZka0lJC1i5TO9xT0GDFq9 Nt8e5geuQhEK5LmWzMDZnejfqwFr8sVkq/v4mAKQgVrvhZ7yNMkg6a25+yHmTCuIwx Oty8cEg0Iw6naGy6tBFGjCaONeJN5AXQIi/DYNXM= Received: from vmi242170.contaboserver.net (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 32FEAF80633; Thu, 31 Oct 2019 13:07:23 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8126EF802A0; Thu, 31 Oct 2019 13:04:48 +0100 (CET) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6BC2EF803D7 for ; Thu, 31 Oct 2019 12:54:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6BC2EF803D7 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x9VBsf16002000, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTITCAS11.realtek.com.tw[172.21.6.12]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x9VBsf16002000 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Oct 2019 19:54:41 +0800 Received: from localhost.localdomain (172.22.102.1) by RTITCAS11.realtek.com.tw (172.21.6.12) with Microsoft SMTP Server id 14.3.468.0; Thu, 31 Oct 2019 19:54:40 +0800 From: To: , Date: Thu, 31 Oct 2019 19:54:36 +0800 Message-ID: <20191031115436.21055-1-shumingf@realtek.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Originating-IP: [172.22.102.1] Cc: oder_chiou@realtek.com, jack.yu@realtek.com, alsa-devel@alsa-project.org, lars@metafoo.de, tzungbi@google.com, derek.fang@realtek.com, Shuming Fan , flove@realtek.com Subject: [alsa-devel] [PATCH 4/5] ASoC: rt1011: add the range check for temperature_calib from device property X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Shuming Fan The driver will check the range for temperature_calib. It should be from 1 to 255. Signed-off-by: Shuming Fan --- sound/soc/codecs/rt1011.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt1011.c b/sound/soc/codecs/rt1011.c index 2f1de933f3ac..f2c581b66d32 100644 --- a/sound/soc/codecs/rt1011.c +++ b/sound/soc/codecs/rt1011.c @@ -2341,7 +2341,8 @@ static void rt1011_calibration_work(struct work_struct *work) rt1011_reg_init(component); /* Apply temperature and calibration data from device property */ - if (rt1011->temperature_calib) { + if (rt1011->temperature_calib <= 0xff && + rt1011->temperature_calib > 0) { snd_soc_component_update_bits(component, RT1011_STP_INITIAL_RESISTANCE_TEMP, 0x3ff, (rt1011->temperature_calib << 2));