Re: [PATCH v3 23/44] drm/nouveau/disp: add output backlight control methods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]<

 



On Tue, 2023-09-19 at 17:56 -0400, Lyude Paul wrote:
> +static int
> +gt215_sor_bl_set(struct nvkm_ior *ior, int lvl)
> +{
> +       struct nvkm_device *device = ior->disp->engine.subdev.device;
> +       const u32 soff = nv50_ior_base(ior);
> +       u32 div, val;
> +
> +       div = nvkm_rd32(device, 0x61c080 + soff);
> +       val = (lvl * div) / 100;

Integer promotion rules always throw me for a loop, but since 'lvl' is a
signed integer, and div is a u32, are we sure this won't overflow?  Maybe
lvl should be unsigned and val should be a u64?


> +       if (div)
> +               nvkm_wr32(device, 0x61c084 + soff, 0xc0000000 | val);

Also, maybe calculate 'val' in this if-block?





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux