From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755887AbbBPPGt (ORCPT ); Mon, 16 Feb 2015 10:06:49 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:33261 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753175AbbBPPGq (ORCPT ); Mon, 16 Feb 2015 10:06:46 -0500 X-AuditID: cbfee61b-f79d76d0000024d6-c7-54e207836ce6 Date: Mon, 16 Feb 2015 16:06:33 +0100 From: Lukasz Majewski To: Chanwoo Choi Cc: rui.zhang@intel.com, edubezval@gmail.com, kgene@kernel.org, b.zolnierkie@samsung.com, kyungmin.park@samsung.com, amit.daniel@samsung.com, a.kesavan@samsung.com, inki.dae@samsung.com, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] thermal: exynos: Fix NULL pointer exception during kernel booting Message-id: <20150216160633.29eac148@amdc2363> In-reply-to: <1424096414-4327-2-git-send-email-cw00.choi@samsung.com> References: <1424096414-4327-1-git-send-email-cw00.choi@samsung.com> <1424096414-4327-2-git-send-email-cw00.choi@samsung.com> 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+NgFupikeLIzCtJLcpLzFFi42I5/e+xoG4z+6MQg+0fVSwer1nMZNFwNcRi 44z1rBbXvzxntZh/5RqrxaT7E1gs+h+/ZrY42/SG3WLTY6DY5V1z2Cw+9x5htJhxfh+TxZOH fWwOvB47Z91l91i85yWTx6ZVnWwem5fUe/RtWcXo8XmTXABbFJdNSmpOZllqkb5dAlfGxmeP GAsuyVb07L7A1sDYKdnFyMkhIWAisX7qPkYIW0ziwr31bF2MXBxCAtMZJaY27GOGcH4xSmza s5AZpIpFQFVi0rmvYDabgJ7E57tPmUBsEQENiZl/rzCCNDALHGKS6F54BiwhLBAj0dHQA7aC F6hhyrqLYM2cAq4STXcWs4LYQgL1Ei+OrwaL8wtISrT/+8EMcZKdxLlPG9ghegUlfky+xwJi MwtoSWze1sQKYctLbF7zlnkCo+AsJGWzkJTNQlK2gJF5FaNoakFyQXFSeq6RXnFibnFpXrpe cn7uJkZwDD2T3sG4qsHiEKMAB6MSD+8HlYchQqyJZcWVuYcYJTiYlUR4l70HCvGmJFZWpRbl xxeV5qQWH2KU5mBREudVsm8LERJITyxJzU5NLUgtgskycXBKNTCyC/72LePbHvxSco6lX+2p TMlTci7Mi34pVG9TPiPHfSbR4O1ixpXmcW8LP8ZPZhK79Xxmyp440dRbt94KHcte1vF4+dKl Bb65e2zcImq9Mz8E9jPJ/brArmzx5bnWo6p7e+127ivVNejXtl/XukzTUmYny+ao4tqP9x8o yGc0VIUY3XSUvKPEUpyRaKjFXFScCABeV6W4nQIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Does applying this patch help? BTW: How can I reproduce this error? Could you point me the SHA1 and repository? > > - kernel panic log > [ 4211.324346] PC is at 0x0 > [ 4211.326867] LR is at exynos_get_temp+0x3c/0xe4 > [ 4211.331289] pc : [<0000000000000000>] lr : [] > [snip] > [ 4211.940625] [< (null)>] (null) > [ 4211.945315] [] of_thermal_get_temp+0x1c/0x30 > [ 4211.951132] [] thermal_zone_get_temp+0x48/0x7c > [ 4211.957118] [] > thermal_zone_device_update+0x20/0x110 [ 4211.963627] > [] of_thermal_set_mode+0x44/0x68 [ 4211.969443] > [] thermal_zone_of_sensor_register+0x15c/0x1d8 > [ 4211.976475] [] exynos_tmu_probe+0x6c/0x814 > [ 4211.982120] [] platform_drv_probe+0x48/0xb8 > [ 4211.987846] [] driver_probe_device+0x8c/0x244 > [ 4211.993747] [] __driver_attach+0x98/0xa0 > [ 4211.999216] [] bus_for_each_dev+0x54/0x98 > [ 4212.004771] [] driver_attach+0x1c/0x28 > [ 4212.010066] [] bus_add_driver+0x150/0x208 > [ 4212.015622] [] driver_register+0x5c/0x11c > [ 4212.021178] [] > __platform_driver_register+0x5c/0x68 [ 4212.027600] > [] exynos_tmu_driver_init+0x14/0x20 [ 4212.033678] > [] do_one_initcall+0x88/0x1a0 [ 4212.039235] > [] kernel_init_freeable+0x1bc/0x260 [ 4212.045311] > [] kernel_init+0xc/0xd8 > > Cc: Zhang Rui > Cc: Eduardo Valentin > Signed-off-by: Chanwoo Choi > --- > drivers/thermal/samsung/exynos_tmu.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/thermal/samsung/exynos_tmu.c > b/drivers/thermal/samsung/exynos_tmu.c index fbeedc0..b8846f1 100644 > --- a/drivers/thermal/samsung/exynos_tmu.c > +++ b/drivers/thermal/samsung/exynos_tmu.c > @@ -1147,17 +1147,17 @@ static int exynos_tmu_probe(struct > platform_device *pdev) platform_set_drvdata(pdev, data); > mutex_init(&data->lock); > > + ret = exynos_map_dt_data(pdev); > + if (ret) > + return ret; > + pdata = data->pdata; > + > data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, > data, &exynos_sensor_ops); > if (IS_ERR(data->tzd)) { > pr_err("thermal: tz: %p ERROR\n", data->tzd); > return PTR_ERR(data->tzd); > } > - ret = exynos_map_dt_data(pdev); > - if (ret) > - goto err_sensor; > - > - pdata = data->pdata; > > INIT_WORK(&data->irq_work, exynos_tmu_work); > -- 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 16:06:33 +0100 Subject: [PATCH 1/3] thermal: exynos: Fix NULL pointer exception during kernel booting In-Reply-To: <1424096414-4327-2-git-send-email-cw00.choi@samsung.com> References: <1424096414-4327-1-git-send-email-cw00.choi@samsung.com> <1424096414-4327-2-git-send-email-cw00.choi@samsung.com> Message-ID: <20150216160633.29eac148@amdc2363> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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 Does applying this patch help? BTW: How can I reproduce this error? Could you point me the SHA1 and repository? > > - kernel panic log > [ 4211.324346] PC is at 0x0 > [ 4211.326867] LR is at exynos_get_temp+0x3c/0xe4 > [ 4211.331289] pc : [<0000000000000000>] lr : [] > [snip] > [ 4211.940625] [< (null)>] (null) > [ 4211.945315] [] of_thermal_get_temp+0x1c/0x30 > [ 4211.951132] [] thermal_zone_get_temp+0x48/0x7c > [ 4211.957118] [] > thermal_zone_device_update+0x20/0x110 [ 4211.963627] > [] of_thermal_set_mode+0x44/0x68 [ 4211.969443] > [] thermal_zone_of_sensor_register+0x15c/0x1d8 > [ 4211.976475] [] exynos_tmu_probe+0x6c/0x814 > [ 4211.982120] [] platform_drv_probe+0x48/0xb8 > [ 4211.987846] [] driver_probe_device+0x8c/0x244 > [ 4211.993747] [] __driver_attach+0x98/0xa0 > [ 4211.999216] [] bus_for_each_dev+0x54/0x98 > [ 4212.004771] [] driver_attach+0x1c/0x28 > [ 4212.010066] [] bus_add_driver+0x150/0x208 > [ 4212.015622] [] driver_register+0x5c/0x11c > [ 4212.021178] [] > __platform_driver_register+0x5c/0x68 [ 4212.027600] > [] exynos_tmu_driver_init+0x14/0x20 [ 4212.033678] > [] do_one_initcall+0x88/0x1a0 [ 4212.039235] > [] kernel_init_freeable+0x1bc/0x260 [ 4212.045311] > [] kernel_init+0xc/0xd8 > > Cc: Zhang Rui > Cc: Eduardo Valentin > Signed-off-by: Chanwoo Choi > --- > drivers/thermal/samsung/exynos_tmu.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/thermal/samsung/exynos_tmu.c > b/drivers/thermal/samsung/exynos_tmu.c index fbeedc0..b8846f1 100644 > --- a/drivers/thermal/samsung/exynos_tmu.c > +++ b/drivers/thermal/samsung/exynos_tmu.c > @@ -1147,17 +1147,17 @@ static int exynos_tmu_probe(struct > platform_device *pdev) platform_set_drvdata(pdev, data); > mutex_init(&data->lock); > > + ret = exynos_map_dt_data(pdev); > + if (ret) > + return ret; > + pdata = data->pdata; > + > data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, > data, &exynos_sensor_ops); > if (IS_ERR(data->tzd)) { > pr_err("thermal: tz: %p ERROR\n", data->tzd); > return PTR_ERR(data->tzd); > } > - ret = exynos_map_dt_data(pdev); > - if (ret) > - goto err_sensor; > - > - pdata = data->pdata; > > INIT_WORK(&data->irq_work, exynos_tmu_work); > -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group