Message ID | 1432652516-15085-4-git-send-email-laurent.pinchart+renesas@ideasonboard.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Geert Uytterhoeven |
Headers | show |
On Tue, May 26, 2015 at 5:01 PM, Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> wrote: > --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c > +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c > @@ -640,14 +640,14 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, > of_node_put(connector); > > if (!ret) > - return 1; > + return 0; > > if (ret != -EPROBE_DEFER) > dev_warn(rcdu->dev, > "failed to initialize encoder %s (%d), skipping\n", > encoder->full_name, ret); > > - return 0; > + return ret; > } Perhaps just if (ret && ret != -EPROBE_DEFER) dev_warn(...); return ret; ? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Geert, On Tuesday 26 May 2015 21:24:03 Geert Uytterhoeven wrote: > On Tue, May 26, 2015 at 5:01 PM, Laurent Pinchart wrote: > > --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c > > @@ -640,14 +640,14 @@ static int rcar_du_encoders_init_one(struct > > rcar_du_device *rcdu, > > of_node_put(connector); > > > > if (!ret) > > - return 1; > > + return 0; > > > > if (ret != -EPROBE_DEFER) > > dev_warn(rcdu->dev, > > "failed to initialize encoder %s (%d), > > skipping\n", > > encoder->full_name, ret); > > > > - return 0; > > + return ret; > > } > > Perhaps just > > if (ret && ret != -EPROBE_DEFER) > dev_warn(...); > > return ret; > > ? Good point. I'll fix that.
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index bca859ad204c..acbf3087a7f2 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -573,7 +573,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, if (!entity) { dev_dbg(rcdu->dev, "unconnected endpoint %s, skipping\n", ep->local_node->full_name); - return 0; + return -ENODEV; } entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0); @@ -596,7 +596,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, encoder->full_name); of_node_put(entity_ep_node); of_node_put(encoder); - return 0; + return -ENODEV; } break; @@ -625,7 +625,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, encoder->full_name); of_node_put(encoder); of_node_put(connector); - return 0; + return -EINVAL; } } else { /* @@ -640,14 +640,14 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, of_node_put(connector); if (!ret) - return 1; + return 0; if (ret != -EPROBE_DEFER) dev_warn(rcdu->dev, "failed to initialize encoder %s (%d), skipping\n", encoder->full_name, ret); - return 0; + return ret; } static int rcar_du_encoders_init(struct rcar_du_device *rcdu) @@ -699,7 +699,7 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu) continue; } - num_encoders += ret; + num_encoders++; } return num_encoders;
The function returns 1 on success, and either 0 or a negative error code on failure. As the 0 and negative values don't need to be differentiated by the caller, convert it to the usual scheme of returning 0 on success and a negative error code on failure. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> --- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)