Search Linux Wireless

Re: [PATCH 02/43] iwlwifi: mvm: add registration to thermal zone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Emmanuel Grumbach <emmanuel.grumbach@xxxxxxxxx> writes:

> From: Chaya Rachel Ivgi <chaya.rachel.ivgi@xxxxxxxxx>
>
> Register to thermal_zone interface and implement the
> thermal ops.

And there it was :)


> +static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm)
> +{
> +	int i;
> +	char name[] = "iwlwifi";
> +
> +	if (!iwl_mvm_is_tt_in_fw(mvm)) {
> +		mvm->tz_device.tzone = NULL;
> +
> +		return;
> +	}
> +
> +	BUILD_BUG_ON(ARRAY_SIZE(name) >= THERMAL_NAME_LENGTH);
> +
> +	mvm->tz_device.tzone = thermal_zone_device_register(name,


Why not simply 
        mvm->tz_device.tzone = thermal_zone_device_register(DRV_NAME,
?




> +							IWL_MAX_DTS_TRIPS,
> +							IWL_WRITABLE_TRIPS_MSK,
> +							mvm, &tzone_ops,
> +							NULL, 0, 0);
> +	if (IS_ERR(mvm->tz_device.tzone)) {
> +		IWL_DEBUG_TEMP(mvm,
> +			       "Failed to register to thermal zone (err = %ld)\n",
> +			       PTR_ERR(mvm->tz_device.tzone));
> +		return;
> +	}

So you return with an ERR_PTR in mvm->tz_device.tzone?


> +static void iwl_mvm_thermal_zone_unregister(struct iwl_mvm *mvm)
> +{
> +	if (!iwl_mvm_is_tt_in_fw(mvm))
> +		return;
> +
> +	if (mvm->tz_device.tzone) {
> +		IWL_DEBUG_TEMP(mvm, "Thermal zone device unregister\n");
> +		thermal_zone_device_unregister(mvm->tz_device.tzone);

Won't that ERR_PTR blow up when dereferenced by
thermal_zone_device_unregister() ?



Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux