Re: [PATCH v5 01/18] leds: remove unused function led_trigger_rename_static()

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

 



Hi Uwe,

The code using led_trigger_rename_static() is still present
in the kernel, and if someone will set CONFIG_BROKEN=y, they will
get a build break with this patch. Please remove it from
the series.

Best regards,
Jacek Anaszewski

On 06/29/2018 10:05 AM, Uwe Kleine-König wrote:
led_trigger_rename_static is broken as it doesn't check that the new name
isn't already in use. Also the function assumes that there is enough space
for the new name (which seems to be given for the code that made use of the
function) which makes it dangerous.

But instead of fixing that, just remove the function as all users are gone.

Acked-by: Pavel Machek <pavel@xxxxxx>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
  drivers/leds/led-triggers.c | 13 -------------
  include/linux/leds.h        | 18 ------------------
  2 files changed, 31 deletions(-)

diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 431123b048a2..327c87ff7646 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -175,19 +175,6 @@ void led_trigger_set_default(struct led_classdev *led_cdev)
  }
  EXPORT_SYMBOL_GPL(led_trigger_set_default);
-void led_trigger_rename_static(const char *name, struct led_trigger *trig)
-{
-	/* new name must be on a temporary string to prevent races */
-	BUG_ON(name == trig->name);
-
-	down_write(&triggers_list_lock);
-	/* this assumes that trig->name was originaly allocated to
-	 * non constant storage */
-	strcpy((char *)trig->name, name);
-	up_write(&triggers_list_lock);
-}
-EXPORT_SYMBOL_GPL(led_trigger_rename_static);
-
  /* LED Trigger Interface */
int led_trigger_register(struct led_trigger *trig)
diff --git a/include/linux/leds.h b/include/linux/leds.h
index b7e82550e655..c95eaf6acb23 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -297,24 +297,6 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
  	return led_cdev->trigger_data;
  }
-/**
- * led_trigger_rename_static - rename a trigger
- * @name: the new trigger name
- * @trig: the LED trigger to rename
- *
- * Change a LED trigger name by copying the string passed in
- * name into current trigger name, which MUST be large
- * enough for the new string.
- *
- * Note that name must NOT point to the same string used
- * during LED registration, as that could lead to races.
- *
- * This is meant to be used on triggers with statically
- * allocated name.
- */
-extern void led_trigger_rename_static(const char *name,
-				      struct led_trigger *trig);
-
  #else
/* Trigger has no members */




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

  Powered by Linux