Reviewed-by: Pierre Moreau <pierre.morrow@xxxxxxx> On 2021-05-11 — 16:28, Zhen Lei wrote: > Fix to return a negative error code from the error handling case instead > of 0, as done elsewhere in this function. > > Fixes: db1a0ae21461 ("drm/nouveau/bl: Assign different names to interfaces") > Suggested-by: Pierre Moreau <pierre.morrow@xxxxxxx> > Signed-off-by: Zhen Lei <thunder.leizhen@xxxxxxxxxx> > --- > drivers/gpu/drm/nouveau/nouveau_backlight.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c > index d1c998e645fb4b6..f0856adbe775624 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c > +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c > @@ -47,20 +47,20 @@ struct nouveau_backlight { > int id; > }; > > -static bool > +static int > nouveau_get_backlight_name(char backlight_name[BL_NAME_SIZE], > struct nouveau_backlight *bl) > { > int nb = ida_simple_get(&bl_ida, 0, 100, GFP_KERNEL); > > if (nb < 0) > - return false; > + return nb; > if (nb > 0) > snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb); > else > snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight"); > bl->id = nb; > - return true; > + return 0; > } > > static int > @@ -273,7 +273,8 @@ nouveau_backlight_init(struct drm_connector *connector) > if (!bl) > return -ENOMEM; > > - if (!nouveau_get_backlight_name(backlight_name, bl)) { > + ret = nouveau_get_backlight_name(backlight_name, bl); > + if (ret) { > NV_ERROR(drm, "Failed to retrieve a unique name for the backlight interface\n"); > goto fail_alloc; > } > -- > 2.26.0.106.g9fadedd > > > _______________________________________________ > Nouveau mailing list > Nouveau@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/nouveau