From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755684AbbBPQ2R (ORCPT ); Mon, 16 Feb 2015 11:28:17 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:37535 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755318AbbBPQ2N (ORCPT ); Mon, 16 Feb 2015 11:28:13 -0500 X-AuditID: cbfee61a-f79c06d000004e71-22-54e21a9a348e Date: Mon, 16 Feb 2015 17:28:02 +0100 From: Lukasz Majewski To: cw00.choi@samsung.com Cc: cwchoi00@gmail.com, Zhang Rui , Eduardo Valentin , Kukjin Kim , Bartlomiej Zolnierkiewicz , Kyungmin Park , Amit Kachhap , Abhilash Kesavan , "inki.dae@samsung.com" , "linux-pm@vger.kernel.org" , linux-arm-kernel , linux-samsung-soc , linux-kernel Subject: Re: [PATCH 1/3] thermal: exynos: Fix NULL pointer exception during kernel booting Message-id: <20150216172802.414525a9@amdc2363> In-reply-to: References: <1424096414-4327-1-git-send-email-cw00.choi@samsung.com> <1424096414-4327-2-git-send-email-cw00.choi@samsung.com> <20150216160633.29eac148@amdc2363> Organization: SPRC Poland X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeLIzCtJLcpLzFFi42I5/e+xoO4sqUchBjenGVo8XrOYyaLhaojF xhnrWS2uf3nOavHsqLbF/CvXWC0m3Z/AYtH/+DWzxdmmN+wWmx4DxS7vmsNm8bn3CKPFjPP7 mCyePOxjc+Dz2DnrLrvH4j0vmTw2repk89i8pN6jb8sqRo/Pm+QC2KK4bFJSczLLUov07RK4 MiY8a2YuuC5UceTOV8YGxhb+LkZODgkBE4m2rrdsELaYxIV764FsLg4hgemMEhPmvoRyfjFK NHSfAatiEVCVuP9pKTuIzSagJ/H57lOmLkYODhEBSYmWfWYg9cwCJ1gkJv88zAhSIywQI9HR 0ANm8wLVf/33BMzmFAiW+PL5LCvEgteMEucan7CAJPiBBrX/+8EMcZKdxLlPG9ghmgUlfky+ B1bDLKAlsXlbEyuELS+xec1b5gmMgrOQlM1CUjYLSdkCRuZVjKKpBckFxUnpuYZ6xYm5xaV5 6XrJ+bmbGMGx9ExqB+PKBotDjAIcjEo8vC9kH4YIsSaWFVfmHmKU4GBWEuFd9h4oxJuSWFmV WpQfX1Sak1p8iFGag0VJnFfJvi1ESCA9sSQ1OzW1ILUIJsvEwSnVwLg5oHHndW3p35Es/Mr9 R3pWN9yYvWhKH/e0nlbroK/neNZduHKAdfHtZPZN3u3bq/p+HVddUGl/oX9O0ZGUnOwDK/Pu e3Pod/J/2PV2YXmF27yY4zesp56R1N8/Zf2EiW3qQuWzGOP3rfxs9O9Fyet29flpp2ID3y8r 8shanlklzSA6+cx/02VKLMUZiYZazEXFiQDZO511oQIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chanwoo, > Hi Lukasz, > > On Tue, Feb 17, 2015 at 12:06 AM, Lukasz Majewski > wrote: > > Hi Chanwoo, > > > >> This patch fixes the NULL pointer exception during kernel booting. > >> The thermal_zone _of_sensor_register() registers a sensor to DT > >> thermal zone and then read the current temperature by '.get_temp' > >> callback. The callback function of exynos thermal driver is > >> exynos_get_temp() which must need the 'pdata' instance of > >> exynos_tmu _platform_data structure. > >> - exynos_get_temp() -> code_to_temp() -> Must need the 'pdata' > >> instance > >> > >> But, exynos thermal driver is executed before getting the 'pdata' > >> instance. To avoid the kernel panic, have to get the platform data > >> by executing the exynos_map_dt_data() before calling > >> thermal_zone_of_sensor_register() . > > > > I've already prepared patch for this (unfortunately it isn't yet > > applied to mainline): > > > > "[PATCH] thermal: exynos: fix: Check if data->tmu_read callback is > > present before read" > > > > http://www.spinics.net/lists/linux-samsung-soc/msg42245.html > > There is different issue between you patch and this patch. > Your patch check the whether data->tmu_read is NULL or not. > But, my patch check the pdata is NULL or not. I've tried to do the same previously. Please compare with: [PATCH 1/2] thermal: exynos: Reorder exynos_map_dt_data() function http://www.spinics.net/lists/linux-samsung-soc/msg41308.html Unfortunately, Abhilash found some issues with this code, so I've looked into different solution. However, I didn't need to move pdata = data->pdata; Hence, I wonder why it need to be reordered. Are you using Exynos3250 based device? > > > > > Does applying this patch help? > > > > BTW: How can I reproduce this error? Could you point me the SHA1 and > > repository? > > I used your patch-set of linux-soc-thermal.git (branch: next). So I > applied you patchiest on Linux 3.19 for test. > - > https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux-soc-thermal.git/log/?h=next Is there any special .config? May I ask about the target platform? I will look closely on this problem tomorrow. > > Best Regards, > Chanwoo Choi -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group From mboxrd@z Thu Jan 1 00:00:00 1970 From: l.majewski@samsung.com (Lukasz Majewski) Date: Mon, 16 Feb 2015 17:28:02 +0100 Subject: [PATCH 1/3] thermal: exynos: Fix NULL pointer exception during kernel booting In-Reply-To: References: <1424096414-4327-1-git-send-email-cw00.choi@samsung.com> <1424096414-4327-2-git-send-email-cw00.choi@samsung.com> <20150216160633.29eac148@amdc2363> Message-ID: <20150216172802.414525a9@amdc2363> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Chanwoo, > Hi Lukasz, > > On Tue, Feb 17, 2015 at 12:06 AM, Lukasz Majewski > wrote: > > Hi Chanwoo, > > > >> This patch fixes the NULL pointer exception during kernel booting. > >> The thermal_zone _of_sensor_register() registers a sensor to DT > >> thermal zone and then read the current temperature by '.get_temp' > >> callback. The callback function of exynos thermal driver is > >> exynos_get_temp() which must need the 'pdata' instance of > >> exynos_tmu _platform_data structure. > >> - exynos_get_temp() -> code_to_temp() -> Must need the 'pdata' > >> instance > >> > >> But, exynos thermal driver is executed before getting the 'pdata' > >> instance. To avoid the kernel panic, have to get the platform data > >> by executing the exynos_map_dt_data() before calling > >> thermal_zone_of_sensor_register() . > > > > I've already prepared patch for this (unfortunately it isn't yet > > applied to mainline): > > > > "[PATCH] thermal: exynos: fix: Check if data->tmu_read callback is > > present before read" > > > > http://www.spinics.net/lists/linux-samsung-soc/msg42245.html > > There is different issue between you patch and this patch. > Your patch check the whether data->tmu_read is NULL or not. > But, my patch check the pdata is NULL or not. I've tried to do the same previously. Please compare with: [PATCH 1/2] thermal: exynos: Reorder exynos_map_dt_data() function http://www.spinics.net/lists/linux-samsung-soc/msg41308.html Unfortunately, Abhilash found some issues with this code, so I've looked into different solution. However, I didn't need to move pdata = data->pdata; Hence, I wonder why it need to be reordered. Are you using Exynos3250 based device? > > > > > Does applying this patch help? > > > > BTW: How can I reproduce this error? Could you point me the SHA1 and > > repository? > > I used your patch-set of linux-soc-thermal.git (branch: next). So I > applied you patchiest on Linux 3.19 for test. > - > https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux-soc-thermal.git/log/?h=next Is there any special .config? May I ask about the target platform? I will look closely on this problem tomorrow. > > Best Regards, > Chanwoo Choi -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group