Re: [PATCH v3 5/7] irqchip/loongson-liointc: irqchip add 2.0 version

From: zhangqing
Date: Tue Mar 09 2021 - 21:27:13 EST



On 03/09/2021 05:10 PM, Marc Zyngier wrote:

+
+static void __iomem *liointc_get_reg_byname(struct device_node *node,
+ const char *name)
+{
+ int index = of_property_match_string(node, "reg-names", name);
+
+ return of_iomap(node, index);
So if of_property_match_string() returns an error, you feed that error
to of_iomap()? Somehow, I don't think that's a good idea.

Hi, Marc

Thank you for your suggestion, error handling is missing here,

+ if (index <0)
+ return NULL;

return of_iomap(node, index);

It has been fixed in the fourth version, and I will send V4 soon.

+ if (of_device_is_compatible(node, "loongson,liointc-2.0")) {
+ base = liointc_get_reg_byname(node, "main");
+ if (!base) {
+ err = -ENODEV;
+ goto out_free_priv;
+ }
+ for (i = 0; i < LIOINTC_NUM_CORES; i++) {
+ priv->core_isr[i] =
+ liointc_get_reg_byname(node, core_reg_names[i]);
Please write assignments on a single line.

In addition, write assignments on a single line

for (i = 0; i <LIOINTC_NUM_CORES; i++)
priv->core_isr[i] = liointc_get_reg_byname(node, core_reg_names[i]);

It is 92 characters, more than 80 characters...


Thanks

-Qing


Thanks,

M.