[PATCH 05/25] drivers/i2c: Use static const char arrays

Joe Perches joe at perches.com
Mon Sep 13 15:47:43 EDT 2010


Signed-off-by: Joe Perches <joe at perches.com>
---
 drivers/i2c/busses/i2c-stu300.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 495be45..2f7c09c 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -871,7 +871,7 @@ stu300_probe(struct platform_device *pdev)
 	struct resource *res;
 	int bus_nr;
 	int ret = 0;
-	char clk_name[] = "I2C0";
+	char clk_name[sizeof("I2Cx")];
 
 	dev = kzalloc(sizeof(struct stu300_dev), GFP_KERNEL);
 	if (!dev) {
@@ -881,7 +881,7 @@ stu300_probe(struct platform_device *pdev)
 	}
 
 	bus_nr = pdev->id;
-	clk_name[3] += (char)bus_nr;
+	sprintf(clk_name, "I2C%c", '0' + bus_nr);
 	dev->clk = clk_get(&pdev->dev, clk_name);
 	if (IS_ERR(dev->clk)) {
 		ret = PTR_ERR(dev->clk);
-- 
1.7.3.rc1




More information about the linux-arm-kernel mailing list