lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <061374da-fa6e-4074-9451-1b3722217188@collabora.com>
Date: Mon, 4 Aug 2025 16:33:20 +0200
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: Krzysztof Kozlowski <krzk@...nel.org>, Laura Nao
 <laura.nao@...labora.com>, mturquette@...libre.com, sboyd@...nel.org,
 robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
 matthias.bgg@...il.com, p.zabel@...gutronix.de, richardcochran@...il.com
Cc: guangjie.song@...iatek.com, wenst@...omium.org,
 linux-clk@...r.kernel.org, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-mediatek@...ts.infradead.org, netdev@...r.kernel.org,
 kernel@...labora.com, NĂ­colas F . R . A . Prado
 <nfraprado@...labora.com>
Subject: Re: [PATCH v3 05/27] clk: mediatek: clk-mux: Add ops for mux gates
 with HW voter and FENC

Il 04/08/25 16:05, Krzysztof Kozlowski ha scritto:
> On 30/07/2025 12:56, Laura Nao wrote:
>>   
>>   	clk_mux->regmap = regmap;
>> +	clk_mux->regmap_hwv = regmap_hwv;
>>   	clk_mux->data = mux;
>>   	clk_mux->lock = lock;
>>   	clk_mux->hw.init = &init;
>> @@ -268,6 +329,7 @@ int mtk_clk_register_muxes(struct device *dev,
>>   			   struct clk_hw_onecell_data *clk_data)
>>   {
>>   	struct regmap *regmap;
>> +	struct regmap *regmap_hwv;
>>   	struct clk_hw *hw;
>>   	int i;
>>   
>> @@ -277,6 +339,13 @@ int mtk_clk_register_muxes(struct device *dev,
>>   		return PTR_ERR(regmap);
>>   	}
>>   
>> +	regmap_hwv = mtk_clk_get_hwv_regmap(node);
>> +	if (IS_ERR(regmap_hwv)) {
> 
> This is either buggy or fragile. mtk_clk_get_hwv_regmap() returns NULL
> or valid pointer... or error? IS_ERR_OR_NULL is not the wait to go.
> 
> Choose one - IS_ERR or NULL, preferrably the first, since you must
> handle deferred probe.
> 

if regmap_hwv == NULL -> there is no HWV for *this* clock
if regmap_hwv == -ERROR -> there is a HWV for *this* clock, but something
                            went wrong, we have to return the error.

>> +		pr_err("Cannot find hardware voter regmap for %pOF: %pe\n",
>> +		       node, regmap_hwv);
>> +		return PTR_ERR(regmap_hwv);
>> +	}
>> +
>>   	for (i = 0; i < num; i++) {
>>   		const struct mtk_mux *mux = &muxes[i];
>>   
>> @@ -286,7 +355,7 @@ int mtk_clk_register_muxes(struct device *dev,
>>   			continue;
>>   		}
>>   
>> -		hw = mtk_clk_register_mux(dev, mux, regmap, lock);
>> +		hw = mtk_clk_register_mux(dev, mux, regmap, regmap_hwv, lock);
> 
> So NULL is passed and stored... are you sure this is 100% backwards
> compatible?
> 

Yes, it is. This got tested on multiple legacy SoCs in our lab.

> 
> 
> Best regards,
> Krzysztof



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ