Skip to content

Commit

Permalink
Fixed null reference in rpi_tf_mod_led kernel module
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreinert committed Aug 19, 2019
1 parent fa2b404 commit 02addb6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion create_modules_dkms.sh
@@ -1,5 +1,5 @@
#!/bin/bash
PKG_BUILD=33
PKG_BUILD=34

PKG_VERSION=1.0.$PKG_BUILD

Expand Down
11 changes: 7 additions & 4 deletions kernel/rpi_rf_mod_led.c
Expand Up @@ -31,9 +31,9 @@ static int red_gpio_pin = 0;
static int green_gpio_pin = 0;
static int blue_gpio_pin = 0;

static struct rpi_rf_mod_led_led *red;
static struct rpi_rf_mod_led_led *green;
static struct rpi_rf_mod_led_led *blue;
static struct rpi_rf_mod_led_led *red = 0;
static struct rpi_rf_mod_led_led *green = 0;
static struct rpi_rf_mod_led_led *blue = 0;

struct rpi_rf_mod_led_led {
struct led_classdev cdev;
Expand Down Expand Up @@ -79,6 +79,9 @@ static struct rpi_rf_mod_led_led* rpi_rf_mod_led_createled(const char* name, boo

static void rpi_rf_mod_led_set_gpio_pin(struct rpi_rf_mod_led_led* led, int gpio)
{
if (led == 0)
return;

if (led->gpio != 0)
{
gpio_free(led->gpio);
Expand Down Expand Up @@ -208,7 +211,7 @@ MODULE_PARM_DESC(blue_gpio_pin, "GPIO Pin of blue LED");

MODULE_AUTHOR("Alexander Reinert <alex@areinert.de>");
MODULE_DESCRIPTION("GPIO LED driver for RPI-RF-MOD");
MODULE_VERSION("1.3");
MODULE_VERSION("1.4");
MODULE_LICENSE("GPL");
MODULE_ALIAS("rpi_rf_mod_led");

0 comments on commit 02addb6

Please sign in to comment.