@@ -447,7 +447,7 @@ static struct smscore_registry_entry_t *smscore_find_registry(char *devpath)
447447 return entry ;
448448 }
449449 }
450- entry = kmalloc (sizeof (struct smscore_registry_entry_t ), GFP_KERNEL );
450+ entry = kmalloc (sizeof (* entry ), GFP_KERNEL );
451451 if (entry ) {
452452 entry -> mode = default_mode ;
453453 strcpy (entry -> devpath , devpath );
@@ -536,9 +536,7 @@ int smscore_register_hotplug(hotplug_t hotplug)
536536 int rc = 0 ;
537537
538538 kmutex_lock (& g_smscore_deviceslock );
539-
540- notifyee = kmalloc (sizeof (struct smscore_device_notifyee_t ),
541- GFP_KERNEL );
539+ notifyee = kmalloc (sizeof (* notifyee ), GFP_KERNEL );
542540 if (notifyee ) {
543541 /* now notify callback about existing devices */
544542 first = & g_smscore_devices ;
@@ -627,7 +625,7 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer,
627625{
628626 struct smscore_buffer_t * cb ;
629627
630- cb = kzalloc (sizeof (struct smscore_buffer_t ), GFP_KERNEL );
628+ cb = kzalloc (sizeof (* cb ), GFP_KERNEL );
631629 if (!cb )
632630 return NULL ;
633631
@@ -655,7 +653,7 @@ int smscore_register_device(struct smsdevice_params_t *params,
655653 struct smscore_device_t * dev ;
656654 u8 * buffer ;
657655
658- dev = kzalloc (sizeof (struct smscore_device_t ), GFP_KERNEL );
656+ dev = kzalloc (sizeof (* dev ), GFP_KERNEL );
659657 if (!dev )
660658 return - ENOMEM ;
661659
@@ -751,7 +749,7 @@ static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev,
751749 void * buffer , size_t size , struct completion * completion ) {
752750 int rc ;
753751
754- if (completion == NULL )
752+ if (! completion )
755753 return - EINVAL ;
756754 init_completion (completion );
757755
@@ -1153,8 +1151,8 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
11531151 }
11541152 pr_debug ("Firmware name: %s\n" , fw_filename );
11551153
1156- if (loadfirmware_handler == NULL && !( coredev -> device_flags
1157- & SMS_DEVICE_FAMILY2 ))
1154+ if (! loadfirmware_handler &&
1155+ !( coredev -> device_flags & SMS_DEVICE_FAMILY2 ))
11581156 return - EINVAL ;
11591157
11601158 rc = request_firmware (& fw , fw_filename , coredev -> device );
@@ -1301,10 +1299,8 @@ static int smscore_init_device(struct smscore_device_t *coredev, int mode)
13011299
13021300 buffer = kmalloc (sizeof (struct sms_msg_data ) +
13031301 SMS_DMA_ALIGNMENT , GFP_KERNEL | GFP_DMA );
1304- if (!buffer ) {
1305- pr_err ("Could not allocate buffer for init device message.\n" );
1302+ if (!buffer )
13061303 return - ENOMEM ;
1307- }
13081304
13091305 msg = (struct sms_msg_data * )SMS_ALIGN_ADDRESS (buffer );
13101306 SMS_INIT_MSG (& msg -> x_msg_header , MSG_SMS_INIT_DEVICE_REQ ,
@@ -1686,11 +1682,10 @@ static int smscore_validate_client(struct smscore_device_t *coredev,
16861682 pr_err ("The msg ID already registered to another client.\n" );
16871683 return - EEXIST ;
16881684 }
1689- listentry = kzalloc (sizeof (struct smscore_idlist_t ), GFP_KERNEL );
1690- if (!listentry ) {
1691- pr_err ("Can't allocate memory for client id.\n" );
1685+ listentry = kzalloc (sizeof (* listentry ), GFP_KERNEL );
1686+ if (!listentry )
16921687 return - ENOMEM ;
1693- }
1688+
16941689 listentry -> id = id ;
16951690 listentry -> data_type = data_type ;
16961691 list_add_locked (& listentry -> entry , & client -> idlist ,
@@ -1724,11 +1719,9 @@ int smscore_register_client(struct smscore_device_t *coredev,
17241719 return - EEXIST ;
17251720 }
17261721
1727- newclient = kzalloc (sizeof (struct smscore_client_t ), GFP_KERNEL );
1728- if (!newclient ) {
1729- pr_err ("Failed to allocate memory for client.\n" );
1722+ newclient = kzalloc (sizeof (* newclient ), GFP_KERNEL );
1723+ if (!newclient )
17301724 return - ENOMEM ;
1731- }
17321725
17331726 INIT_LIST_HEAD (& newclient -> idlist );
17341727 newclient -> coredev = coredev ;
@@ -1796,15 +1789,15 @@ int smsclient_sendrequest(struct smscore_client_t *client,
17961789 struct sms_msg_hdr * phdr = (struct sms_msg_hdr * ) buffer ;
17971790 int rc ;
17981791
1799- if (client == NULL ) {
1792+ if (! client ) {
18001793 pr_err ("Got NULL client\n" );
18011794 return - EINVAL ;
18021795 }
18031796
18041797 coredev = client -> coredev ;
18051798
18061799 /* check that no other channel with same id exists */
1807- if (coredev == NULL ) {
1800+ if (! coredev ) {
18081801 pr_err ("Got NULL coredev\n" );
18091802 return - EINVAL ;
18101803 }
@@ -1961,7 +1954,7 @@ int smscore_gpio_configure(struct smscore_device_t *coredev, u8 pin_num,
19611954 if (pin_num > MAX_GPIO_PIN_NUMBER )
19621955 return - EINVAL ;
19631956
1964- if (p_gpio_config == NULL )
1957+ if (! p_gpio_config )
19651958 return - EINVAL ;
19661959
19671960 total_len = sizeof (struct sms_msg_hdr ) + (sizeof (u32 ) * 6 );
0 commit comments