Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 129
    • Issues 129
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 23
    • Merge requests 23
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Librem5
  • linux
  • Issues
  • #410

Closed
Open
Created Mar 30, 2022 by Guido Gunther@guido.guntherOwner

s5k3l6xx: Don't use magic values

The driver probing does:

test = s5k3l6xx_read(state, S5K3L6XX_REG_MODEL_ID_H);
        if (test.retcode < 0) {
                ret = test.retcode;
                goto err_power;
        } else if (test.value != S5K3L6XX_MODEL_ID_H) {
                dev_err(&c->dev, "model mismatch: 0x%X != 0xC6\n", test.value);
                ret = -EINVAL;
                goto err_power;
        } else
                dev_info(&c->dev, "model high: 0x%X\n", test.value);

So it defines a constant S5K3L6XX_REG_MODEL_ID_H (good) but then doesn't use it the dev_err:

                dev_err(&c->dev, "model mismatch: 0x%X != 0xC6\n", test.value);

why not:

               dev_err(&c->dev, "model mismatch: 0x%X != 0x%X\n", test.value, S5K3L6XX_MODEL_ID_H);

so one doesn't have to check if there's a mismatch between the define and the printf?

Same for S5K3L6XX_REG_MODEL_ID_L and S5K3L6XX_REG_REVISION_NUMBER.

/cc @dorota.czaplejewicz as driver author

Edited Mar 30, 2022 by Guido Gunther
Assignee
Assign to
Time tracking