Commit e5d218ee authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] siano: cleanups at smscoreapi.c

Some cleanups at smscoreapi. Most are just CodingStyle.
Also, use kzalloc when allocating a new buffer, as it initializes
the allocated space with zero.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9e915e5b
...@@ -490,10 +490,10 @@ static enum sms_device_type_st smscore_registry_gettype(char *devpath) ...@@ -490,10 +490,10 @@ static enum sms_device_type_st smscore_registry_gettype(char *devpath)
else else
sms_err("No registry found."); sms_err("No registry found.");
return -1; return -EINVAL;
} }
void smscore_registry_setmode(char *devpath, int mode) static void smscore_registry_setmode(char *devpath, int mode)
{ {
struct smscore_registry_entry_t *entry; struct smscore_registry_entry_t *entry;
...@@ -633,10 +633,11 @@ static struct ...@@ -633,10 +633,11 @@ static struct
smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer,
dma_addr_t common_buffer_phys) dma_addr_t common_buffer_phys)
{ {
struct smscore_buffer_t *cb = struct smscore_buffer_t *cb;
kmalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL);
cb = kzalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL);
if (!cb) { if (!cb) {
sms_info("kmalloc(...) failed"); sms_info("kzalloc(...) failed");
return NULL; return NULL;
} }
...@@ -710,8 +711,9 @@ int smscore_register_device(struct smsdevice_params_t *params, ...@@ -710,8 +711,9 @@ int smscore_register_device(struct smsdevice_params_t *params,
for (buffer = dev->common_buffer; for (buffer = dev->common_buffer;
dev->num_buffers < params->num_buffers; dev->num_buffers < params->num_buffers;
dev->num_buffers++, buffer += params->buffer_size) { dev->num_buffers++, buffer += params->buffer_size) {
struct smscore_buffer_t *cb = struct smscore_buffer_t *cb;
smscore_createbuffer(buffer, dev->common_buffer,
cb = smscore_createbuffer(buffer, dev->common_buffer,
dev->common_buffer_phys); dev->common_buffer_phys);
if (!cb) { if (!cb) {
smscore_unregister_device(dev); smscore_unregister_device(dev);
...@@ -1192,7 +1194,9 @@ static char *smscore_get_fw_filename(struct smscore_device_t *coredev, ...@@ -1192,7 +1194,9 @@ static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
{ {
char **fw; char **fw;
int board_id = smscore_get_board_id(coredev); int board_id = smscore_get_board_id(coredev);
enum sms_device_type_st type = smscore_registry_gettype(coredev->devpath); enum sms_device_type_st type;
type = smscore_registry_gettype(coredev->devpath);
if ((board_id == SMS_BOARD_UNKNOWN) || (lookup == 1)) { if ((board_id == SMS_BOARD_UNKNOWN) || (lookup == 1)) {
sms_debug("trying to get fw name from lookup table mode %d type %d", sms_debug("trying to get fw name from lookup table mode %d type %d",
...@@ -1320,6 +1324,9 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) ...@@ -1320,6 +1324,9 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
if (rc < 0) if (rc < 0)
sms_err("return error code %d.", rc); sms_err("return error code %d.", rc);
else
sms_debug("Success setting device mode.");
return rc; return rc;
} }
......
...@@ -973,7 +973,6 @@ struct smscore_config_gpio { ...@@ -973,7 +973,6 @@ struct smscore_config_gpio {
char *smscore_translate_msg(enum msg_types msgtype); char *smscore_translate_msg(enum msg_types msgtype);
extern void smscore_registry_setmode(char *devpath, int mode);
extern int smscore_registry_getmode(char *devpath); extern int smscore_registry_getmode(char *devpath);
extern int smscore_register_hotplug(hotplug_t hotplug); extern int smscore_register_hotplug(hotplug_t hotplug);
......
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