On Tue, Jan 19, 2021 at 9:56 AM Shawn Guo <shawn.guo@xxxxxxxxxx> wrote: > > > @@ -303,18 +305,33 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) > > > > > > index = args.args[0]; > > > > > > - base = devm_platform_ioremap_resource(pdev, index); > > > - if (IS_ERR(base)) > > > - return PTR_ERR(base); > > > + data = kzalloc(sizeof(*data), GFP_KERNEL); > > > + if (!data) > > > + return -ENOMEM; > > > > > > > Nit: you could move this allocation after all resource reservation and > > mapping below, possibly to avoid doing it unless the base address and > > the memory resource is actually valid. Or you can keep it here and > > remove the use of the local variables, especially the "base" variable. > > It's a reasonable suggestion. I will send a new version to kill `base` > variable, but still want to keep `res` as it saves some two level > indirection. I'm changing my mind :) I will move kzalloc() to respect the original code. Shawn