Message ID | 1436838521-8200-2-git-send-email-chaehyun.lim@gmail.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Kalle Valo |
Headers | show |
On Tue, Jul 14, 2015 at 10:48:41AM +0900, Chaehyun Lim wrote: > Remove WILC_ERRORREPORT macro. If memory allocation is failed, > jump to a label to return this function with WILC_NO_MEM. > > Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> > --- > drivers/staging/wilc1000/host_interface.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c > index ca97b70..f6ba7d1 100644 > --- a/drivers/staging/wilc1000/host_interface.c > +++ b/drivers/staging/wilc1000/host_interface.c > @@ -7142,8 +7142,11 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, > /* Bug 4599 : if tail length = 0 skip allocating & copying */ > if (u32TailLen > 0) { > pstrSetBeaconParam->pu8Tail = (u8 *)WILC_MALLOC(u32TailLen); > - if (pstrSetBeaconParam->pu8Tail == NULL) > - WILC_ERRORREPORT(s32Error, WILC_NO_MEM); > + if (pstrSetBeaconParam->pu8Tail == NULL) { > + PRINT_ER("Failed to allocate memory\n"); This message is redundant, the core already just told the user this, so it's not needed to tell them this again. And as an aside, the mess in WILC_MALLOC() needs to go as well, that's horrid, and wrong :( thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Jul 15, 2015 at 6:16 AM, Greg KH <gregkh@linuxfoundation.org> wrote: > On Tue, Jul 14, 2015 at 10:48:41AM +0900, Chaehyun Lim wrote: >> Remove WILC_ERRORREPORT macro. If memory allocation is failed, >> jump to a label to return this function with WILC_NO_MEM. >> >> Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> >> --- >> drivers/staging/wilc1000/host_interface.c | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c >> index ca97b70..f6ba7d1 100644 >> --- a/drivers/staging/wilc1000/host_interface.c >> +++ b/drivers/staging/wilc1000/host_interface.c >> @@ -7142,8 +7142,11 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, >> /* Bug 4599 : if tail length = 0 skip allocating & copying */ >> if (u32TailLen > 0) { >> pstrSetBeaconParam->pu8Tail = (u8 *)WILC_MALLOC(u32TailLen); >> - if (pstrSetBeaconParam->pu8Tail == NULL) >> - WILC_ERRORREPORT(s32Error, WILC_NO_MEM); >> + if (pstrSetBeaconParam->pu8Tail == NULL) { >> + PRINT_ER("Failed to allocate memory\n"); > > This message is redundant, the core already just told the user this, so > it's not needed to tell them this again. > > And as an aside, the mess in WILC_MALLOC() needs to go as well, that's > horrid, and wrong :( Thank you for your comment. You think WILC_MALLOC() should be changed. Could you give me a direction how this function should be changed? thanks, Chaehyun Lim > > thanks, > > greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Jul 15, 2015 at 08:14:08AM +0900, Chaehyun Lim wrote: > On Wed, Jul 15, 2015 at 6:16 AM, Greg KH <gregkh@linuxfoundation.org> wrote: > > On Tue, Jul 14, 2015 at 10:48:41AM +0900, Chaehyun Lim wrote: > >> Remove WILC_ERRORREPORT macro. If memory allocation is failed, > >> jump to a label to return this function with WILC_NO_MEM. > >> > >> Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> > >> --- > >> drivers/staging/wilc1000/host_interface.c | 7 +++++-- > >> 1 file changed, 5 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c > >> index ca97b70..f6ba7d1 100644 > >> --- a/drivers/staging/wilc1000/host_interface.c > >> +++ b/drivers/staging/wilc1000/host_interface.c > >> @@ -7142,8 +7142,11 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, > >> /* Bug 4599 : if tail length = 0 skip allocating & copying */ > >> if (u32TailLen > 0) { > >> pstrSetBeaconParam->pu8Tail = (u8 *)WILC_MALLOC(u32TailLen); > >> - if (pstrSetBeaconParam->pu8Tail == NULL) > >> - WILC_ERRORREPORT(s32Error, WILC_NO_MEM); > >> + if (pstrSetBeaconParam->pu8Tail == NULL) { > >> + PRINT_ER("Failed to allocate memory\n"); > > > > This message is redundant, the core already just told the user this, so > > it's not needed to tell them this again. > > > > And as an aside, the mess in WILC_MALLOC() needs to go as well, that's > > horrid, and wrong :( > > Thank you for your comment. You think WILC_MALLOC() should be changed. > Could you give me a direction how this function should be changed? Hm, let me turn the question around, why do you think it should be there at all? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index ca97b70..f6ba7d1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -7142,8 +7142,11 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, /* Bug 4599 : if tail length = 0 skip allocating & copying */ if (u32TailLen > 0) { pstrSetBeaconParam->pu8Tail = (u8 *)WILC_MALLOC(u32TailLen); - if (pstrSetBeaconParam->pu8Tail == NULL) - WILC_ERRORREPORT(s32Error, WILC_NO_MEM); + if (pstrSetBeaconParam->pu8Tail == NULL) { + PRINT_ER("Failed to allocate memory\n"); + s32Error = WILC_NO_MEM; + goto _fail_; + } WILC_memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); } else { pstrSetBeaconParam->pu8Tail = NULL;
Remove WILC_ERRORREPORT macro. If memory allocation is failed, jump to a label to return this function with WILC_NO_MEM. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> --- drivers/staging/wilc1000/host_interface.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)