aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2023-10-25 16:10:45 +0200
committerUwe Kleine-König <uwe@kleine-koenig.org>2023-10-26 07:32:19 +0200
commit2860dd0fb70d9bf1ca28f53648eec7378b522c80 (patch)
tree37aee568610e276a298d813b24776d85af78a128
parent4f64440b7163589741cdec7c11340670f9dbd9a1 (diff)
downloadlibpwm-2860dd0fb70d9bf1ca28f53648eec7378b522c80.tar.gz
Fix a few warnings when using -Wextra
I didn't check in detail, but I think they are all harmless.
-rw-r--r--pwm-internal.h2
-rw-r--r--sysfs.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/pwm-internal.h b/pwm-internal.h
index c63edd4..0489aaa 100644
--- a/pwm-internal.h
+++ b/pwm-internal.h
@@ -7,7 +7,7 @@
(type *)((void *)(ptr) - __builtin_offsetof(type, member)); })
struct pwm_chip {
- int npwm;
+ unsigned int npwm;
void (*close)(struct pwm_chip *chip);
struct pwm *(*get_pwm)(struct pwm_chip *chip, unsigned int offset);
int (*apply_state)(struct pwm *pwm, const struct pwm_state *state);
diff --git a/sysfs.c b/sysfs.c
index 4b543ed..ee7346c 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -36,7 +36,7 @@ struct pwm_chip_sysfs {
static void pwm_chip_sysfs_close(struct pwm_chip *chip)
{
- int i;
+ unsigned int i;
struct pwm_chip_sysfs *chip_sysfs = container_of(chip, struct pwm_chip_sysfs, chip);
for (i = 0; i < chip->npwm; ++i) {
@@ -236,6 +236,7 @@ static int pwm_chip_sysfs_apply_state(struct pwm *pwm,
static int pwm_chip_sysfs_get_state(struct pwm *pwm, struct pwm_state *state)
{
+ (void)pwm; (void)state;
errno = EIO;
return -1;
}
@@ -252,7 +253,7 @@ struct pwm_chip *pwm_chip_sysfs_open_by_number(unsigned int num)
ret = snprintf(buf, sizeof(buf), "/sys/class/pwm/pwmchip%d", num);
if (ret < 0)
return NULL;
- if (ret >= sizeof(buf)) {
+ if ((size_t)ret >= sizeof(buf)) {
/* huh */
errno = EINVAL;
return NULL;