Re: [PATCH v12] thermal: drivers: mediatek: Add the Low Voltage Thermal Sensor driver

From: Matthias Brugger
Date: Wed Feb 01 2023 - 11:59:58 EST




On 01/02/2023 17:46, Balsam CHIHI wrote:
Hi Krzysztof,

Thank you very much for the review!

On Wed, Feb 1, 2023 at 8:55 AM Krzysztof Kozlowski
<krzysztof.kozlowski@xxxxxxxxxx> wrote:

On 31/01/2023 16:38, bchihi@xxxxxxxxxxxx wrote:
From: Balsam CHIHI <bchihi@xxxxxxxxxxxx>


[...]

+
+static irqreturn_t lvts_ctrl_irq_handler(struct lvts_ctrl *lvts_ctrl)
+{
+ irqreturn_t iret = IRQ_NONE;
+ u32 value, masks[] = {

Don't mix different types in one declaration. u32 and a pointer are
quite different types.

I'm not sure to understand.
LVTS_INT_SENSORx are not pointers but register values.


u32 mask[] is a pointer to a array of u32 values of undefined length.

[...]

+static int __init lvts_golden_temp_init(struct device *dev, u32 *value)

You did not test it, right? Build with section mismatch analysis...

I'm not sure to fully understand this comment.
Would you explain, please?


AFAIU:

lvts_golden_temp_init() and lvts_ctrl_init() are called from a function that is not in __init section:
lvts_domain_init()

So if you free up the first to functions after init but not the callers, things can explote.

[...]

+
+static int lvts_probe(struct platform_device *pdev)
+{
+ struct lvts_data *lvts_data;
+ struct lvts_domain *lvts_td;
+ struct device *dev = &pdev->dev;
+ struct resource *res;
+ int irq, ret;
+
+ lvts_td = devm_kzalloc(dev, sizeof(*lvts_td), GFP_KERNEL);
+ if (!lvts_td)
+ return -ENOMEM;
+
+ lvts_data = (struct lvts_data *)of_device_get_match_data(dev);

Why do you need case?

Would you explain, please?


Typo by Krysztof, he meant the cast.
lvts_data = of_device_get_match_data(dev);
should be good enough.

Regards,
Matthias