]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
isdn: hisax: config: Replace GFP_ATOMIC with GFP_KERNEL
authorJia-Ju Bai <baijiaju1990@gmail.com>
Fri, 27 Jul 2018 02:48:28 +0000 (10:48 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 Jul 2018 04:23:47 +0000 (21:23 -0700)
hisax_cs_new() and hisax_cs_setup() are never called in atomic context.
They call kmalloc() and kzalloc() with GFP_ATOMIC, which is not necessary.
GFP_ATOMIC can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/hisax/config.c

index fcc9c46127b40da1bf55ff346a69190bbc4a9fea..b12e6cae26c28d64c927151a25444e185ce24242 100644 (file)
@@ -1029,7 +1029,7 @@ static int hisax_cs_new(int cardnr, char *id, struct IsdnCard *card,
 
        *cs_out = NULL;
 
-       cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
+       cs = kzalloc(sizeof(struct IsdnCardState), GFP_KERNEL);
        if (!cs) {
                printk(KERN_WARNING
                       "HiSax: No memory for IsdnCardState(card %d)\n",
@@ -1059,12 +1059,12 @@ static int hisax_cs_new(int cardnr, char *id, struct IsdnCard *card,
                       "HiSax: Card Type %d out of range\n", card->typ);
                goto outf_cs;
        }
-       if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_ATOMIC))) {
+       if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_KERNEL))) {
                printk(KERN_WARNING
                       "HiSax: No memory for dlog(card %d)\n", cardnr + 1);
                goto outf_cs;
        }
-       if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_ATOMIC))) {
+       if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_KERNEL))) {
                printk(KERN_WARNING
                       "HiSax: No memory for status_buf(card %d)\n",
                       cardnr + 1);
@@ -1123,7 +1123,7 @@ static int hisax_cs_setup(int cardnr, struct IsdnCard *card,
 {
        int ret;
 
-       if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) {
+       if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_KERNEL))) {
                printk(KERN_WARNING "HiSax: No memory for isac rcvbuf\n");
                ll_unload(cs);
                goto outf_cs;