Messages in this thread | | | Date | Wed, 9 Dec 2015 09:53:07 +0100 | From | Sascha Hauer <> | Subject | Re: [RFC][PATCH] misc: Introduce reboot_reason driver |
| |
Hi John,
Only a small comment
On Tue, Dec 08, 2015 at 01:29:22PM -0800, John Stultz wrote: > +static int reboot_reason_probe(struct platform_device *pdev) > +{ > + struct resource *res; > + u32 val; > + int i; > + > + /* initialize the reasons */ > + for (i = 0; i < MAX_REASONS; i++) > + reasons[i] = -1; > + > + /* Try to grab the reason io address */ > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + reboot_reason_addr = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(reboot_reason_addr)) > + return PTR_ERR(reboot_reason_addr); > + > + /* initialize specified reasons from DT */ > + if (!of_property_read_u32(pdev->dev.of_node, "reason,none", &val)) > + reasons[NONE] = val;
can be simplified to:
of_property_read_u32(pdev->dev.of_node, "reason,none", &reasons[NONE]);
No need to check first, &reasons[NONE] will only be modified when the property exists.
Sascha
-- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
| |