mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
macintosh: Use common error handling code in via_pmu_led_init()
Add a jump target so that a bit of exception handling can be better reused at the end of this function implementation. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://patch.msgid.link/189b93e2-4e81-438d-9c77-cbe4d9d7a0d9@web.de
This commit is contained in:
parent
2e716f5cde
commit
352268dc6d
@ -92,18 +92,15 @@ static int __init via_pmu_led_init(void)
|
||||
if (dt == NULL)
|
||||
return -ENODEV;
|
||||
model = of_get_property(dt, "model", NULL);
|
||||
if (model == NULL) {
|
||||
of_node_put(dt);
|
||||
return -ENODEV;
|
||||
}
|
||||
if (!model)
|
||||
goto put_node;
|
||||
|
||||
if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 &&
|
||||
strncmp(model, "iBook", strlen("iBook")) != 0 &&
|
||||
strcmp(model, "PowerMac7,2") != 0 &&
|
||||
strcmp(model, "PowerMac7,3") != 0) {
|
||||
of_node_put(dt);
|
||||
/* ignore */
|
||||
return -ENODEV;
|
||||
}
|
||||
strcmp(model, "PowerMac7,3") != 0)
|
||||
goto put_node;
|
||||
|
||||
of_node_put(dt);
|
||||
|
||||
spin_lock_init(&pmu_blink_lock);
|
||||
@ -112,6 +109,10 @@ static int __init via_pmu_led_init(void)
|
||||
pmu_blink_req.done = pmu_req_done;
|
||||
|
||||
return led_classdev_register(NULL, &pmu_led);
|
||||
|
||||
put_node:
|
||||
of_node_put(dt);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
late_initcall(via_pmu_led_init);
|
||||
|
Loading…
Reference in New Issue
Block a user