Commit 0aca7844 authored by Benjamin Romer's avatar Benjamin Romer Committed by Greg Kroah-Hartman

staging: unisys: remove ERRDEV macros

Remove the LOGERR, LOGERRDEV, LOGERRDEVX, LOGERRNAME, LOGORDUMPERR
macros from all the drivers.

In one case the removal of the ERRDRV() changed things such that a macro which
returned a value was needed, but the return value was no longer being used. In
this case the macro was replaced with the contents of the macro, but with the
truth calculation removed so that it would not generate a warning.
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 61620a1b
......@@ -78,9 +78,6 @@
(void *)(p2) = SWAPPOINTERS_TEMP; \
} while (0)
#define TBDDRV(fmt, args...) LOGERR(fmt, ## args)
#define HUHDRV(fmt, args...) LOGERR(fmt, ## args)
#define ERRDRV(fmt, args...) LOGERR(fmt, ## args)
#define WARNDRV(fmt, args...) LOGWRN(fmt, ## args)
#define SECUREDRV(fmt, args...) LOGWRN(fmt, ## args)
......
......@@ -184,10 +184,8 @@ wait_for_valid_guid(uuid_le __iomem *guid)
(void __iomem *)guid, sizeof(uuid_le));
if (uuid_le_cmp(tmpguid, NULL_UUID_LE) != 0)
break;
LOGERR("Waiting for non-0 GUID (why???)...\n");
UIS_THREAD_WAIT_SEC(5);
}
LOGERR("OK... GUID is non-0 now\n");
}
static inline unsigned int
......
......@@ -25,44 +25,6 @@
#include <linux/printk.h>
/*
* # LOGERR
*
* \brief Log error message - logs a message at the LOG_ERR level,
* including source line number information
*
* \param devname the device name of the device reporting this message, or
* NULL if this message is NOT device-related.
* \param fmt printf()-style format string containing the message to log.
* \param args Optional arguments to be formatted and inserted into the format
* \param string.
* \return nothing
*
* Logs the specified error message at the LOG_ERR level. It will also
* include the file, line number, and function name of where the error
* originated in the log message.
*/
#define LOGERR(fmt, args...) pr_err(fmt, ## args)
#define LOGERRDEV(devname, fmt, args...) \
pr_err("%s " fmt, devname, ## args)
#define LOGERRDEVX(devno, fmt, args...) \
pr_err("dev%d " fmt, devno, ## args)
#define LOGERRNAME(vnic, fmt, args...) \
do { \
if (vnic != NULL) { \
pr_err("%s " fmt, vnic->name, ## args); \
} else { \
pr_err(fmt, ## args); \
} \
} while (0)
#define LOGORDUMPERR(seqfile, fmt, args...) do { \
if (seqfile) { \
seq_printf(seqfile, fmt, ## args); \
} else { \
LOGERR(fmt, ## args); \
} \
} while (0)
/*
* # LOGWRN
*
......
This diff is collapsed.
......@@ -295,12 +295,10 @@ uisqueue_put_cmdrsp_with_lock_client(struct uisqueue_info *queueinfo,
while (!do_locked_client_insert(queueinfo, whichqueue, cmdrsp,
(spinlock_t *)insertlock,
channel_id)) {
if (oktowait != OK_TO_WAIT) {
LOGERR("****FAILED visor_signal_insert failed; cannot wait; insert aborted\n");
if (oktowait != OK_TO_WAIT)
return 0; /* failed to queue */
}
/* try again */
LOGERR("****FAILED visor_signal_insert failed; waiting to try again\n");
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(10));
}
......
......@@ -60,7 +60,6 @@ uisutil_add_proc_line_ex(int *total, char **buffer, int *buffer_remaining,
*buffer += *buffer_remaining;
*total += *buffer_remaining;
*buffer_remaining = 0;
LOGERR("bytes remaining is too small!\n");
return -1;
}
*buffer_remaining -= len;
......@@ -88,7 +87,6 @@ uisctrl_register_req_handler(int type, void *fptr,
break;
default:
LOGERR("invalid type %d.\n", type);
return 0;
}
if (chipset_driver_info)
......
This diff is collapsed.
This diff is collapsed.
......@@ -77,13 +77,11 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
visor_memregion_create_overlapped(parent->memregion,
off, sizeof(struct channel_header));
if (p->memregion == NULL) {
ERRDRV("visor_memregion_create failed failed: (status=0)\n");
rc = NULL;
goto cleanup;
}
if (visor_memregion_read(p->memregion, 0, &p->chan_hdr,
sizeof(struct channel_header)) < 0) {
ERRDRV("visor_memregion_read failed: (status=0)\n");
rc = NULL;
goto cleanup;
}
......@@ -94,7 +92,6 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
/* we had better be a CLIENT of this channel */
guid = p->chan_hdr.chtype;
if (visor_memregion_resize(p->memregion, channel_bytes) < 0) {
ERRDRV("visor_memregion_resize failed: (status=0)\n");
rc = NULL;
goto cleanup;
}
......@@ -255,10 +252,9 @@ visorchannel_clear(struct visorchannel *channel, ulong offset, u8 ch,
int written = 0;
u8 *buf = vmalloc(bufsize);
if (buf == NULL) {
ERRDRV("%s failed memory allocation", __func__);
if (buf == NULL)
goto cleanup;
}
memset(buf, ch, bufsize);
while (nbytes > 0) {
ulong thisbytes = bufsize;
......@@ -323,10 +319,8 @@ sig_read_header(struct visorchannel *channel, u32 queue,
{
BOOL rc = FALSE;
if (channel->chan_hdr.ch_space_offset < sizeof(struct channel_header)) {
ERRDRV("oChannelSpace too small: (status=%d)\n", rc);
if (channel->chan_hdr.ch_space_offset < sizeof(struct channel_header))
goto cleanup;
}
/* Read the appropriate SIGNAL_QUEUE_HEADER into local memory. */
......@@ -334,10 +328,6 @@ sig_read_header(struct visorchannel *channel, u32 queue,
SIG_QUEUE_OFFSET(&channel->chan_hdr, queue),
sig_hdr,
sizeof(struct signal_queue_header)) < 0) {
ERRDRV("queue=%d SIG_QUEUE_OFFSET=%d",
queue, (int)SIG_QUEUE_OFFSET(&channel->chan_hdr, queue));
ERRDRV("visor_memregion_read of signal queue failed: (status=%d)\n",
rc);
goto cleanup;
}
rc = TRUE;
......@@ -357,15 +347,11 @@ sig_do_data(struct visorchannel *channel, u32 queue,
if (visor_memregion_write(channel->memregion,
signal_data_offset,
data, sig_hdr->signal_size) < 0) {
ERRDRV("visor_memregion_write of signal data failed: (status=%d)\n",
rc);
goto cleanup;
}
} else {
if (visor_memregion_read(channel->memregion, signal_data_offset,
data, sig_hdr->signal_size) < 0) {
ERRDRV("visor_memregion_read of signal data failed: (status=%d)\n",
rc);
goto cleanup;
}
}
......@@ -403,8 +389,6 @@ safe_sig_queue_validate(struct signal_queue_header *psafe_sqh,
punsafe_sqh->head = *phead;
punsafe_sqh->tail = *ptail;
ERRDRV("safe_sig_queue_validate: head = 0x%x, tail = 0x%x, MaxSlots = 0x%x",
*phead, *ptail, psafe_sqh->max_slots);
return 0;
}
return 1;
......@@ -422,7 +406,6 @@ signalremove_inner(struct visorchannel *channel, u32 queue, void *msg)
sig_hdr.tail = (sig_hdr.tail + 1) % sig_hdr.max_slots;
if (!sig_read_data(channel, queue, &sig_hdr, sig_hdr.tail, msg)) {
ERRDRV("sig_read_data failed\n");
return FALSE;
}
sig_hdr.num_received++;
......@@ -431,14 +414,10 @@ signalremove_inner(struct visorchannel *channel, u32 queue, void *msg)
* update host memory.
*/
mb(); /* required for channel synch */
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, tail)) {
ERRDRV("visor_memregion_write of Tail failed\n");
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, tail))
return FALSE;
}
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_received)) {
ERRDRV("visor_memregion_write of NumSignalsReceived failed\n");
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_received))
return FALSE;
}
return TRUE;
}
......@@ -470,28 +449,28 @@ signalinsert_inner(struct visorchannel *channel, u32 queue, void *msg)
sig_hdr.head = ((sig_hdr.head + 1) % sig_hdr.max_slots);
if (sig_hdr.head == sig_hdr.tail) {
sig_hdr.num_overflows++;
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_overflows))
ERRDRV("visor_memregion_write of NumOverflows failed\n");
visor_memregion_write(channel->memregion,
SIG_QUEUE_OFFSET(&channel->chan_hdr,
queue) +
offsetof(struct signal_queue_header,
num_overflows),
&(sig_hdr.num_overflows),
sizeof(sig_hdr.num_overflows));
return FALSE;
}
if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.head, msg)) {
ERRDRV("sig_write_data failed\n");
if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.head, msg))
return FALSE;
}
sig_hdr.num_sent++;
/* For each data field in SIGNAL_QUEUE_HEADER that was modified,
* update host memory.
*/
mb(); /* required for channel synch */
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, head)) {
ERRDRV("visor_memregion_write of Head failed\n");
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, head))
return FALSE;
}
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_sent)) {
ERRDRV("visor_memregion_write of NumSignalsSent failed\n");
return FALSE;
}
......@@ -581,15 +560,13 @@ visorchannel_debug(struct visorchannel *channel, int num_queues,
int i = 0;
int errcode = 0;
if (channel == NULL) {
ERRDRV("%s no channel", __func__);
if (channel == NULL)
return;
}
memregion = channel->memregion;
if (memregion == NULL) {
ERRDRV("%s no memregion", __func__);
if (memregion == NULL)
return;
}
addr = visor_memregion_get_physaddr(memregion);
nbytes_region = visor_memregion_get_nbytes(memregion);
errcode = visorchannel_read(channel, off,
......@@ -669,11 +646,8 @@ visorchannel_dump_section(struct visorchannel *chan, char *s,
goto fmt_failed;
errcode = visorchannel_read(chan, off, buf, len);
if (errcode < 0) {
ERRDRV("%s failed to read %s from channel errcode=%d",
s, __func__, errcode);
if (errcode < 0)
goto read_failed;
}
seq_printf(seq, "channel %s:\n", s);
tbuf = buf;
while (len > 0) {
......
......@@ -60,25 +60,18 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel)
file_cdev.owner = THIS_MODULE;
if (MAJOR(majordev) == 0) {
/* dynamic major device number registration required */
if (alloc_chrdev_region(&majordev, 0, 1, MYDRVNAME) < 0) {
ERRDRV("Unable to allocate+register char device %s",
MYDRVNAME);
if (alloc_chrdev_region(&majordev, 0, 1, MYDRVNAME) < 0)
return -1;
}
registered = TRUE;
} else {
/* static major device number registration required */
if (register_chrdev_region(majordev, 1, MYDRVNAME) < 0) {
ERRDRV("Unable to register char device %s", MYDRVNAME);
if (register_chrdev_region(majordev, 1, MYDRVNAME) < 0)
return -1;
}
registered = TRUE;
}
rc = cdev_add(&file_cdev, MKDEV(MAJOR(majordev), 0), 1);
if (rc < 0) {
ERRDRV("failed to create char device: (status=%d)\n", rc);
if (rc < 0)
return -1;
}
return 0;
}
......@@ -122,15 +115,13 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma)
GUEST_PHYSICAL_ADDRESS addr = 0;
/* sv_enable_dfp(); */
if (offset & (PAGE_SIZE - 1)) {
ERRDRV("%s virtual address NOT page-aligned!", __func__);
if (offset & (PAGE_SIZE - 1))
return -ENXIO; /* need aligned offsets */
}
switch (offset) {
case VISORCHIPSET_MMAP_CONTROLCHANOFFSET:
vma->vm_flags |= VM_IO;
if (*file_controlvm_channel == NULL) {
ERRDRV("%s no controlvm channel yet", __func__);
return -ENXIO;
}
visorchannel_read(*file_controlvm_channel,
......@@ -138,7 +129,6 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma)
gp_control_channel),
&addr, sizeof(addr));
if (addr == 0) {
ERRDRV("%s control channel address is 0", __func__);
return -ENXIO;
}
physaddr = (ulong)addr;
......@@ -147,7 +137,6 @@ visorchipset_mmap(struct file *file, struct vm_area_struct *vma)
vma->vm_end - vma->vm_start,
/*pgprot_noncached */
(vma->vm_page_prot))) {
ERRDRV("%s remap_pfn_range failed", __func__);
return -EAGAIN;
}
break;
......@@ -179,7 +168,6 @@ static long visorchipset_ioctl(struct file *file, unsigned int cmd,
}
return issue_vmcall_update_physical_time(adjustment);
default:
LOGERR("visorchipset_ioctl received invalid command");
return -EFAULT;
}
}
......@@ -59,9 +59,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal,
allocbytes++;
if ((Controlvm_Payload_Bytes_Buffered + bytes)
> MAX_CONTROLVM_PAYLOAD_BYTES) {
ERRDRV("%s (%s:%d) - prevented allocation of %d bytes to prevent exceeding throttling max (%d)",
__func__, __FILE__, __LINE__, allocbytes,
MAX_CONTROLVM_PAYLOAD_BYTES);
if (tryAgain)
*tryAgain = TRUE;
rc = NULL;
......@@ -84,9 +81,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal,
void *p;
if (addr > virt_to_phys(high_memory - 1)) {
ERRDRV("%s - bad local address (0x%-16.16Lx for %lu)",
__func__,
(unsigned long long) addr, (ulong) bytes);
rc = NULL;
goto Away;
}
......@@ -110,27 +104,15 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal,
}
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
if (phdr->total_length != bytes) {
ERRDRV("%s - bad total length %lu (should be %lu)",
__func__,
(ulong) (phdr->total_length), (ulong) (bytes));
rc = NULL;
goto Away;
}
if (phdr->total_length < phdr->header_length) {
ERRDRV("%s - total length < header length (%lu < %lu)",
__func__,
(ulong) (phdr->total_length),
(ulong) (phdr->header_length));
rc = NULL;
goto Away;
}
if (phdr->header_length <
sizeof(struct spar_controlvm_parameters_header)) {
ERRDRV("%s - header is too small (%lu < %lu)",
__func__,
(ulong) (phdr->header_length),
(ulong)(sizeof(
struct spar_controlvm_parameters_header)));
rc = NULL;
goto Away;
}
......@@ -198,11 +180,8 @@ parser_id_get(PARSER_CONTEXT *ctx)
{
struct spar_controlvm_parameters_header *phdr = NULL;
if (ctx == NULL) {
ERRDRV("%s (%s:%d) - no context",
__func__, __FILE__, __LINE__);
if (ctx == NULL)
return NULL_UUID_LE;
}
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
return phdr->id;
}
......@@ -212,11 +191,8 @@ parser_param_start(PARSER_CONTEXT *ctx, PARSER_WHICH_STRING which_string)
{
struct spar_controlvm_parameters_header *phdr = NULL;
if (ctx == NULL) {
ERRDRV("%s (%s:%d) - no context",
__func__, __FILE__, __LINE__);
if (ctx == NULL)
goto Away;
}
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
switch (which_string) {
case PARSERSTRING_INITIATOR:
......@@ -236,7 +212,6 @@ parser_param_start(PARSER_CONTEXT *ctx, PARSER_WHICH_STRING which_string)
ctx->bytes_remaining = phdr->name_length;
break;
default:
ERRDRV("%s - bad which_string %d", __func__, which_string);
break;
}
......@@ -319,25 +294,18 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize)
}
while (*pscan != ':') {
if (namesize <= 0) {
ERRDRV("%s - name too big", __func__);
if (namesize <= 0)
return NULL;
}
*pnam = toupper(*pscan);
pnam++;
namesize--;
pscan++;
nscan--;
if (nscan == 0) {
ERRDRV("%s - unexpected end of input parsing name",
__func__);
if (nscan == 0)
return NULL;
}
}
if (namesize <= 0) {
ERRDRV("%s - name too big", __func__);
if (namesize <= 0)
return NULL;
}
*pnam = '\0';
nam[string_length_no_trail(nam, strlen(nam))] = '\0';
......@@ -348,26 +316,17 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize)
while (isspace(*pscan)) {
pscan++;
nscan--;
if (nscan == 0) {
ERRDRV("%s - unexpected end of input looking for value",
__func__);
if (nscan == 0)
return NULL;
}
}
if (nscan == 0) {
ERRDRV("%s - unexpected end of input looking for value",
__func__);
if (nscan == 0)
return NULL;
}
if (*pscan == '\'' || *pscan == '"') {
closing_quote = *pscan;
pscan++;
nscan--;
if (nscan == 0) {
ERRDRV("%s - unexpected end of input after %c",
__func__, closing_quote);
if (nscan == 0)
return NULL;
}
}
/* look for a separator character, terminator character, or
......@@ -375,10 +334,8 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize)
*/
for (i = 0, value_length = -1; i < nscan; i++) {
if (closing_quote) {
if (pscan[i] == '\0') {
ERRDRV("%s - unexpected end of input parsing quoted value", __func__);
if (pscan[i] == '\0')
return NULL;
}
if (pscan[i] == closing_quote) {
value_length = i;
break;
......@@ -391,10 +348,8 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize)
}
}
if (value_length < 0) {
if (closing_quote) {
ERRDRV("%s - unexpected end of input parsing quoted value", __func__);
if (closing_quote)
return NULL;
}
value_length = nscan;
}
orig_value_length = value_length;
......@@ -431,7 +386,6 @@ parser_param_get(PARSER_CONTEXT *ctx, char *nam, int namesize)
pscan++;
nscan--;
} else if (*pscan != '\0') {
ERRDRV("%s - missing separator after quoted string", __func__);
kfree(value);
value = NULL;
return NULL;
......
......@@ -39,11 +39,8 @@ struct charqueue *visor_charqueue_create(ulong nslots)
struct charqueue *cq;
cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY);
if (cq == NULL) {
ERRDRV("visor_charqueue_create allocation failed (alloc_size=%d)",
alloc_size);
if (cq == NULL)
return NULL;
}
cq->alloc_size = alloc_size;
cq->nslots = nslots;
cq->head = 0;
......
......@@ -61,9 +61,6 @@ static struct proc_dir_entry *
createProcDir(char *name, struct proc_dir_entry *parent)
{
struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent);
if (p == NULL)
ERRDRV("failed to create /proc directory %s", name);
return p;
}
......@@ -114,8 +111,6 @@ void visor_easyproc_InitDriver(struct easyproc_driver_info *pdriver,
{
memset(pdriver, 0, sizeof(struct easyproc_driver_info));
pdriver->ProcId = procId;
if (pdriver->ProcId == NULL)
ERRDRV("ProcId cannot be NULL (trouble ahead)!");
pdriver->Show_driver_info = show_driver_info;
pdriver->Show_device_info = show_device_info;
if (pdriver->ProcDir == NULL)
......@@ -132,9 +127,6 @@ void visor_easyproc_InitDriver(struct easyproc_driver_info *pdriver,
proc_create_data("diag", 0,
pdriver->ProcDriverDir,
&proc_fops_driver, pdriver);
if (pdriver->ProcDriverDiagFile == NULL)
ERRDRV("failed to register /proc/%s/driver/diag entry",
pdriver->ProcId);
}
}
EXPORT_SYMBOL_GPL(visor_easyproc_InitDriver);
......@@ -209,10 +201,6 @@ void visor_easyproc_InitDevice(struct easyproc_driver_info *pdriver,
p->procDevicexDiagFile =
proc_create_data("diag", 0, p->procDevicexDir,
&proc_fops_device, p);
if (p->procDevicexDiagFile == NULL)
ERRDEVX(devno, "failed to register /proc/%s/device/%d/diag entry",
pdriver->ProcId, devno
);
}
memset(&(p->device_property_info[0]), 0,
sizeof(p->device_property_info));
......@@ -229,34 +217,26 @@ void visor_easyproc_CreateDeviceProperty(struct easyproc_device_info *p,
size_t i;
struct easyproc_device_property_info *px = NULL;
if (p->procDevicexDir == NULL) {
ERRDRV("state error");
if (p->procDevicexDir == NULL)
return;
}
for (i = 0; i < ARRAY_SIZE(p->device_property_info); i++) {
if (p->device_property_info[i].procEntry == NULL) {
px = &(p->device_property_info[i]);
break;
}
}
if (!px) {
ERRDEVX(p->devno, "too many device properties");
if (!px)
return;
}
px->devdata = p->devdata;
px->pdriver = p->pdriver;
px->procEntry = proc_create_data(property_name, 0, p->procDevicexDir,
&proc_fops_device_property, px);
if (strlen(property_name)+1 > sizeof(px->property_name)) {
ERRDEVX(p->devno, "device property name %s too long",
property_name);
return;
}
strcpy(px->property_name, property_name);
if (px->procEntry == NULL) {
ERRDEVX(p->devno,
"failed to register /proc/%s/device/%d/%s entry",
p->pdriver->ProcId, p->devno, property_name);
return;
}
px->show_device_property_info = show_property_info;
......
......@@ -44,10 +44,9 @@ visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes)
struct memregion *memregion;
memregion = kzalloc(sizeof(*memregion), GFP_KERNEL | __GFP_NORETRY);
if (memregion == NULL) {
ERRDRV("visor_memregion_create allocation failed");
if (memregion == NULL)
return NULL;
}
memregion->physaddr = physaddr;
memregion->nbytes = nbytes;
memregion->overlapped = FALSE;
......@@ -71,20 +70,16 @@ visor_memregion_create_overlapped(struct memregion *parent, ulong offset,
{
struct memregion *memregion = NULL;
if (parent == NULL) {
ERRDRV("%s parent is NULL", __func__);
if (parent == NULL)
return NULL;
}
if (parent->mapped == NULL) {
ERRDRV("%s parent is not mapped!", __func__);
if (parent->mapped == NULL)
return NULL;
}
if ((offset >= parent->nbytes) ||
((offset + nbytes) >= parent->nbytes)) {
ERRDRV("%s range (%lu,%lu) out of parent range",
__func__, offset, nbytes);
((offset + nbytes) >= parent->nbytes))
return NULL;
}
memregion = kzalloc(sizeof(*memregion), GFP_KERNEL|__GFP_NORETRY);
if (memregion == NULL)
return NULL;
......@@ -105,17 +100,11 @@ mapit(struct memregion *memregion)
ulong nbytes = memregion->nbytes;
memregion->requested = FALSE;
if (!request_mem_region(physaddr, nbytes, MYDRVNAME))
ERRDRV("cannot reserve channel memory @0x%lx for 0x%lx-- no big deal",
physaddr, nbytes);
else
if (request_mem_region(physaddr, nbytes, MYDRVNAME))
memregion->requested = TRUE;
memregion->mapped = ioremap_cache(physaddr, nbytes);
if (memregion->mapped == NULL) {
ERRDRV("cannot ioremap_cache channel memory @0x%lx for 0x%lx",
physaddr, nbytes);
if (!memregion->mapped)
return FALSE;
}
return TRUE;
}
......@@ -179,10 +168,9 @@ memregion_readwrite(BOOL is_write,
struct memregion *memregion, ulong offset,
void *local, ulong nbytes)
{
if (offset + nbytes > memregion->nbytes) {
ERRDRV("memregion_readwrite offset out of range!!");
if (offset + nbytes > memregion->nbytes)
return -EIO;
}
if (is_write)
memcpy_toio(memregion->mapped + offset, local, nbytes);
else
......
......@@ -90,7 +90,6 @@ BOOL visor_periodic_work_nextperiod(struct periodic_work *pw)
goto unlock;
} else if (queue_delayed_work(pw->workqueue, &pw->work,
pw->jiffy_interval) < 0) {
ERRDEV(pw->devnam, "queue_delayed_work failed!");
pw->is_scheduled = FALSE;
rc = FALSE;
goto unlock;
......@@ -116,15 +115,12 @@ BOOL visor_periodic_work_start(struct periodic_work *pw)
goto unlock;
}
if (pw->want_to_stop) {
ERRDEV(pw->devnam,
"dev_start_periodic_work failed!");
rc = FALSE;
goto unlock;
}
INIT_DELAYED_WORK(&pw->work, &periodic_work_func);
if (queue_delayed_work(pw->workqueue, &pw->work,
pw->jiffy_interval) < 0) {
ERRDEV(pw->devnam, "%s queue_delayed_work failed!", __func__);
rc = FALSE;
goto unlock;
}
......
......@@ -96,8 +96,6 @@ createProcDir(const char *name, struct proc_dir_entry *parent)
{
struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent);
if (p == NULL)
ERRDRV("failed to create /proc directory %s", name);
return p;
}
......@@ -107,8 +105,6 @@ createProcFile(const char *name, struct proc_dir_entry *parent,
{
struct proc_dir_entry *p = proc_create_data(name, 0, parent,
fops, data);
if (p == NULL)
ERRDRV("failed to create /proc file %s", name);
return p;
}
......@@ -137,17 +133,16 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot,
MYPROCTYPE *rc = NULL, *type = NULL;
struct proc_dir_entry *parent = NULL;
if (procDirRoot == NULL) {
ERRDRV("procDirRoot cannot be NULL!\n");
if (procDirRoot == NULL)
goto Away;
}
if (name == NULL || name[0] == NULL) {
ERRDRV("name must contain at least 1 node name!\n");
if (name == NULL || name[0] == NULL)
goto Away;
}
type = kzalloc(sizeof(MYPROCTYPE), GFP_KERNEL | __GFP_NORETRY);
if (type == NULL)
goto Away;
type->name = name;
type->propertyNames = propertyNames;
type->nProperties = 0;
......@@ -222,13 +217,13 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type,
MYPROCOBJECT *obj = NULL, *rc = NULL;
int i = 0;
if (type == NULL) {
ERRDRV("type cannot be NULL\n");
if (type == NULL)
goto Away;
}
obj = kzalloc(sizeof(MYPROCOBJECT), GFP_KERNEL | __GFP_NORETRY);
if (obj == NULL)
goto Away;
obj->type = type;
obj->context = context;
if (name == NULL) {
......@@ -332,10 +327,8 @@ static int seq_show(struct seq_file *seq, void *offset)
{
struct proc_dir_entry_context *ctx = seq->private;
if (ctx == NULL) {
ERRDRV("I don't have a freakin' clue...");
if (ctx == NULL)
return 0;
}
(*ctx->show_property)(seq, ctx->procObject->context,
ctx->propertyIndex);
return 0;
......
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