Commit b317d0f5 authored by Luke Hart's avatar Luke Hart Committed by Mauro Carvalho Chehab

[media] radio-bcm2048.c: Fix some checkpatch.pl errors

Fix the following warnings reported in radio-bcm2048.c:

WARNING: else is not generally useful after a break or return
374: FILE: radio-bcm2048.c:374:
+		return 0;
+	} else {

WARNING: else is not generally useful after a break or return
728: FILE: radio-bcm2048.c:728:
+			return BCM2048_DE_EMPHASIS_75us;
+		else

WARNING: unchecked sscanf return value
1974: FILE: radio-bcm2048.c:1974:
+	sscanf(buf, mask, &value);					\

WARNING: Missing a blank line after declarations
2245: FILE: radio-bcm2048.c:2245:
+		unsigned char tmpbuf[3];
+		tmpbuf[i] = bdev->rds_info.radio_text[bdev->rd_index+i+2];

WARNING: Possible unnecessary 'out of memory' message
2601: FILE: radio-bcm2048.c:2601:
+	if (!bdev) {
+		dev_dbg(&client->dev, "Failed to alloc video device.\n");

The following error was left since it seems to be a false positive:

ERROR: Macros with complex values should be enclosed in parenthesis
+#define DEFINE_SYSFS_PROPERTY(prop, signal, size, mask, check)		\
+property_write(prop, signal size, mask, check)				\
+property_read(prop, size, mask)
Signed-off-by: default avatarLuke Hart <luke.hart@birchleys.eu>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 599bc36a
...@@ -369,13 +369,12 @@ static int bcm2048_send_command(struct bcm2048_device *bdev, unsigned int reg, ...@@ -369,13 +369,12 @@ static int bcm2048_send_command(struct bcm2048_device *bdev, unsigned int reg,
data[0] = reg & 0xff; data[0] = reg & 0xff;
data[1] = value & 0xff; data[1] = value & 0xff;
if (i2c_master_send(client, data, 2) == 2) { if (i2c_master_send(client, data, 2) == 2)
return 0; return 0;
} else {
dev_err(&bdev->client->dev, "BCM I2C error!\n"); dev_err(&bdev->client->dev, "BCM I2C error!\n");
dev_err(&bdev->client->dev, "Is Bluetooth up and running?\n"); dev_err(&bdev->client->dev, "Is Bluetooth up and running?\n");
return -EIO; return -EIO;
}
} }
static int bcm2048_recv_command(struct bcm2048_device *bdev, unsigned int reg, static int bcm2048_recv_command(struct bcm2048_device *bdev, unsigned int reg,
...@@ -725,8 +724,8 @@ static int bcm2048_get_fm_deemphasis(struct bcm2048_device *bdev) ...@@ -725,8 +724,8 @@ static int bcm2048_get_fm_deemphasis(struct bcm2048_device *bdev)
if (!err) { if (!err) {
if (value & BCM2048_DE_EMPHASIS_SELECT) if (value & BCM2048_DE_EMPHASIS_SELECT)
return BCM2048_DE_EMPHASIS_75us; return BCM2048_DE_EMPHASIS_75us;
else
return BCM2048_DE_EMPHASIS_50us; return BCM2048_DE_EMPHASIS_50us;
} }
return err; return err;
...@@ -1971,7 +1970,8 @@ static ssize_t bcm2048_##prop##_write(struct device *dev, \ ...@@ -1971,7 +1970,8 @@ static ssize_t bcm2048_##prop##_write(struct device *dev, \
if (!bdev) \ if (!bdev) \
return -ENODEV; \ return -ENODEV; \
\ \
sscanf(buf, mask, &value); \ if (sscanf(buf, mask, &value) != 1) \
return -EINVAL; \
\ \
if (check) \ if (check) \
return -EDOM; \ return -EDOM; \
...@@ -2242,6 +2242,7 @@ static ssize_t bcm2048_fops_read(struct file *file, char __user *buf, ...@@ -2242,6 +2242,7 @@ static ssize_t bcm2048_fops_read(struct file *file, char __user *buf,
i = 0; i = 0;
while (i < count) { while (i < count) {
unsigned char tmpbuf[3]; unsigned char tmpbuf[3];
tmpbuf[i] = bdev->rds_info.radio_text[bdev->rd_index+i+2]; tmpbuf[i] = bdev->rds_info.radio_text[bdev->rd_index+i+2];
tmpbuf[i+1] = bdev->rds_info.radio_text[bdev->rd_index+i+1]; tmpbuf[i+1] = bdev->rds_info.radio_text[bdev->rd_index+i+1];
tmpbuf[i+2] = ((bdev->rds_info.radio_text[bdev->rd_index+i] tmpbuf[i+2] = ((bdev->rds_info.radio_text[bdev->rd_index+i]
...@@ -2598,7 +2599,6 @@ static int bcm2048_i2c_driver_probe(struct i2c_client *client, ...@@ -2598,7 +2599,6 @@ static int bcm2048_i2c_driver_probe(struct i2c_client *client,
bdev = kzalloc(sizeof(*bdev), GFP_KERNEL); bdev = kzalloc(sizeof(*bdev), GFP_KERNEL);
if (!bdev) { if (!bdev) {
dev_dbg(&client->dev, "Failed to alloc video device.\n");
err = -ENOMEM; err = -ENOMEM;
goto exit; goto exit;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment