Skip to contentSkip to conversation

lm3560: remove FSF address from the license

PATCH In review Andy Shevchenko 2 participants 4 messages Feb 12, 2014 – Mar 7, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 lm3560: remove FSF address from the license

There is no need to keep the FSF address inside each file. Moreover, it might change in future which will make this one obsolete.

There is no functional change.

---
 drivers/media/i2c/lm3560.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/media/i2c/lm3560.c +0 -6
index d98ca3a..fea37a3 100644
@@ -15,12 +15,6 @@
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
  */
 
 #include <linux/delay.h>
Signature · 1 line
1.9.0.rc3
#1 lore raw

PATCH 2/3 lm3560: keep style for the comments

Let's keep the style for all comments in the code, namely using small letters whenever it's possible.

There is no functional change.

---
 drivers/media/i2c/lm3560.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/media/i2c/lm3560.c +8 -5
index fea37a3..93e5227 100644
@@ -36,7 +36,7 @@
 #define REG_FLAG		0xd0
 #define REG_CONFIG1		0xe0
 
-/* Fault Mask */
+/* fault mask */
 #define FAULT_TIMEOUT	(1<<0)
 #define FAULT_OVERTEMP	(1<<1)
 #define FAULT_SHORT_CIRCUIT	(1<<2)
@@ -47,7 +47,8 @@ enum led_enable {
 	MODE_FLASH = 0x3,
 };
 
-/* struct lm3560_flash
+/**
+ * struct lm3560_flash
  *
  * @pdata: platform data
  * @regmap: reg. map for i2c
@@ -92,7 +93,7 @@ static int lm3560_mode_ctrl(struct lm3560_flash *flash)
 	return rval;
 }
 
-/* led1/2  enable/disable */
+/* led1/2 enable/disable */
 static int lm3560_enable_ctrl(struct lm3560_flash *flash,
 			      enum lm3560_led_id led_no, bool on)
 {
@@ -162,7 +163,7 @@ static int lm3560_flash_brt_ctrl(struct lm3560_flash *flash,
 	return rval;
 }
 
-/* V4L2 controls  */
+/* v4l2 controls  */
 static int lm3560_get_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no)
 {
 	struct lm3560_flash *flash = to_lm3560_flash(ctrl, led_no);
@@ -291,6 +292,7 @@ static int lm3560_init_controls(struct lm3560_flash *flash,
 	const struct v4l2_ctrl_ops *ops = &lm3560_led_ctrl_ops[led_no];
 
 	v4l2_ctrl_handler_init(hdl, 8);
+
 	/* flash mode */
 	v4l2_ctrl_new_std_menu(hdl, ops, V4L2_CID_FLASH_LED_MODE,
 			       V4L2_FLASH_LED_MODE_TORCH, ~0x7,
@@ -303,6 +305,7 @@ static int lm3560_init_controls(struct lm3560_flash *flash,
 
 	/* flash strobe */
 	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_STROBE, 0, 0, 0, 0);
+
 	/* flash strobe stop */
 	v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FLASH_STROBE_STOP, 0, 0, 0, 0);
 
@@ -389,7 +392,7 @@ static int lm3560_init_device(struct lm3560_flash *flash)
 	rval = lm3560_mode_ctrl(flash);
 	if (rval < 0)
 		return rval;
-	/* Reset faults */
+	/* reset faults */
 	rval = regmap_read(flash->regmap, REG_FLAG, &reg_val);
 	return rval;
 }
Signature · 1 line
1.9.0.rc3
#2 lore raw

PATCH 3/3 lm3560: prevent memory leak in case of pdata absence

In reply to Andy Shevchenko

If we have no pdata defined and driver fails to register we leak memory. Converting to devm_kzalloc prevents this to happen.

---
 drivers/media/i2c/lm3560.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/i2c/lm3560.c +1 -2
index 93e5227..c23de59 100644
@@ -416,8 +416,7 @@ static int lm3560_probe(struct i2c_client *client,
 
 	/* if there is no platform data, use chip default value */
 	if (pdata == NULL) {
-		pdata =
-		    kzalloc(sizeof(struct lm3560_platform_data), GFP_KERNEL);
+		pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
 		if (pdata == NULL)
 			return -ENODEV;
 		pdata->peak = LM3560_PEAK_3600mA;
Signature · 1 line
1.9.0.rc3